This pragma instructs the compiler to completely unroll a loop. It has an effect only if the compiler can determine the number of iterations the loop has.
Both vectorized and nonvectorized loops can be unrolled using
unroll_completely. That is,
#pragma unroll_completely applies
This pragma is only applicable if you are compiling with
-Otime. When compiling with
the compiler automatically unrolls loops where it is beneficial
to do so. You can use this pragma to ask the compiler to completely
unroll a loop that has not automatically been unrolled completely.
#pragma only when you have evidence,
for example from
that the compiler is not unrolling loops optimally by itself.
You cannot determine whether this pragma is having any effect
unless you compile with
examine the generated assembly code, or both.
This pragma can only take effect when you compile with
-Otime. Even then, the use of this pragma is a request to
the compiler to unroll a loop that has not been unrolled automatically.
It does not guarantee that the loop is unrolled.
#pragma unroll_completely can only be used
immediately before a for loop, a while loop,
or a do ... while loop.
#pragma unroll_completely on an outer
loop can prevent vectorization. On the other hand, using
unroll_completely on an inner loop might help in some