26.11.2012 Views

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

32035 Rev. 3.22 November 2007<br />

<str<strong>on</strong>g>Compiler</str<strong>on</strong>g> <str<strong>on</strong>g>Usage</str<strong>on</strong>g> <str<strong>on</strong>g>Guidelines</str<strong>on</strong>g> <str<strong>on</strong>g>for</str<strong>on</strong>g> AMD<str<strong>on</strong>g>64</str<strong>on</strong>g> Plat<str<strong>on</strong>g>for</str<strong>on</strong>g>ms<br />

In additi<strong>on</strong> to the supplied compilers, the user can also experiment with the latest GCC compilers<br />

(versi<strong>on</strong> 3.4, 4.0, and 4.2.0) from the Free Software Foundati<strong>on</strong> (FSF). Users probably cannot expect,<br />

however, the same level of support <str<strong>on</strong>g>for</str<strong>on</strong>g> FSF GCC compilers as they can expect <str<strong>on</strong>g>for</str<strong>on</strong>g> supplied compilers.<br />

3.2.2 Invocati<strong>on</strong> Commands<br />

The following commands invoke specific compilers:<br />

· gcc invokes the C compilers <str<strong>on</strong>g>for</str<strong>on</strong>g> gcc 4.1, 3.4.1, 3.4, 3.3.4 and gcc 3.3.3.<br />

· gcc-ssa invokes the gcc-ssa C compiler.<br />

· g<str<strong>on</strong>g>for</str<strong>on</strong>g>tran invokes the Fortran 90/95 compiler <str<strong>on</strong>g>for</str<strong>on</strong>g> gcc 4.1.<br />

· g++ invokes the C++ compilers <str<strong>on</strong>g>for</str<strong>on</strong>g> gcc 4.1, 3.4.1, 3.4, 3.3.4 and gcc 3.3.3.<br />

· g++-ssa invokes the gcc-ssa C++ compiler.<br />

· g77 invokes the Fortran 77 compiler <str<strong>on</strong>g>for</str<strong>on</strong>g> gcc 3.4.1, 3.4, 3.3.4 and gcc 3.3.3.<br />

· g77-ssa invokes the gcc-ssa Fortran 77 compiler.<br />

The user may have to specify the full path of the invocati<strong>on</strong> command <str<strong>on</strong>g>for</str<strong>on</strong>g> using the opti<strong>on</strong>al GCC<br />

compilers. For example, the opti<strong>on</strong>al SLES8 GCC compiler will be invoked by /opt/gcc33/bin/gcc.<br />

3.2.3 Generic Per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance Switches<br />

Different optimizati<strong>on</strong> switches are recommended <str<strong>on</strong>g>for</str<strong>on</strong>g> <str<strong>on</strong>g>64</str<strong>on</strong>g>-bit SuSE GCC 3.3.3, Red Hat gcc-ssa, and<br />

the FSF gcc 4.1 compilers. Table 3 shows the recommended switches <str<strong>on</strong>g>for</str<strong>on</strong>g> these compilers.<br />

Table 3. Recommended Opti<strong>on</strong> Switches <str<strong>on</strong>g>for</str<strong>on</strong>g> <str<strong>on</strong>g>64</str<strong>on</strong>g>-<str<strong>on</strong>g>Bit</str<strong>on</strong>g> GCC <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux ®<br />

<str<strong>on</strong>g>Compiler</str<strong>on</strong>g> Versi<strong>on</strong> Recommended Optimizati<strong>on</strong> Switches<br />

SuSE GCC 3.3.3<br />

-O3 -ffast-math -funroll-all-loops<br />

(<str<strong>on</strong>g>for</str<strong>on</strong>g> C/C++ and Fortran) and<br />

Red Hat gcc-ssa (C/C++ and Fortran)<br />

FSF GCC 3.4<br />

(<str<strong>on</strong>g>for</str<strong>on</strong>g> C/C++ and Fortran) and<br />

Red Hat GCC 3.4.1<br />

The -O3 switch turns <strong>on</strong> several general optimizati<strong>on</strong>s.<br />

-O3 -ffast-math -funroll-all-loops -fpeel-loops -ftracer<br />

-funswitch-loops -funit-at-a-time<br />

SuSE GCC 4.2 -O3 -ffast-math -funroll-all-loops -fpeel-loops<br />

FSF GCC 4.2 (<str<strong>on</strong>g>for</str<strong>on</strong>g> C/C++ and Fortran) -O3 -ffast-math -funroll-all-loops -ftree-vectorize<br />

Using the -ffast-math switch allows the compiler to use a fast floating point model.<br />

The -funroll-all-loops causes all loops to be unrolled and makes code larger and could bring<br />

improvement in speed.<br />

Some of the opti<strong>on</strong>s implied by -O3 in SuSE GCC 3.3.3 and the gcc-ssa compilers are not implied by<br />

the GCC 3.4 compiler and should be added <str<strong>on</strong>g>for</str<strong>on</strong>g> additi<strong>on</strong>al per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance improvement. These are<br />

-funit-at-a-time, -fpeel-loops, -ftracer, and -funswitch-loops.<br />

Chapter 3 Per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance-Centric <str<strong>on</strong>g>Compiler</str<strong>on</strong>g> Switches 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!