-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
                 .-ppc64grsq-.   
>>- -q--arch--=--+-auto------+---------------------------------><
                 +-pwr3------+   
                 +-pwr4------+   
                 +-pwr5------+   
                 +-pwr5x-----+   
                 +-pwr6------+   
                 +-pwr6e-----+   
                 +-pwr7------+   
                 +-ppc-------+   
                 +-ppc64v----+   
                 +-ppc64-----+   
                 +-ppcgr-----+   
                 +-ppc64gr---+   
                 +-ppc970----+   
                 +-rs64b-----+   
                 '-rs64c-----'   

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.
pwr3
Produces object code containing instructions that will run on the POWER3™, POWER4™, POWER5™, POWER5+™, POWER6™, POWER7, or PowerPC® 970 hardware platforms.
pwr4
Produces object code containing instructions that will run on the POWER4, POWER5, POWER5+, POWER6, POWER7, or PowerPC 970 hardware platforms.
pwr5
Produces object code containing instructions that will run on the POWER5, POWER5+, POWER6, or POWER7 hardware platforms.
pwr5x
Produces object code containing instructions that will run on the POWER5+, POWER6, or POWER7 hardware platforms.
pwr6
Produces object code containing instructions that will run on the POWER6 or POWER7 hardware platforms running in POWER6 or POWER7 architected mode.
pwr6e
Produces object code containing instructions that will run on the POWER6 hardware platforms running in POWER6 raw mode.
pwr7
Produces object code containing instructions that will run on the POWER7 hardware platforms.
ppc
In 32-bit mode, produces object code containing instructions that will run on any of the 32-bit PowerPC hardware platforms. This suboption causes the compiler to produce single-precision instructions to be used with single-precision data. Specifying -qarch=ppc together with -q64 silently upgrades the architecture setting to -qarch=ppc64grsq.
ppc64
Produces object code that will run on any of the 64-bit PowerPC hardware platforms. This suboption can be selected when compiling in 32-bit mode, but the resulting object code may include instructions that are not recognized or behave differently when run on 32-bit PowerPC platforms.
ppcgr
In 32-bit mode, produces object code for PowerPC processors that support optional graphics instructions. Specifying -qarch=ppcgr together with -q64 silently upgrades the architecture setting to -qarch=ppc64grsq.
ppc64gr
Produces code for any 64-bit PowerPC hardware platform that supports optional graphics instructions.
ppc64grsq
Produces code for any 64-bit PowerPC hardware platform that supports optional graphics and square root instructions.
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.
rs64b
Produces object code that will run on RS64II platforms.
rs64c
Produces object code that will run on RS64III platforms.

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  
rs64b yes yes yes no  
rs64c yes yes yes no  
pwr3 yes yes yes no  
pwr4 yes yes yes no  
pwr5 yes yes yes no  
pwr5x yes yes yes no  
ppc no no no no  
ppc64 no no yes no  
ppc64gr yes no yes no  
ppc64grsq yes yes yes no  
ppc64v yes yes yes VMX  
ppc970 yes yes yes VMX  
pwr6 yes yes yes VMX  
pwr6e yes yes yes VMX  
pwr7 yes yes yes VMX, VSX  
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.

Specifying -q64 changes the effective -qarch setting as follows:
Original -qarch setting Effective setting when -q64 is specified
ppc ppc64grsq
ppcgr ppc64grsq

For a given application program, make sure that you specify the same -qarch setting when you compile each of its source files.

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 a 32-bit PowerPC architecture, enter:
xlc -o testing myprogram.c -q32 -qarch=ppc

Related information