Intel® Fortran Compiler 16.0 User and Reference Guide
General Compiler Directive: Tells the compiler's optimizer how many times to unroll a DO loop or disables the unrolling of a DO loop. These directives can only be applied to iterative DO loops.
!DIR$ UNROLL [(n)] -or- !DIR$ UNROLL [=n]
!DIR$ NOUNROLL
n |
Is an integer constant. The range of n is 0 through 255. |
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 picks the number of times to unroll the loop.
The UNROLL directive overrides any setting of loop unrolling from the command line.
To use these directives, compiler option O2 or O3 must be set.
!DIR$ UNROLL do i =1, m b(i) = a(i) + 1 d(i) = c(i) + 1 enddo
The following shows another example:
!DIR$ UNROLL= 4 do i =1, m b(i) = a(c(i)) + 1 enddo