| Red Hat Documentation |
|
Compiler options for MIPS When you run GCC, you can use command-line options to choose machine-specific details. For information on all the GCC command-line options, see GNU CC command options in Using GNU CC in GNUPro Compiler Tools. There are a great many compiler options for specific MIPS targets. The following documentation discusses some of them. For instance, options for architecture and code generation (described in GCC options for architecture and code generation for MIPS) are for all MIPS targets. See also gcc options for floating point for MIPS and Floating point subroutines.
The compiler options, -mips2, -mips3 and -mips4, cannot be used on the MIPS R3000. The following options for architecture and code generation can be used on all MIPS targets.
-mcpu=cputype
In the general case, use this option on any MIPS platform to assume the defaults for the machine type cputype when scheduling instructions. The default cputype on other MIPS configurations is default, which picks the longest cycle times for any of the machines, in order that the code run at reasonable rates on any MIPS CPU. Other choices for cputype are r2000, r3000, r4000, r6000, r4400, r4600, r4650, r8000, and orion. While picking a specific cputype 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) unless you use the -mips2, -mips3, or mips4 switch.
The following options select
software or hardware floating point.
In particular, this gcc configuration generates subroutine calls compatible with the US Software GOFAST R3000 floating point library, giving you the opportunity to use either the libgcc implementation or the US Software version. IDT includes the GOFAST library in their IDT C 5.0 package; you can also order libraries separately from IDT as the IDT kit of how to use gcc to link with the GOFAST library. To use the ‘libgcc’ version, you need nothing special; gcc links with libgcc automatically after all other object files and libraries. Because the calling convention
for MIPS architectures depends on whether or not hardware floating-point
is installed, ‘-msoft-float’
has one further effect: gcc
looks for sub-routine libraries in a subdirectory, ‘soft-float’,
for any library directory in your search path. (Note: This does
not apply to directories specified using the ‘-l’
option.) With the GNUPro Toolkit, you can select the standard libraries
as usual with the options, ‘-lc’
or ‘-lm’,
because the soft-float versions are installed in the default library search
paths.
Treat ‘-msoft-float’ as an all or nothing proposition. If you compile any program’s module with ‘-msoft-float’, it’s safest to compile all modules of the program that way—and it’s essential to use this option when you link. Generate output containing floating point instructions, and use the corresponding MIPS calling convention. This is the default. -msingle-float
Two kinds of floating point subroutines are useful with gcc.
Floating-point functionality for multiply, divide, add, subtract usage, used when there is no hardware floating-point support. GNUPro Toolkit includes an implementation of the standard C mathematical subroutine library. See Mathematical functions (math.h) in GNUPro Math Library in GNUPro Libraries. |
|
© 2001 Red Hat, Inc. All rights reserved. About Red Hat : Legal statement : Privacy statement : Y2K statement : Contact Red Hat |