UNROLL and NOUNROLL

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.

Syntax

cDEC$ UNROLL [(n)] -or- cDEC$ UNROLL [= n]
cDEC$ NOUNROLL


c
Is one of the following: C (or c), !, or *. (See Syntax Rules for Compiler Directives.)


n
Is an integer constant. The range of n is 0 through 255.

Description

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 O3 must be set.

See Also

General Compiler Directives, Rules for General Directives that Affect DO Loops, O compiler option

Example

cDEC$ UNROLL
  do i =1, m
    b(i) = a(i) + 1
    d(i) = c(i) + 1
  enddo