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.

<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 />

32035 Rev. 3.22 November 2007<br />

Profile Guided Optimizati<strong>on</strong>. The 32-bit Microsoft compiler allows profile guided optimizati<strong>on</strong>.<br />

Use the following steps <str<strong>on</strong>g>for</str<strong>on</strong>g> profile guided optimizati<strong>on</strong> with 32-bit Microsoft compilers <str<strong>on</strong>g>for</str<strong>on</strong>g> Microsoft<br />

Windows.<br />

1. Compile the program with the /GL switch and link with the /LTCG:PGI switch.<br />

2. Run the executable produced in Step 1. Running this executable generates several files with<br />

profile in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong>.<br />

3. Relink the program with the /LTCG:PGO switch.<br />

The -arch:SSE2 switch allows the compiler to use the SSE2 instructi<strong>on</strong>s, when it determines that it is<br />

faster than x87 <str<strong>on</strong>g>for</str<strong>on</strong>g> scalar, floating-point computati<strong>on</strong>s and will interleave the two as appropriate. As a<br />

result, the code uses a mixture of both x87 and SSE2. Using this switch almost always results in<br />

increased speed.<br />

The compiler emits code that is thread-safe by default. Turning off this default by using<br />

/D_ST_MODEL can result in an additi<strong>on</strong>al per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance improvement.<br />

/OPT:ref,icf. This linker opti<strong>on</strong> removes redundant symbols and unused functi<strong>on</strong>s, resulting in a<br />

smaller binary.<br />

3.13 Sun Studio <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s (32-bit) <str<strong>on</strong>g>for</str<strong>on</strong>g> Solaris<br />

Sun Microsystems provides C, C++, and Fortran compilers <str<strong>on</strong>g>for</str<strong>on</strong>g> the x86 Solaris operating system. The<br />

current versi<strong>on</strong> of each compiler (as of August 2007) is 5.9, and is available in the Sun Studio 12<br />

developer tools suite. All opti<strong>on</strong>s below apply to this versi<strong>on</strong> of the compilers.<br />

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

The following commands invoke specific compilers:<br />

cc invokes the Sun Studio C compiler.<br />

CC invokes the Sun Studio C++ compiler.<br />

f77 invokes the Sun Studio Fortran 77 compiler.<br />

f90 invokes the Sun Studio Fortran 90 compiler.<br />

3.13.2 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> different plat<str<strong>on</strong>g>for</str<strong>on</strong>g>ms. The -fast switch enables a<br />

number of optimizati<strong>on</strong>s that optimize the executi<strong>on</strong> time <strong>on</strong> the compilati<strong>on</strong> plat<str<strong>on</strong>g>for</str<strong>on</strong>g>m. If the program<br />

will be run <strong>on</strong> a different machine, -fast can be combined with -xtarget to optimize <str<strong>on</strong>g>for</str<strong>on</strong>g> a different<br />

plat<str<strong>on</strong>g>for</str<strong>on</strong>g>m. If per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance <strong>on</strong> a wide variety of systems is desired, combine<br />

-xtarget=generic with -fast. If a switch implied by -fast (e.g., -xarch=isa) is overridden, that switch<br />

must follow -fast <strong>on</strong> the command line, or it will be ignored.<br />

38 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 Chapter 3

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

Saved successfully!

Ooh no, something went wrong!