-qarch

Description

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

In general, the -qarch option allows you to target a specific architecture for the compilation. For any given -qarch setting, the compiler defaults to a specific, matching -qtune setting, which can provide additional performance improvements. The resulting code may not run on other architectures, but it will provide the best performance for the selected architecture. To generate code that can run on more than one architecture, specify a -qarch suboption that supports a group of architectures, such as ppc, or ppc64; doing this will generate code that runs on all supported architectures, all PowerPC architectures, or all 64-bit PowerPC architectures, respectively. When a -qarch suboption is specified with a group argument, you can specify -qtune as either auto, or provide a specific architecture in the group. In the case of -qtune=auto, the compiler will generate code that runs on all architectures in the group specified by the -qarch suboption, but select instruction sequences that have best performance on the architecture of the machine used to compile. Alternatively you can target a specific architecture for tuning performance.

Syntax

Read syntax diagramSkip visual syntax diagram                 .-ppc64grsq-.
>>- -q--arch--=--+-auto------+---------------------------------><
                 +-pwr3------+
                 +-pwr4------+
                 +-pwr5------+
                 +-pwr5x-----+
                 +-ppc-------+
                 +-ppc64v----+
                 +-ppc64-----+
                 +-ppcgr-----+
                 +-ppc64gr---+
                 +-ppc970----+
                 +-rs64b-----+
                 '-rs64c-----'
 

where available options specify broad families of processor architectures or subgroups of those architecture families, described below.

auto
  • This option is implied if -O4 or -O5 is set or implied.
  • Produces object code containing instructions that will run on the hardware platform on which it is compiled.
pwr3
  • Produces object code containing instructions that will run on any POWER3(TM), POWER4(TM), POWER5(TM), POWER5+(TM) or PowerPC 970 hardware platform.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, _ARCH_PPC64GRSQ, and _ARCH_PWR3 macros.
pwr4
  • Produces object code containing instructions that will run on the POWER4, POWER5, POWER5+ or PowerPC 970 hardware platform.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, _ARCH_PPC64GRSQ, _ARCH_PWR3, and _ARCH_PWR4 macros.
pwr5
  • Produces object code containing instructions that will run on the POWER5 or POWER5+ hardware platforms.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, _ARCH_PPC64GRSQ, _ARCH_PWR3, _ARCH_PWR4, and _ARCH_PWR5 macros.
pwr5x
  • Produces object code containing instructions that will run on the POWER5+ hardware platforms.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, _ARCH_PPC64GRSQ, _ARCH_PWR3, _ARCH_PWR4, _ARCH_PWR5 and _ARCH_PWR5X macros.
ppc
  • In 32-bit mode, produces object code containing instructions that will run on any of the 32-bit PowerPC hardware platforms. This suboption will cause the compiler to produce single-precision instructions to be used with single-precision data.
  • Defines the _ARCH_PPC macro.
  • Specifying -qarch=ppc together with -q64 implies -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.
  • Defines the _ARCH_PPC and _ARCH_PPC64 macros.
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.
  • Defines the _ARCH_PPC and _ARCH_PPCGR macros.
ppc64gr
  • Produces code for any 64-bit PowerPC hardware platform that supports optional graphics instructions.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, and _ARCH_PPC64GR macros.
ppc64grsq
  • Produces code for any 64-bit PowerPC hardware platform that supports optional graphics and square root instructions.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, and _ARCH_PPC64GRSQ macros.
ppc64v
  • Generates instructions for generic PowerPC chips with VMX processors, such as the PowerPC 970. Valid in 32-bit or 64-bit mode.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, _ARCH_PPC64GRSQ, _ARCH_PPC64V macros.
ppc970
  • Generates instructions specific to the PowerPC 970 architecture.
  • Defines the _ARCH_PPC, _ARCH_PPC64V, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC970, _ARCH_PWR3, _ARCH_PWR4, _ARCH_PPC64GR, and_ARCH_PPC64GRSQ macros.
rs64b
  • Produces object code that will run on RS64II platforms.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, _ARCH_PPC64GRSQ, and _ARCH_RS64B macros.
rs64c
  • Produces object code that will run on RS64III platforms.
  • Defines the _ARCH_PPC, _ARCH_PPCGR, _ARCH_PPC64, _ARCH_PPC64GR, _ARCH_PPC64GRSQ, and _ARCH_RS64C macros.

Notes

If you want maximum performance on a specific architecture and will not be using the program on other architectures, use the appropriate architecture option.

You can use -qarch=suboption with -qtune=suboption. -qarch=suboption specifies the architecture for which the instructions are to be generated, and -qtune=suboption specifies the target platform for which the code is optimized. If -qarch is specified without -qtune, the compiler uses the default tuning option for the specified architecture, and the listing shows the effective -qtune setting.

Example

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