|Using the GNU Compiler Collection (GCC)|
Neither architecture is a subset of the other. However there is a large common subset of instructions supported by both. An MQ register is included in processors supporting the POWER architecture.
You use these options to specify which instructions are available on the processor you are using. The default value of these options is determined when configuring GCC. Specifying the -mcpu=cpu_type overrides the specification of these options. We recommend you use the -mcpu=cpu_type option rather than the options listed above.
The -mpower option allows GCC to generate instructions that are found only in the POWER architecture and to use the MQ register. Specifying -mpower2 implies -power and also allows GCC to generate instructions that are present in the POWER2 architecture but not the original POWER architecture.
The -mpowerpc option allows GCC to generate instructions that are found only in the 32-bit subset of the PowerPC architecture. Specifying -mpowerpc-gpopt implies -mpowerpc and also allows GCC to use the optional PowerPC architecture instructions in the General Purpose group, including floating-point square root. Specifying -mpowerpc-gfxopt implies -mpowerpc and also allows GCC to use the optional PowerPC architecture instructions in the Graphics group, including floating-point select.
The -mmfcrf option allows GCC to generate the move from condition register field instruction implemented on the POWER4 processor and other processors that support the PowerPC V2.01 architecture. The -mpopcntb option allows GCC to generate the popcount and double-precision FP reciprocal estimate instruction implemented on the POWER5 processor and other processors that support the PowerPC V2.02 architecture. The -mpopcntd option allows GCC to generate the popcount instruction implemented on the POWER7 processor and other processors that support the PowerPC V2.06 architecture. The -mfprnd option allows GCC to generate the FP round to integer instructions implemented on the POWER5+ processor and other processors that support the PowerPC V2.03 architecture. The -mcmpb option allows GCC to generate the compare bytes instruction implemented on the POWER6 processor and other processors that support the PowerPC V2.05 architecture. The -mmfpgpr option allows GCC to generate the FP move to/from general-purpose register instructions implemented on the POWER6X processor and other processors that support the extended PowerPC V2.05 architecture. The -mhard-dfp option allows GCC to generate the decimal floating-point instructions implemented on some POWER processors.
The -mpowerpc64 option allows GCC to generate the additional 64-bit instructions that are found in the full PowerPC64 architecture and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to -mno-powerpc64.
If you specify both -mno-power and -mno-powerpc, GCC
will use only the instructions in the common subset of both
architectures plus some special AIX common-mode calls, and will not use
the MQ register. Specifying both -mpower and -mpowerpc
permits GCC to use any instruction from either architecture and to
allow use of the MQ register; specify this for the Motorola MPC601.
GCC defaults to the mnemonics appropriate for the architecture in
use. Specifying -mcpu=cpu_type sometimes overrides the
value of these option. Unless you are building a cross-compiler, you
should normally not specify either -mnew-mnemonics or
-mold-mnemonics, but should instead accept the default.
-mcpu=common selects a completely generic processor. Code generated under this option will run on any POWER or PowerPC processor. GCC will use only the instructions in the common subset of both architectures, and will not use the MQ register. GCC assumes a generic processor model for scheduling purposes.
-mcpu=power, -mcpu=power2, -mcpu=powerpc, and -mcpu=powerpc64 specify generic POWER, POWER2, pure 32-bit PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine types, with an appropriate, generic processor model assumed for scheduling purposes.
The other options specify a specific processor. Code generated under those options will run best on that processor, and may not run at all on others.
The -mcpu options automatically enable or disable the following options:
-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mnew-mnemonics -mpopcntb -mpopcntd -mpower -mpower2 -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx
The particular options set for any particular CPU will vary between compiler versions, depending on what setting seems to produce optimal code for that CPU; it doesn't necessarily reflect the actual hardware's capabilities. If you wish to set an individual option to a particular value, you may specify it after the -mcpu option, like ‘-mcpu=970 -mno-altivec’.
On AIX, the -maltivec and -mpowerpc64 options are
not enabled or disabled by the -mcpu option at present because
AIX does not have full support for these options. You may still
enable or disable them individually if you're sure it'll work in your
The argument yes or single enables the use of single-precision floating-point operations.
The argument double enables the use of single and double-precision floating-point operations.
The argument no disables floating-point operations on the general-purpose registers.
This option is currently only available on the MPC854x.
If you receive a linker error message that saying you have overflowed the available TOC space, you can reduce the amount of TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options. -mno-fp-in-toc prevents GCC from putting floating-point constants in the TOC and -mno-sum-in-toc forces GCC to generate code to calculate the sum of an address and a constant at run time instead of putting that sum into the TOC. You may specify one or both of these options. Each causes GCC to produce very slightly slower and larger code at the expense of conserving TOC space.
If you still run out of space in the TOC even when you specify both of
these options, specify -mminimal-toc instead. This option causes
GCC to make only one TOC entry for every file. When you specify this
option, GCC will produce code that is slower and larger but which
uses extremely little TOC space. You may wish to use this option
only on files that contain less frequently executed code.
longtype, and the infrastructure needed to support them. Specifying -maix64 implies -mpowerpc64 and -mpowerpc, while -maix32 disables the 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
The AIX calling convention was extended but not initially documented to
handle an obscure K&R C case of calling a function that takes the
address of its arguments with fewer arguments than declared. IBM XL
compilers access floating-point arguments that do not fit in the
RSA from the stack when a subroutine is compiled without
optimization. Because always storing floating-point arguments on the
stack is inefficient and rarely needed, this option is not enabled by
default and only is necessary when calling subroutines compiled by IBM
XL compilers without optimization.
On 64-bit Darwin, natural alignment is the default, and -malign-power
is not supported.
For example, by default a structure containing nothing but 8
unsigned bit-fields of length 1 is aligned to a 4-byte
boundary and has a size of 4 bytes. By using -mno-bit-align,
the structure is aligned to a 1-byte boundary and is 1 byte in
.got2and 4-byte locations listed in the
.fixupsection, a table of 32-bit addresses generated by this option. For this to work, all objects linked together must be compiled with -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the stack to an 8-byte boundary.
.fixupsection to allow static executables to be relocated at run time, but -mrelocatable-lib does not use the smaller stack alignment of -mrelocatable. Objects compiled with -mrelocatable-lib may be linked with objects compiled with any combination of the -mrelocatable options.
__eabiis called to from
mainto set up the eabi environment, and the -msdata option can use both
r13to point to two separate small data areas. Selecting -mno-eabi means that the stack is aligned to a 16-byte boundary, do not call an initialization function from
main, and the -msdata option will only use
r13to point to a single small data area. The -meabi option is on by default if you configured GCC using one of the ‘powerpc*-*-eabi*’ options.
constglobal and static data in the ‘.sdata2’ section, which is pointed to by register
r2. Put small initialized non-
constglobal and static data in the ‘.sdata’ section, which is pointed to by register
r13. Put small uninitialized global and static data in the ‘.sbss’ section, which is adjacent to the ‘.sdata’ section. The -msdata=eabi option is incompatible with the -mrelocatable option. The -msdata=eabi option also sets the -memb option.
r13. Put small uninitialized global and static data in the ‘.sbss’ section, which is adjacent to the ‘.sdata’ section. The -msdata=sysv option is incompatible with the -mrelocatable option.
r13to address small data however. This is the default behavior unless other -msdata options are used.
memcpyor structure copies) less than or equal to num bytes. The minimum value for num is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The default value is target-specific.
shortcallfunction attribute, or by
Some linkers are capable of detecting out-of-range calls and generating glue code on the fly. On these systems, long calls are unnecessary and generate slower code. As of this writing, the AIX linker can do this, as can the GNU linker for PowerPC/64. It is planned to add this feature to the GNU linker for 32-bit PowerPC systems as well.
On Darwin/PPC systems,
#pragma longcall will generate “jbsr
callee, L42”, plus a “branch island” (glue code). The two target
addresses represent the callee and the “branch island”. The
Darwin/PPC linker will prefer the first address and generate a “bl
callee” if the PPC “bl” instruction will reach the callee directly;
otherwise, the linker will generate “bl L42” to call the “branch
island”. The “branch island” is appended to the body of the
calling function; it computes the full 32-bit address of the callee
and jumps to it.
On Mach-O (Darwin) systems, this option directs the compiler emit to the glue for every direct call, and the Darwin linker decides whether to use or discard it.
In the future, we may cause GCC to ignore all longcall specifications
when the linker is known to generate glue.
__tls_get_addrwith a relocation specifying the function argument. The relocation allows ld to reliably associate function call with argument setup instructions for TLS optimization, which in turn allows gcc to better schedule the sequence.
!to invert the option:
all: enable all estimate instructions,
default: enable the default instructions, equivalent to -mrecip,
none: disable all estimate instructions, equivalent to -mno-recip;
div: enable the reciprocal approximation instructions for both single and double precision;
divf: enable the single-precision reciprocal approximation instructions;
divd: enable the double-precision reciprocal approximation instructions;
rsqrt: enable the reciprocal square root approximation instructions for both single and double precision;
rsqrtf: enable the single-precision reciprocal square root approximation instructions;
rsqrtd: enable the double-precision reciprocal square root approximation instructions;
So for example, -mrecip=all,!rsqrtd would enable the
all of the reciprocal estimate instructions, except for the
which handle the double-precision reciprocal square root calculations.
mass, which specifies to use IBM's Mathematical Acceleration Subsystem (MASS) libraries for vectorizing intrinsics using external libraries. GCC will currently emit calls to
tanhf4when generating code for power7. Both -ftree-vectorize and -funsafe-math-optimizations have to be enabled. The MASS libraries will have to be specified at link time.
frizinstruction when the -funsafe-math-optimizations option is used to optimize rounding of floating-point values to 64-bit integer and back to floating point. The
frizinstruction does not return the same value if the floating-point number is too large to fit in an integer.