Specifications

32 Performance-Centric Compiler Switches Chapter 3
32035 Rev. 3.22 November 2007
Compiler Usage Guidelines for AMD64 Platforms
The -O3 switch turns on several general optimizations.
Using the -ffast-math switch allows the compiler to use a significantly fast floating point model.
The -fomit-frame-pointer causes the frame pointer to be omitted resulting in a performance
improvement. The user should not use this switch if they need to rewind the stack using the frame
pointer.
Using -malign-double will result in better alignment and hence faster code on the AMD Athlon™ 64
and AMD Opteron™ processors.
Using -mfpmath=sse causes the compiler to generate SSE/SSE2 instructions in favor of the default
x87 instructions.
Since the default for the 32-bit gcc compiler is -march=i386, using -march=k8 causes it to generate
high-performance code for the AMD Athlon™ 64 and AMD Opteron™ processors, while using
-march=amdfam10 causes it to generate high-performance code for AMD Family 10h processors.
The GCC 4.2.0 compiler can perform loop vectorization by using the -ftree-vectorize flag.
3.8.4 Other Switches
In addition to the switches mentioned in Table 6, “Recommended Option Switches for 32-Bit GCC
Compilers for Linux
®
,” on page 31 the following list of switches may also improve the performance
of the program. It is worth experimenting with these switches.
Profile Guided Optimization. The 32-bit GCC compiler allows profile guided optimization.
Table 7 shows the profile guided optimization switches for the three GCC compilers.
SuSE GCC 4.2.0
(for C/C++ and Fortran) and
Red Hat gcc-ssa
(for C/C++ and Fortran)
-O3 -march=k8 -ffast-math -fomit-frame-pointer
-malign-double -mfpmath=sse
FSF GCC 4.2.0
Red Hat GCC 3.4.1 -O3 -march=k8 -ffast-math -fomit-frame-pointer
-malign-double -mfpmath=sse -fpeel-loops -ftracer
-funswitch-loops -funit-at-a-time
SuSE GCC 4.2.0 -O3 -march=k8 -ffast-math -fomit-frame-pointer
-malign-double -mfpmath=sse -fpeel-loops
FSF GCC 4.2.0 (for C/C++ and
Fortran)
-O3 -march=k8 -ffast-math -fomit-frame-pointer
-malign-double -mfpmath=sse -fpeel-loops -ftracer
-funswitch-loops -ftree-vectorize
Table 7. Profile Guided Optimization for 32-Bit GCC Compilers for Linux
®
Compiler Version Optimization Switches
Table 6. Recommended Option Switches for 32-Bit GCC Compilers for Linux
®