EasyManua.ls Logo

Infineon Technologies TriCore Compiler - Chapter 1 Optimization Strategies; 1.1 Using 16-bit Instructions

Default Icon
64 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
TriCore 32-bit Unified Processor
Compiler Writer’s Guide
Table of Contents Page
User’s Manual v V1.4, 2003-12
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1 Optimization Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1 Using 16-bit Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.1 Register Allocation and Code Scheduling for Short Instructions . . . . . . . . . .8
1.1.2 16-bit Loads and Stores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
1.1.3 Loads and Stores with Implicit Base and Implicit Destination . . . . . . . . . . .10
1.1.4 Other Implicit D15 Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
1.1.4.1 “2.5 Address” Alternatives for Dyadic Instructions . . . . . . . . . . . . . . . . . . . 11
1.1.4.2 Instructions with 8-bit Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.1.4.3 Compare Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.1.4.4 Compare and Jump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2 Using Complex Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2.1 Auto-adjust Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
1.2.2 Circular Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
1.2.3 Compare and Jump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
1.2.4 Multiply-Add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
1.2.5 Absolute Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
1.2.6 Min and Max . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
1.2.7 Count Leading (CL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
1.2.8 Conditional Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16
1.2.9 Extending the Use of Conditional Instructions . . . . . . . . . . . . . . . . . . . . . . .17
1.2.10 Accumulating Compare Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
1.3 Using Bit Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3.1 Template Matching for Extract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
1.3.2 Template Matching for Insert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21
1.3.3 Bit-Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
1.4 Call Related Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.4.1 FCALL (Fast Call) Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
1.4.2 Tail Call Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
1.5 QSEED FPU (Floating Point Unit) Instruction . . . . . . . . . . . . . . . . . . . . . . 25
1.6 Miscellaneous Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.6.1 LOOP Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
1.6.2 Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
1.6.3 Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
1.6.4 Switch Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
2 Implementation Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.1 Pipeline Model and Instruction Scheduling . . . . . . . . . . . . . . . . . . . . . . . . 30
2.1.1 First Approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
2.1.1.1 Simple Pipeline Model for TriCore 1.2/1.3 and TriCore 2.0 . . . . . . . . . . . . 31
2.1.1.2 Simple Scheduling Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.1.2 Latency Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33

Table of Contents