-qsimd

Category

Optimization and tuning

Pragma equivalent

#pragma nosimd

Purpose

Controls whether the compiler can automatically take advantage of vector instructions for processors that support them.

These instructions can offer higher performance when used with algorithmic-intensive tasks such as multimedia applications.

Syntax

Read syntax diagramSkip visual syntax diagram
                 .-noauto-.   
>>- -q--simd--=--+-auto---+------------------------------------><

Defaults

-qsimd=noauto

Usage

The -qsimd=auto option enables automatic generation of vector instructions for processors that support them. It replaces the -qenablevmx option, which has been deprecated.

When -qsimd=auto is in effect, the compiler converts certain operations that are performed in a loop on successive elements of an array into vector instructions. These instructions calculate several results at one time, which is faster than calculating each result sequentially. Applying this option is useful for applications with significant image processing demands.

The -qsimd=noauto option disables the conversion of loop array operations into vector instructions. Finer control can be achieved by using -qstrict=ieeefp, -qstrict=operationprecision, and -qstrict=vectorprecision. For details, see -qstrict.

Note: Using vector instructions to calculate several results at one time might delay or even miss detection of floating point exceptions on some architectures. If detecting exceptions is important, do not use -qsimd=auto.
The following rules apply when you use the -qsimd option:
  • Specifying the deprecated -qenablevmx option has the same effect as specifying -qsimd=auto. The compiler does not issue any warning for this.
  • Specifying -qsimd without any suboption has the same effect as -qsimd=auto.
  • This option is available only when you set -qarch to a target architecture that supports vector instructions.
  • Specify -qsimd=auto only when your processor architecture supports vector processing.
  • If you specify -qsimd=auto to enable IPA at the compile time but specify -simd=noauto at the link time, the compiler automatically sets -qsimd=auto and sets an appropriate value for -qarch to match the architecture specified at the compile time.

Predefined macros

None.

Examples

The following example shows the usage of #pragma nosimd to disable -qsimd=auto for a specific for loop:
...
#pragma nosimd
for (i=1; i<1000; i++) {
    /* program code */
}

...

Related information