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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

32035 Rev. 3.22 November 2007<br />

3.7 Sun <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s (<str<strong>on</strong>g>64</str<strong>on</strong>g>-bit) <str<strong>on</strong>g>for</str<strong>on</strong>g> Solaris<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 />

Sun provides C, C++, and Fortran compilers <str<strong>on</strong>g>for</str<strong>on</strong>g> AMD<str<strong>on</strong>g>64</str<strong>on</strong>g> architecture-based systems running the<br />

Solaris operating system. The current versi<strong>on</strong> (as of August, 2007) is versi<strong>on</strong> 5.9 available in the Sun<br />

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

3.7.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.7.2 Generic Per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance Switches<br />

Use the following switches to enable generati<strong>on</strong> of <str<strong>on</strong>g>64</str<strong>on</strong>g>-bit binaries, -xarch=sse3a -m<str<strong>on</strong>g>64</str<strong>on</strong>g>, which<br />

includes prefetch to help tune better <str<strong>on</strong>g>for</str<strong>on</strong>g> the AMD instructi<strong>on</strong> set architecture; -m<str<strong>on</strong>g>64</str<strong>on</strong>g>, which is the<br />

same as<br />

-xarch=generic<str<strong>on</strong>g>64</str<strong>on</strong>g> (which we otherwise recommend because it helps <str<strong>on</strong>g>for</str<strong>on</strong>g> SPARC as well as Xe<strong>on</strong> and<br />

Opter<strong>on</strong> processors) produces binaries meant to run <strong>on</strong> both ISA, Xe<strong>on</strong>s and AMD processors.<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 />

is 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 plat<str<strong>on</strong>g>for</str<strong>on</strong>g>m.<br />

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. For AMD Family 10h, we recommend<br />

using -xtarget=barcel<strong>on</strong>a to take better advantage of AMD Family 10h ISA. Note that patch01 <str<strong>on</strong>g>for</str<strong>on</strong>g><br />

Sun Studio 12 must be installed be<str<strong>on</strong>g>for</str<strong>on</strong>g>e <strong>on</strong>e can use this switch.<br />

3.7.3 Other Switches<br />

In additi<strong>on</strong> to the generic switches, the following switches may improve the per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance of the<br />

program. It is worth experimenting with these switches.<br />

Use the -xO[1|2|3|4|5] switch to enable various levels of general optimizati<strong>on</strong> algorithms. Usually<br />

using a higher number results in faster executi<strong>on</strong>, but in some cases -xO2 or -xO3 is faster than<br />

-xO4 or -xO5.<br />

Note: The -fast switch implies the -xO5 switch.<br />

The -xprofile=collect:[name] and -xprofile=use:[name] flags enable profile-guided optimizati<strong>on</strong>.<br />

The flags must be specified both when compiling and linking. After compiling with the<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 29

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

Saved successfully!

Ooh no, something went wrong!