Specifications
Chapter 3 Performance-Centric Compiler Switches 23
Compiler Usage Guidelines for AMD64 Platforms
32035 Rev. 3.22 November 2007
In addition to the supplied compilers, the user can also experiment with the latest GCC compilers
(version 3.4, 4.0, and 4.2.0) from the Free Software Foundation (FSF). Users probably cannot expect,
however, the same level of support for FSF GCC compilers as they can expect for supplied compilers.
3.2.2 Invocation Commands
The following commands invoke specific compilers:
· gcc invokes the C compilers for gcc 4.1, 3.4.1, 3.4, 3.3.4 and gcc 3.3.3.
· gcc-ssa invokes the gcc-ssa C compiler.
· gfortran invokes the Fortran 90/95 compiler for gcc 4.1.
· g++ invokes the C++ compilers for gcc 4.1, 3.4.1, 3.4, 3.3.4 and gcc 3.3.3.
· g++-ssa invokes the gcc-ssa C++ compiler.
· g77 invokes the Fortran 77 compiler for gcc 3.4.1, 3.4, 3.3.4 and gcc 3.3.3.
· g77-ssa invokes the gcc-ssa Fortran 77 compiler.
The user may have to specify the full path of the invocation command for using the optional GCC
compilers. For example, the optional SLES8 GCC compiler will be invoked by /opt/gcc33/bin/gcc.
3.2.3 Generic Performance Switches
Different optimization switches are recommended for 64-bit SuSE GCC 3.3.3, Red Hat gcc-ssa, and
the FSF gcc 4.1 compilers. Table 3 shows the recommended switches for these compilers.
The -O3 switch turns on several general optimizations.
Using the -ffast-math switch allows the compiler to use a fast floating point model.
The -funroll-all-loops causes all loops to be unrolled and makes code larger and could bring
improvement in speed.
Some of the options implied by -O3 in SuSE GCC 3.3.3 and the gcc-ssa compilers are not implied by
the GCC 3.4 compiler and should be added for additional performance improvement. These are
-funit-at-a-time, -fpeel-loops, -ftracer, and -funswitch-loops.
Table 3. Recommended Option Switches for 64-Bit GCC Compilers for Linux
®
Compiler Version Recommended Optimization Switches
SuSE GCC 3.3.3
(for C/C++ and Fortran) and
Red Hat gcc-ssa (C/C++ and Fortran)
-O3 -ffast-math -funroll-all-loops
FSF GCC 3.4
(for C/C++ and Fortran) and
Red Hat GCC 3.4.1
-O3 -ffast-math -funroll-all-loops -fpeel-loops -ftracer
-funswitch-loops -funit-at-a-time
SuSE GCC 4.2 -O3 -ffast-math -funroll-all-loops -fpeel-loops
FSF GCC 4.2 (for C/C++ and Fortran) -O3 -ffast-math -funroll-all-loops -ftree-vectorize