-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
                 .-ppc-------.   
>>- -q--arch--=--+-auto------+---------------------------------><
                 +-403-------+   
                 +-604-------+   
                 +-pwr3------+   
                 +-pwr4------+   
                 +-pwr5------+   
                 +-pwr5x-----+   
                 +-pwr6------+   
                 +-pwr6e-----+   
                 +-pwr7------+   
                 +-ppc64v----+   
                 +-ppc64-----+   
                 +-ppcgr-----+   
                 +-ppc64gr---+   
                 +-ppc64grsq-+   
                 +-ppc970----+   
                 +-rs64a-----+   
                 +-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.
403
Produces object code containing instructions that will run on the PowerPC 403 hardware platform.
604
Produces object code containing instructions that will run on the PowerPC 604 hardware platform. This suboption is not valid if -q64 is in effect.
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. 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 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=ppc64.
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=ppc64gr.
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.
rs64a
Produces object code that will run on RS64I platforms.
rs64b
Produces object code that will run on RS64II platforms.
rs64c
Produces object code that will run on RS64III platforms.
Note: The com suboption, and suboptions representing POWER® and POWER2 architectures, are no longer supported. If you would like similar floating-point behavior to that provided by this suboption, use the -qfloat=nosingle:norndsngl option. See -qfloat for details.

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
604 yes no no no no
rs64a no no yes no no
rs64b yes yes yes no no
rs64c yes yes yes no no
pwr3 yes yes yes no no
pwr4 yes yes yes no yes
pwr5 yes yes yes no yes
pwr5x yes yes yes no yes
ppc no no no no yes
ppc64 no no yes no yes
ppc64gr yes no 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
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 ppc64
ppcgr ppc64gr

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

Related information