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:

icpc -unroll4 a.cpp (Linux and Mac OS)

icl /Qunroll:4 a.cpp (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:

icpc -unroll0 a.cpp (Linux and Mac OS)

icl /Qunroll:0 a.cpp (Windows)

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

-funroll-all-loops

No equivalent

Instructs the compiler to unroll all loops even if the number of iterations is uncertain when the loop is entered.

For more information about the option, see the following topic: