Download ST200 Micro Toolset User Manual

Transcript
PRELIMINARY DATA
Loop optimization pragmas
55
One scenario of usage is for ‘for’ loops with trip counts of unknown values where
the user knows that the approximate effective value is low:
#pragma looptrip(4)
for (i=0; i<n; i++)
a[i] = b[i] ;
This example avoids non-beneficial optimizations. On such loops the compiler trip
count estimate without the pragma is 100.
A second scenario is for ‘while’ loops where the user knows that the approximate
effective trip count is high:
#pragma looptrip(100)
while (*p++=*s++)
This example gives a better approximation of the weight of the loop. Generally the
compiler trip count estimate for a ‘while’ loop is very low.
Note:
Possible error messages are:
• Warning : pragma ‘LOOPTRIP’ : inconsistent with computed
value, ignored
• Warning : pragma ‘LOOPTRIP’ : not followed by a loop, ignored
• Warning : malformed ‘#pragma looptrip (n)’
4.2.6 #pragma pipeline
This pragma is used to override pipelining and renaming defaults on a particular
loop. This is a -O3 optimization and the defaults are: pipelining=3 and
renaming=2. With pipelining=3, the maximum performance software pipeline is
built, with possible code increase. Using pipelining=1 and renaming=1 may
reduce code size.
The meaning for pipelining is as follows:
• pipelining=0, no loop iteration overlap,
• pipelining=1, maximum overlap over 1 iteration,
• pipelining=2, maximum overlap over 3 iterations,
• pipelining=3, maximum overlap over 7 iterations.
The meaning for renaming is as follows:
STMicroelectronics
ADCS 7508723H
ST200 Micro Toolset User Manual