-mcpu
Purpose
Specifies the processor architecture for which the code (instructions) should be generated.
Syntax
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.
- 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.
- power7|pwr7
- Produces object code containing instructions that run on the Power7, Power7+, Power8, Power9, or Power10 hardware platform.
- power8|pwr8
- Produces object code containing instructions that run on the Power8, Power9, or Power10 hardware platform.
- power9|pwr9
- Produces object code containing instructions that run on the Power9 or Power10 hardware platform.
- power10|pwr10
- Produces object code containing instructions that run on the Power10 hardware platform.
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
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