Next: i386 and x86-64 Windows Options, Previous: HPPA Options, Up: Submodel Options
These `-m' options are defined for the i386 and x86-64 family of computers:
-mtune=
cpu-typeAs new processors are deployed in the marketplace, the behavior of this option will change. Therefore, if you upgrade to a newer version of GCC, the code generated option will change to reflect the processors that were most common when that version of GCC was released.
There is no -march=generic option because -march
indicates the instruction set the compiler can use, and there is no
generic instruction set applicable to all processors. In contrast,
-mtune indicates the processor (or, in this case, collection of
processors) for which the code is optimized.
generic
, but when used as march
option, PentiumPro
instruction set will be used, so the code will run on all i686 family chips.
While picking a specific cpu-type will schedule things appropriately
for that particular chip, the compiler will not generate any code that
does not run on the i386 without the -march=cpu-type option
being used.
-march=
cpu-type-mcpu=
cpu-type-mfpmath=
unitThis is the default choice for i386 compiler.
For the i386 compiler, you need to use -march=cpu-type, -msse or -msse2 switches to enable SSE extensions and make this option effective. For the x86-64 compiler, these extensions are enabled by default.
The resulting code should be considerably faster in the majority of cases and avoid the numerical instability problems of 387 code, but may break some existing code that expects temporaries to be 80bit.
This is the default choice for the x86-64 compiler.
-masm=
dialect-mieee-fp
-mno-ieee-fp
-msoft-float
On machines where a function returns floating point results in the 80387
register stack, some floating point opcodes may be emitted even if
-msoft-float is used.
-mno-fp-ret-in-387
The usual calling convention has functions return values of types
float
and double
in an FPU register, even if there
is no FPU. The idea is that the operating system should emulate
an FPU.
The option -mno-fp-ret-in-387 causes such values to be returned
in ordinary CPU registers instead.
-mno-fancy-math-387
sin
, cos
and
sqrt
instructions for the 387. Specify this option to avoid
generating those instructions. This option is the default on FreeBSD,
OpenBSD and NetBSD. This option is overridden when -march
indicates that the target cpu will always have an FPU and so the
instruction will not need emulation. As of revision 2.6.1, these
instructions are not generated unless you also use the
-funsafe-math-optimizations switch.
-malign-double
-mno-align-double
double
, long double
, and
long long
variables on a two word boundary or a one word
boundary. Aligning double
variables on a two word boundary will
produce code that runs somewhat faster on a `Pentium' at the
expense of more memory.
On x86-64, -malign-double is enabled by default.
Warning: if you use the -malign-double switch,
structures containing the above types will be aligned differently than
the published application binary interface specifications for the 386
and will not be binary compatible with structures in code compiled
without that switch.
-m96bit-long-double
-m128bit-long-double
long double
type. The i386
application binary interface specifies the size to be 96 bits,
so -m96bit-long-double is the default in 32 bit mode.
Modern architectures (Pentium and newer) would prefer long double
to be aligned to an 8 or 16 byte boundary. In arrays or structures
conforming to the ABI, this would not be possible. So specifying a
-m128bit-long-double will align long double
to a 16 byte boundary by padding the long double
with an additional
32 bit zero.
In the x86-64 compiler, -m128bit-long-double is the default choice as
its ABI specifies that long double
is to be aligned on 16 byte boundary.
Notice that neither of these options enable any extra precision over the x87
standard of 80 bits for a long double
.
Warning: if you override the default value for your target ABI, the
structures and arrays containing long double
variables will change
their size as well as function calling convention for function taking
long double
will be modified. Hence they will not be binary
compatible with arrays or structures in code compiled without that switch.
-mlarge-data-threshold=
number-mrtd
ret
num
instruction, which pops their arguments while returning. This saves one
instruction in the caller since there is no need to pop the arguments
there.
You can specify that an individual function is called with this calling sequence with the function attribute `stdcall'. You can also override the -mrtd option by using the function attribute `cdecl'. See Function Attributes.
Warning: this calling convention is incompatible with the one normally used on Unix, so you cannot use it if you need to call libraries compiled with the Unix compiler.
Also, you must provide function prototypes for all functions that
take variable numbers of arguments (including printf
);
otherwise incorrect code will be generated for calls to those
functions.
In addition, seriously incorrect code will result if you call a
function with too many arguments. (Normally, extra arguments are
harmlessly ignored.)
-mregparm=
numWarning: if you use this switch, and
num is nonzero, then you must build all modules with the same
value, including any libraries. This includes the system libraries and
startup modules.
-msseregparm
Warning: if you use this switch then you must build all
modules with the same value, including any libraries. This includes
the system libraries and startup modules.
-mpc32
-mpc64
-mpc80
Setting the rounding of floating-point operations to less than the default
80 bits can speed some programs by 2% or more. Note that some mathematical
libraries assume that extended precision (80 bit) floating-point operations
are enabled by default; routines in such libraries could suffer significant
loss of accuracy, typically through so-called "catastrophic cancellation",
when this option is used to set the precision to less than extended precision.
-mstackrealign
force_align_arg_pointer
,
applicable to individual functions.
-mpreferred-stack-boundary=
num-mincoming-stack-boundary=
numOn Pentium and PentiumPro, double
and long double
values
should be aligned to an 8 byte boundary (see -malign-double) or
suffer significant run time performance penalties. On Pentium III, the
Streaming SIMD Extension (SSE) data type __m128
may not work
properly if it is not 16 byte aligned.
To ensure proper alignment of this values on the stack, the stack boundary must be as aligned as that required by any value stored on the stack. Further, every function must be generated such that it keeps the stack aligned. Thus calling a function compiled with a higher preferred stack boundary from a function compiled with a lower preferred stack boundary will most likely misalign the stack. It is recommended that libraries that use callbacks always use the default setting.
This extra alignment does consume extra stack space, and generally
increases code size. Code that is sensitive to stack space usage, such
as embedded systems and operating system kernels, may want to reduce the
preferred alignment to -mpreferred-stack-boundary=2.
-mmmx
-mno-mmx
-msse
-mno-sse
-msse2
-mno-sse2
-msse3
-mno-sse3
-mssse3
-mno-ssse3
-msse4.1
-mno-sse4.1
-msse4.2
-mno-sse4.2
-msse4
-mno-sse4
-mavx
-mno-avx
-maes
-mno-aes
-mpclmul
-mno-pclmul
-msse4a
-mno-sse4a
-mfma4
-mno-fma4
-mxop
-mno-xop
-mlwp
-mno-lwp
-m3dnow
-mno-3dnow
-mpopcnt
-mno-popcnt
-mabm
-mno-abm
To have SSE/SSE2 instructions generated automatically from floating-point code (as opposed to 387 instructions), see -mfpmath=sse.
GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed.
These options will enable GCC to use these extended instructions in
generated code, even without -mfpmath=sse. Applications which
perform runtime CPU detection must compile separate files for each
supported architecture, using the appropriate flags. In particular,
the file containing the CPU detection code should be compiled without
these options.
-mfused-madd
-mno-fused-madd
-mcld
cld
instruction in the prologue
of functions that use string instructions. String instructions depend on
the DF flag to select between autoincrement or autodecrement mode. While the
ABI specifies the DF flag to be cleared on function entry, some operating
systems violate this specification by not clearing the DF flag in their
exception dispatchers. The exception handler can be invoked with the DF flag
set which leads to wrong direction mode, when string instructions are used.
This option can be enabled by default on 32-bit x86 targets by configuring
GCC with the --enable-cld configure option. Generation of cld
instructions can be suppressed with the -mno-cld compiler option
in this case.
-mcx16
-msahf
fmod
, drem
or remainder
built-in functions: see Other Builtins for details.
-mmovbe
__builtin_bswap32
and __builtin_bswap64
.
-mcrc32
__builtin_ia32_crc32qi
,
__builtin_ia32_crc32hi
. __builtin_ia32_crc32si
and
__builtin_ia32_crc32di
to generate the crc32 machine instruction.
-mrecip
Note that GCC implements 1.0f/sqrtf(x) in terms of RSQRTSS (or RSQRTPS)
already with -ffast-math (or the above option combination), and
doesn't need -mrecip.
-mveclibabi=
typesvml
for the Intel short
vector math library and acml
for the AMD math core library style
of interfacing. GCC will currently emit calls to vmldExp2
,
vmldLn2
, vmldLog102
, vmldLog102
, vmldPow2
,
vmldTanh2
, vmldTan2
, vmldAtan2
, vmldAtanh2
,
vmldCbrt2
, vmldSinh2
, vmldSin2
, vmldAsinh2
,
vmldAsin2
, vmldCosh2
, vmldCos2
, vmldAcosh2
,
vmldAcos2
, vmlsExp4
, vmlsLn4
, vmlsLog104
,
vmlsLog104
, vmlsPow4
, vmlsTanh4
, vmlsTan4
,
vmlsAtan4
, vmlsAtanh4
, vmlsCbrt4
, vmlsSinh4
,
vmlsSin4
, vmlsAsinh4
, vmlsAsin4
, vmlsCosh4
,
vmlsCos4
, vmlsAcosh4
and vmlsAcos4
for corresponding
function type when -mveclibabi=svml is used and __vrd2_sin
,
__vrd2_cos
, __vrd2_exp
, __vrd2_log
, __vrd2_log2
,
__vrd2_log10
, __vrs4_sinf
, __vrs4_cosf
,
__vrs4_expf
, __vrs4_logf
, __vrs4_log2f
,
__vrs4_log10f
and __vrs4_powf
for corresponding function type
when -mveclibabi=acml is used. Both -ftree-vectorize and
-funsafe-math-optimizations have to be enabled. A SVML or ACML ABI
compatible library will have to be specified at link time.
-mabi=
name-mpush-args
-mno-push-args
-maccumulate-outgoing-args
-mthreads
-mno-align-stringops
-minline-all-stringops
-minline-stringops-dynamically
-mstringop-strategy=
algrep_byte
,
rep_4byte
, rep_8byte
for expanding using i386 rep
prefix
of specified size, byte_loop
, loop
, unrolled_loop
for
expanding inline loop, libcall
for always expanding library call.
-momit-leaf-frame-pointer
-mtls-direct-seg-refs
-mno-tls-direct-seg-refs
%gs
for 32-bit, %fs
for 64-bit),
or whether the thread base pointer must be added. Whether or not this
is legal depends on the operating system, and whether it maps the
segment to cover the entire TLS area.
For systems that use GNU libc, the default is on.
-msse2avx
-mno-sse2avx
These `-m' switches are supported in addition to the above on AMD x86-64 processors in 64-bit environments.
-m32
-m64
-mno-red-zone
-mcmodel=small
-mcmodel=kernel
-mcmodel=medium
-mcmodel=large