Loop Unrolling

You can unroll loops and specify the maximum number of times you want the compiler to do so.

How to Enable Loop Unrolling

You use the -unroll[n] option to unroll loops. n  determines the maximum number of times for the unrolling operation. This applies only to loops that the compiler determines should be unrolled. Omit n to let the compiler decide whether to perform unrolling or not.

The following example unrolls a loop at most four times:

IA-32 Systems: prompt>icc -unroll4 a.cpp

How to Disable Loop Unrolling

Disable loop unrolling by setting n to 0.

The following example disables loop unrolling:

IA-32 Systems: prompt>icc -unroll0 a.cpp