Enables or disables loop unrolling and jamming. These pragmas can only be applied to iterative for loops.
- The unrolling factor representing the number of times to unroll a loop; it must be an integer constant from 0 through 255
unroll_and_jampragma partially unrolls one or more loops higher in the nest than the innermost loop and fuses/jams the resulting loops back together. This transformation allows more reuses in the loop.
This pragma is not effective on innermost loops. Ensure that the immediately following loop is not the innermost loop after compiler-initiated interchanges are completed.
Specifying this pragma is a hint to the compiler that the unroll and jam sequence is legal and profitable. The compiler enables this transformation whenever possible.
unroll_and_jampragma must precede the
forstatement for each
forloop it affects. If
nis specified, the optimizer unrolls the loop
nis omitted or if it is outside the allowed range, the optimizer assigns the number of times to unroll the loop. The compiler generates correct code by comparing
nand the loop count.
This pragma is supported only when compiler option
O3is set. The
unroll_and_jampragma overrides any setting of loop unrolling from the command line.
When unrolling a loop increases register pressure and code size it may be necessary to prevent unrolling of a nested loop or an imperfect nested loop. In such cases, use the
nounroll_and_jampragma hints to the compiler not to unroll a specified loop.