Contents|Index|Previous|Next

MIPS Options

The following -m options are defined for the MIPS family of computers.

-mcpu=cpu type
Assume the defaults for the machine type cpu type when scheduling instructions. The choices for cpu type are r2000, r3000, r4000, r4400, r4600, and r6000. While picking a specific cpu type will schedule things appropriately for that particular chip, the compiler will not generate any code that does not meet level 1 of the MIPS ISA (instruction set architecture) without the -mips2 or -mips3 switches being used.

-mips1
Issue instructions from level 1 of the MIPS ISA. This is the default. r3000 is the default cpu type at this ISA level.

-mips2
Issue instructions from level 2 of the MIPS ISA (branch likely, square root instructions). r6000 is the default CPU type at this ISA level.

-mips3
Issue instructions from level 3 of the MIPS ISA (64 bit instructions). r4000 is the default cpu type at this ISA level. This option does not change the sizes of any of the C data types.

-mfp32
Assume that 32 32-bit floating point registers are available. This is the default.

-mfp64
Assume that 32 64-bit floating point registers are available. This is the default when the -mips3 option is used.

-mgp32
Assume that 32 32-bit general purpose registers are available. This is the default.

-mgp64
Assume that 32 64-bit general purpose registers are available. This is the default when the -mips3 option is used.

-mint64
Types long, int, and pointer are 64 bits. This works only if -mips3 is also specified.

-mlong64
Types long and pointer are 64 bits, and type int is 32 bits. This works only if -mips3 is also specified.

-mmips-as
Generate code for the MIPS assembler, and invoke mips-tfile to add normal debug information. This is the default for all platforms except for the OSF/1 reference platform, using the OSF/rose object format. If the either of the -gstabs or -gstabs+ switches are used, the mips-tfile program will encapsulate the stabs within MIPS ECOFF.

-mgas
Generate code for the GNU assembler. This is the default on the OSF/1 reference platform, using the OSF/rose object format.

-mrnames
-mno-rnames
The -mrnames switch says to output code using the MIPS software names for the registers, instead of the hardware names (i.e., a0 instead of $4). The only known assembler that supports this option is the Algorithmics assembler.

-mgpopt
-mno-gpopt
The -mgpopt switch says to write all of the data declarations before the instructions in the text section, this allows the MIPS assembler to generate one word memory references instead of using two words for short global or static data items. This is on by default if optimization is selected.

-mstats
-mno-stats
For each non-inline function processed, the -mstats switch causes the compiler to emit one line to the standard error file to print statistics about the program (number of registers saved, stack size, etc.).

-mmemcpy
-mno-memcpy
The -mmemcpy switch makes all block moves call the appropriate string function (memcpy or bcopy) instead of possibly generating inline code.

-mmips-tfile
-mno-mips-tfile
The -mno-mips-tfile switch causes the compiler not post-process the object file with the mips-tfile program, after the MIPS assembler has generated it to add debug support. If mips-tfile is not run, then no local variables will be available to the debugger. In addition, stage2 and stage3 objects will have the temporary filenames passed to the assembler embedded in the object file, which means the objects will not compare the same. The -mno-mips-tfile switch should only be used when there are bugs in the mips-tfile program that prevents compilation.

-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 machines usual C compiler are used, but this cant be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation.

-mhard-float
Generate output containing floating point instructions. This is the default if you use the unmodified sources.

-mabicalls
-mno-abicalls
Emit (or do not emit) the pseudo operations .abicalls, .cpload, and .cprestore that some System V.4 ports use for position independent code.

-mlong-calls
-mno-long-calls
Do all calls with the JALR instruction, which requires loading up a functions address into a register before the call. You need to use this switch, if you call outside of the current 512 megabyte segment to functions that are not through pointers.

-mhalf-pic
-mno-half-pic
Put pointers to extern references into the data section and load them up, rather than put the references in the text section.

-membedded-pic
-mno-embedded-pic
Generate PIC code suitable for some embedded systems. All calls are made using PC relative address, and all data is addressed using the $gp register. This requires GNU as and GNU ld which do most of the work.

-membedded-data
-mno-embedded-data
Allocate variables to the read-only data section first if possible, then next in the small data section if possible, otherwise in data. This gives slightly slower code than the default, but reduces the amount of RAM required when executing, and thus may be preferred for some embedded systems.

-msingle-float
-mdouble-float
The -msingle-float switch tells gcc to assume that the floating point coprocessor only supports single precision operations, as on the r4650 chip. The -mdouble-float switch permits gcc to use double precision operations. This is the default.

-mmad
-mno-mad
Permit use of the mad, madu and mul instructions, as on the r4650 chip.

-m4650
Turns on -msingle-float, -mmad, and, at least for now, -mcpu=r4650.

-EL
Compile code for the processor in little endian mode. The requisite libraries are assumed to exist.

-EB
Compile code for the processor in big endian mode. The requisite libraries are assumed to exist.

-G num
Put global and static items less than or equal to num bytes into the small data or bss sections instead of the normal data or bss section. This allows the assembler to emit one word memory reference instructions based on the global pointer (gp or $28), instead of the normal two words used. By default, num is 8 when the MIPS assembler is used, and 0 when the GNU assembler is used. The -G num switch is also passed to the assembler and linker. All modules should be compiled with the same -G num value.

-nocpp
Tell the MIPS assembler to not run its preprocessor over user assembler files (with a suffix, .s) when assembling them.