2.13. Optimization (Scalar)

The following sections describe scalar optimization options.

2.13.1. -h [no]interchange (CC, cc Commands)

Default option: 

-h interchange

The -h interchange option instructs the compiler to attempt to interchange all loops, a technique that is used to gain performance by having the compiler swap an inner loop with an outer loop. The compiler attempts the interchange only if the interchange will increase performance. Loop interchange is performed only at scalar optimization level 2 or higher.

The -h nointerchange option prevents the compiler from attempting to interchange any loops. To disable interchange of loops individually, use the #pragma nointerchange directive.

2.13.2. -h scalarn (CC, cc Commands)

Default option: 

-h scalar1

The -h scalarn option specifies the level of automatic scalar optimization to be performed. Scalar optimization directives are unaffected by this option (see Section 4.10).

Argument n can be one of the following:

n 

Description

0 

No automatic scalar optimization. The -h nobl, -h nofastfpdivide, -h nofastmd, -h nofastmodulus, -h matherror=errno, and -h zeroinc options are implied by -h scalar0.

1 

Conservative automatic scalar optimization. This level implies -h fastmd, -h fastfpdivide, -h matherror=abort, and -h nozeroinc and causes automatic loop alignment to be performed.

2 

Moderate automatic scalar optimization. The scalar optimizations specified by scalar1 are performed.

3 

Aggressive automatic scalar optimization. The scalar optimizations specified by scalar2 are performed and -h fastmodulus and -h bl are implied.

2.13.3. -h [no]align (CC, cc Commands)

Default option: 

-h noalign

(UNICOS systems) The -h align option specifies that all functions defined in the file are to be automatically aligned on instruction buffer boundaries. This alignment can significantly improve performance for small, frequently called functions. With -h noalign, automatic function alignment is not done.

To control alignment of functions individually, use the align directive. For more information on the align directive and function alignment, see Section 4.10.1.

2.13.4. -h [no]bl (CC, cc Commands)

Default option: 

-h nobl

The -h bl option specifies a faster, but potentially unsafe, form of bottom loading. -h nobl dictates that this technique is not used. This option is affected by the scalar optimization level (see Section 2.13.2).

2.13.5. -h [no]reduction (CC, cc Commands)

Default option: 

-h reduction

On UNICOS systems, the -h reduction option instructs the compiler to enable vectorization of all reduction loops. On UNICOS/mk systems, the -h reduction option instructs the compiler to rewrite some multiplication operations to be a series of addition operations. With -h noreduction, these optimizations are not done. This option is affected by the -h scalarn option (see Section 2.13.2). Reduction loops and the noreduction directive are discussed in Section 4.10.6.

2.13.6. -h [no]zeroinc (CC, cc Commands)

Default option: 

-h nozeroinc

The -h nozeroinc option improves run-time performance by causing the compiler to assume that constant increment variables (CIVs) in loops are not incremented by expressions with a value of 0.

The -h zeroinc option causes the compiler to assume that some CIVs in loops might be incremented by 0 for each pass through the loop, preventing generation of optimized code. For example, in a loop with index i, the expression expr in the statement i += expr can evaluate to 0. This rarely happens in actual code. -h zeroinc is the safer and slower option. This option is affected by the -h scalarn option (see Section 2.13.2).