-qunroll

Description

Unrolls inner loops in the program. This can help improve program performance.

Syntax

Read syntax diagramSkip visual syntax diagram        .-unroll--=--auto---------.
>>- -q--+-unroll--+-------------+-+----------------------------><
        |         |    .-yes--. | |
        |         '-=--+-auto-+-' |
        |              '-no---'   |
        '-nounroll----------------'

where:

-qunroll=auto Leaves the decision to unroll loops to the compiler. This is the compiler default.
-qunroll or -qunroll=yes Suggests to the compiler that it unroll loops.
-qnounroll or -qunroll=no Instructs the compiler to not unroll loops.

See also #pragma unroll and #pragma options.

Notes

The compiler default for this option, unless explicitly specified otherwise on the command line, is -qunroll=auto.

Specifying -qunroll without any suboptions is equivalent to specifying -qunroll=yes.

When -qunroll, -qunroll=yes, or -qunroll=auto is specified, the bodies of inner loops will be unrolled, or duplicated, by the optimizer. The optimizer determines and applies the best unrolling factor for each loop. In some cases, the loop control may be modified to avoid unnecessary branching.

To see if the unroll option improves performance of a particular application, you should first compile the program with usual options, then run it with a representative workload. You should then recompile with command line -qunroll option and/or the unroll pragmas enabled, then rerun the program under the same conditions to see if performance improves.

You can use the #pragma unroll directive to gain more control over unrolling. Setting this pragma overrides the -qunroll compiler option setting.

Examples

  1. In the following examples, unrolling is disabled:
    xlc++ -qnounroll file.C
    
    xlc++ -qunroll=no file.C
  2. In the following examples, unrolling is enabled:
    xlc++ -qunroll file.C
    
    xlc++ -qunroll=yes file.C
    
    xlc++ -qunroll=auto file.C
  3. See #pragma unroll for examples of how program code is unrolled by the compiler.

Related information