-mcpu

Purpose

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

Syntax

Read syntax diagramSkip visual syntax diagram  -m cpu = pwr7power7nativepowerpcpowerpc64ppcppc64pwr8power8pwr9power9pwr10power10

Defaults

  • -mcpu=pwr7 or -mcpu=power7

Parameters

native
Automatically detects the specific architecture of the compilation machine. It assumes that the execution environment will be the same as or newer than the compilation environment.
powerpc|ppc
In 32-bit mode, produces object code containing instructions that run on any of the 32-bit PowerPC® hardware platforms. The powerpc suboption causes the compiler to produce single-precision instructions to be used with single-precision data. Specifying -mcpu=powerpc together with -m64 silently upgrades the architecture setting to -mcpu=powerpc64.
The ppc suboption is functionally equivalent to the powerpc suboption. powerpc is the preferred suboption.
powerpc64|ppc64
Produces object code that run on any of the 64-bit PowerPC hardware platforms. The powerpc64 suboption can be selected when compiling in 32-bit mode, but the resulting object code might include instructions that are not recognized or behave differently when run on 32-bit PowerPC platforms.
The ppc64 suboption is functionally equivalent to the powerpc suboption. powerpc64 is the preferred suboption.
power7|pwr7
Produces object code containing instructions that run on the Power7, Power7+, Power8, Power9, or Power10 hardware platform.
While pwr7 is retained for compatibility, power7 is the preferred suboption value for portability.
power8|pwr8
Produces object code containing instructions that run on the Power8, Power9, or Power10 hardware platform.
While pwr8 is retained for compatibility, power8 is the preferred suboption value for portability.
power9|pwr9
Produces object code containing instructions that run on the Power9 or Power10 hardware platform.
While pwr9 is retained for compatibility, power9 is the preferred suboption value for portability.
power10|pwr10
Produces object code containing instructions that run on the Power10 hardware platform.
While pwr10 is retained for compatibility, power10 is the preferred suboption value for portability.

Usage

Specify the -mcpu level for the lowest architecture that your program needs to run on. Moving to newer -mcpu settings might improve performance.

For any given -mcpu setting, the compiler has a default -mtune setting that can offer additional performance improvements. For detailed information on using -mcpu and -mtune together, see -mtune.

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

Predefined macros

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

Examples

To specify that the executable program testing compiled from myprogram.c is to run on a computer with VSX instruction support, for example, power8, enter:
ibm-clang -o testing myprogram.c -mcpu=power8

Related information