Loop Unrolling

The benefits of loop unrolling are as follows:

The -unroll[n] (Linux* and Mac OS*) or /Qunroll:[n] (Windows*) option controls how the Intel® compiler handles loop unrolling.

Refer to Applying Optimization Strategies for more information.

Linux and Mac OS

Windows

Description

-unrolln

/Qunroll:n

Specifies the maximum number of times you want to unroll a loop. The following examples unrolls a loop four times:

ifort -unroll4 a.f90 (Linux and Mac OS)

ifort /Qunroll:4 a.f90 (Windows)

Note

The compilers for IA-64 architecture recognizes only n = 0; any other value is ignored.

Omitting a value for n lets the compiler decide whether to perform unrolling or not. This is the default; the compiler uses default heuristics or defines n.

Passing 0 as n disables loop unrolling; the following examples disables loop unrolling:

ifort -unroll0 a.f90 (Linux and Mac OS)

ifort /Qunroll:0 a.f90 (Windows)

For more information about the option behaviors listed above, see the following topic: