Digital Signal Processing Reference
In-Depth Information
4. -o3 performs a file optimization in addition to the optimizations performed
by the three previous options: -o0 , -o1 , and -o2 .
The options -o2 and -o3 attempt to do software optimization.
8.2.2 Intrinsic C Functions
There are a number of available C intrinsic functions that can be used to increase
the efficiency of code (see also Example 3.1):
1. int_mpy() has the equivalent ASM instruction MPY , which multiplies the
16 LSBs of a number by the 16 LSBs of another number.
2. int_mpyh() has the equivalent ASM instruction MPYH , which multiplies the
16 MSBs of a number by the 16 MSBs of another number.
3. int_mpylh() has the equivalent ASM instruction MPYLH , which multiplies
the 16 LSBs of a number by the 16 MSBs of another number.
4. int_mpyhl() has the equivalent instruction MPYHL , which multiplies the
16 MSBs of a number by the 16 LSBs of another number.
5. void_nassert(int) generates no code. It tells the compiler that the
expression declared with the assert function is true. This conveys information
to the compiler about alignment of pointers and arrays and of valid opti-
mization schemes, such as word-wide optimization.
6. uint_lo(double) and uint_hi(double) obtain the low and high 32 bits
of a double word, respectively (available on C67x or C64x).
8.3 PROCEDURE FOR CODE OPTIMIZATION
1. Use instructions in parallel so that multiple functional units can be operated
within the same cycle.
2. Eliminate NOP s or delay slots, placing code where the NOP s are located.
3. Unroll the loop to avoid overhead with branching.
4. Use word-wide data to access a 32-bit word ( int ) in lieu of a 16-bit half-word
( short ).
5. Use software pipelining, illustrated in Section 8.5.
8.4 PROGRAMMING EXAMPLES USING CODE
OPTIMIZATION TECHNIQUES
Several examples are developed to illustrate various techniques to increase the effi-
ciency of code. Optimization using software pipelining is discussed in Section 8.5.
Search WWH ::




Custom Search