Contents|Index|Previous|Next

Intel 386 Options

The following ‘-m’ options are defined for Intel’s i386 family of computers.

-m486
-m386
Control whether or not code is optimized for a 486 instead of an 386. Code generated for a 486 will run on a 386 and vice versa.

-mieee-fp
-mno-ieee-fp
Control whether or not the compiler uses IEEE floating point comparisons. These handle correctly the case where the result of a comparison is unordered.

-msoft-float
Generate output containing library calls for floating point.

Warning:
The requisite libraries are not part of GNU CC. Normally the facilities of the machine’s usual C compiler are used, but this can’t be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation. 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
Do not use the FPU registers for return values of functions.
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
Some 387 emulators do not support the sin, cos and sqrt instructions for the 387. Specify this option to avoid generating those instructions. This option is the default on FreeBSD. As of revision 2.6.1, these instructions are not generated unless you also use the -ffast-math switch.

-malign-double
-mno-align-double
Control whether GNU CC aligns 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.

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.

-msvr3-shlib
-mno-svr3-shlib
Control whether GNU CC places uninitialized locals into bss or data.
‘-msvr3-shlib’ places these locals into bss. These options are meaningful only on System V Release 3.

-mno-wide-multiply
-mwide-multiply
Control whether GNU CC uses the mul and imul that produce 64 bit results in eax:edx from 32 bit operands to do long long multiplies and 32-bit division by constants.

-mrtd
Use a different function-calling convention, in which functions that take a fixed number of arguments return with the 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 Declaring Attributes of Functions.

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.)

-mreg-alloc=regs
Control the default allocation order of integer registers. The string regs is a series of letters specifying a register. The supported letters are: a allocate EAX; b allocate EBX; c allocate ECX; d allocate EDX; S allocate ESI; D allocate EDI; B allocate EBP.

-mregparm=num
Control how many registers are used to pass integer arguments. By default, no registers are used to pass arguments, and at most 3 registers can be used. You can control this behavior for a specific function by using the function attribute regparm. See Declaring Attributes of Functions.

Warning:
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.

-malign-loops=num
Align loops to a 2 raised to a num byte boundary. If -malign-loops is not specified, the default is 2.

-malign-jumps=num
Align instructions that are only jumped to a 2 raised to a num byte boundary. If -malign-jumps is not specified, the default is 2 if optimizing for a 386, and 4 if optimizing for a 486.

-malign-functions=num
Align the start of functions to a 2 raised to num byte boundary.
If -malign-jumps is not specified, the default is 2 if optimizing for a 386, and 4 if optimizing for a 486.