Loop Unrolling Support

The UNROLL[n] directive tells the compiler how many times to unroll a counted loop.

The UNROLL  directive must precede the DO statement for each DO loop it affects. If n is specified, the optimizer unrolls the loop n times. If n is omitted or if it is outside the allowed range, the optimizer assigns the number of times to unroll the loop.

This directive is supported only when option -O3 (Linux*) or /O3 (Windows*) is on.

The UNROLL directive overrides any setting of loop unrolling from the command line.

Currently, the directive can be applied only for the innermost loop nest. If applied to the outer loop nests, it is ignored. The compiler generates correct code by comparing n and the loop count.

Example

!DEC$ UNROLL(4)

   do i = 1, m

     b(i) = a(i) + 1

     d(i) = c(i) + 1

  enddo

For more details on these directives, see "Directive Enhanced Compilation", section "General Directives", in the Intel® Fortran Language Reference.