2.3.2. #pragma unroll_completely

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 non vectorized loops can be unrolled using #pragma unroll_completely. That is, #pragma unroll_completely applies to both --no_vectorize and --vectorize.


When compiling at -O3 -Otime, the compiler automatically unrolls loops where it is beneficial to do so. You can use this pragma to request that the compiler completely unroll a loop that has not automatically been unrolled completely.


Use this #pragma only when you have evidence, for example from --diag_warning=optimizations, that the compiler is not unrolling loops optimally by itself.


#pragma unroll_completely can only be used immediately before a for loop, a while loop, or a do ... while loop.

Using #pragma unroll_completely on an outer loop can prevent vectorization. On the other hand, using #pragma unroll_completely on an inner loop might help in some cases.

See also

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0350A