-qarch

Category

Optimization and tuning

Pragma equivalent

None.

Purpose

Specifies the processor architecture for which the code (instructions) should be generated.

Syntax

Read syntax diagramSkip visual syntax diagram
                 .-pwr4------.   
>>- -q--arch--=--+-auto------+---------------------------------><
                 +-pwr5------+   
                 +-pwr5x-----+   
                 +-pwr6------+   
                 +-pwr6e-----+   
                 +-pwr7------+   
                 +-pwr8------+   
                 +-ppc-------+   
                 +-ppc64v----+   
                 +-ppc64-----+   
                 +-ppcgr-----+   
                 +-ppc64gr---+   
                 +-ppc64grsq-+   
                 '-ppc970----'   

Defaults

Parameters

auto
Automatically detects the specific architecture of the compiling machine. It assumes that the execution environment will be the same as the compilation environment. This option is implied if the -O4 or -O5 option is set or implied.
pwr4
Produces object code containing instructions that will run on the POWER4, POWER5, POWER5+, POWER6®, POWER7®, POWER7+™, POWER8™, or PowerPC® 970 hardware platforms.
pwr5
Produces object code containing instructions that will run on the POWER5, POWER5+, POWER6, POWER7, POWER7+, or POWER8 hardware platforms.
pwr5x
Produces object code containing instructions that will run on the POWER5+, POWER6, POWER7, POWER7+, or POWER8 hardware platforms.
pwr6
Produces object code containing instructions that will run on the POWER6, POWER7, POWER7+, or POWER8 hardware platforms running in POWER6, POWER7, POWER7+, or POWER8 architected mode. If you would like support for decimal floating-point instructions, be sure to specify this suboption during compilation.
pwr6e
Produces object code containing instructions that will run on the POWER6 hardware platforms running in POWER6 enhanced mode.
pwr7
Produces object code containing instructions that will run on the POWER7, POWER7+, or POWER8 hardware platforms.
pwr8
Produces object code containing instructions that will run on the POWER8 hardware platforms.
ppc
This suboption is deprecated. Even though it is still accepted, it is silently upgraded to -qarch=pwr4.
ppc64
This suboption is deprecated. Even though it is still accepted, it is silently upgraded to -qarch=pwr4.
ppcgr
This suboption is deprecated. Even though it is still accepted, it is silently upgraded to -qarch=pwr4.
ppc64gr
This suboption is deprecated. Even though it is still accepted, it is silently upgraded to -qarch=pwr4.
ppc64grsq
This suboption is deprecated. Even though it is still accepted, it is silently upgraded to -qarch=pwr4.
ppc64v
Generates instructions for generic PowerPC chips with vector processors, such as the PowerPC 970. Valid in 32-bit or 64-bit mode.
ppc970
Generates instructions specific to the PowerPC 970 architecture.

Usage

All PowerPC machines share a common set of instructions, but may also include additional instructions unique to a given processor or processor family. Using the -qarch option to target a specific architecture for the compilation results in code that may not run on other architectures, but provides the best performance for the selected architecture. If you want maximum performance on a specific architecture and will not be using the program on other architectures, use the appropriate architecture option. If you want to generate code that can run on more than one architecture, specify a -qarch suboption that supports a group of architectures. Table 1 shows the features supported by the different processor architectures and their representative -qarch suboptions:

Table 1. Feature support in processor architectures
Architecture Graphics support Square root support 64-bit support Vector processing support Large page support
pwr4 yes yes yes no yes
pwr5 yes yes yes no yes
pwr5x yes yes yes no yes
ppc yes yes yes no yes
ppc64 yes yes yes no yes
ppc64gr yes yes yes no yes
ppc64grsq yes yes yes no yes
ppc64v yes yes yes VMX yes
ppc970 yes yes yes VMX yes
pwr6 yes yes yes VMX yes
pwr6e yes yes yes VMX yes
pwr7 yes yes yes VMX, VSX yes
pwr8 yes yes yes VMX, VSX yes
Note: Vector Multimedia Extension (VMX) and Vector Scalar Extension (VSX) are processor instructions for vector processing.

For any given -qarch setting, the compiler defaults to a specific, matching -qtune setting, which can provide additional performance improvements. Alternatively, if you specify -qarch with a group argument, you can specify -qtune as either auto or provide a specific architecture in the group. For detailed information on using -qarch and -qtune together, see -qtune.

For a given application program, make sure that you specify the same -qarch setting when you compile each of its source files. Although the linker and loader may detect object files that are compiled with incompatible -qarch settings, you should not rely on it.

Predefined macros

See Macros related to architecture settings for a list of macros that are predefined by -qarch suboptions.

Examples

To specify that the executable program testing compiled from myprogram.c is to run on a computer with VSX instruction support, enter:
xlc -o testing myprogram.c  -qarch=pwr7

Related information