Contents|Index|Previous|Next

Compiler options for SPARC

When you run gcc, you can use command-line options to choose machine-specific details. For discussions of gcc command-line options, see GNU CC Command Options in Using GNU CC in GNUPro Compiler Tools.

GCC options for architecture and code generation for SPARC and SPARClite

The GNUPro Toolkit supports the machine-dependent options for SPARC in addition to special compiler command-line options available for Fujitsu SPARClite. Both kinds of options are described in SPARC Options in Using GNU CC in GNUPro Compiler Tools.

-g
The compiler debugging option, -g, is essential to see interspersed high-level source statements, since without debugging information the assembler cannot tie most of the generated code to lines of the original source file.

-mvh
-mvh gives you SPARC version 8 code The only difference from version 7 code is that the compiler emits the integer multiply (smul and umul) and integer divide (sdiv and udiv) instructions which exist in SPARC version 8 but not in SPARC version 7.

-mf930
Generate code specifically intended for the SPARC MB86930, a Fujitsu SPARClite chip. This option is equivalent to the combination, -msparclite -mno-fpu. -mf930 is the default when the compiler is configured specifically for Fujitsu SPARClite.

-mf934
Generate code specifically intended for the SPARC MB86934, a Fujitsu SPARClite chip with an FPU.

This option is equivalent to -msparclite.

-mflat
Does not register windows in function calls.

-msparclite
The SPARC configurations of gcc generate code for the common subset of the instruction set: the version 7 variant of the SPARC architecture.

-msparclite (which is on automatically for any of the Fujitsu SPARClite configurations) gives you SPARClite code. This adds the integer multiply (smul and umul, just as in SPARC version 8), the integer divide-step (divscc), and scan (scan) instructions which exist in SPARClite but not in SPARC version 7.

Using -msparclite when you run the compiler does not, however, give you floating point code that uses the entry points for US Softwares GOFAST library.

GCC options for floating point for SPARC and SPARClite

The following command line options are available for both the SPARC and the Fujitsu SPARClite configurations of the compiler. See SPARC Options in Using GNU CC in GNUPro Compiler Tools.

-mfpu

-mhard-float
Generate output containing floating point instructions as the default.

-msoft-float

-mno-sfpu
Generate output containing library calls for floating point. The SPARC configurations of libgcc include a collection of subroutines to implement these library calls.

In particular, the Fujitsu SPARClite configurations generate subroutine calls compatible with the US Software goFast.a floating point library, giving you the opportunity to use either the libgcc implementation or the US Software version.

To use the US Software library, include the appropriate call on the GCC command line.

To use the libgcc version, you need nothing special; GCC links with libgcc automatically after all other object files and libraries.

Floating point subroutines for SPARC and SPARClite

The following two kinds of floating point subroutines are useful with GCC.

- Software implementations of the basic functions
  (floating-point functions for multiply, divide, add, subtract), for use when there is no hardware floating-point support.
When you indicate that no hardware floating point is available (with either of the GCC options, -msoft-float or -mno-fpu), the Fujitsu SPARClite configurations of GCC calls compatible with the US Software GOFAST library. If you do not have this library, you can still use software floating point; libgcc, the auxiliary library distributed with GCC, includes compatible, although slower, subroutines.
- General-purpose mathematical subroutines
  The GNUPro Toolkit from Cygnus Solutions includes an implementation of the standard C mathematical subroutine library. See Mathematical Functions (math.h) in GNUPro Math Library in GNUPro Libraries.