Sun Studio 12: C++ User's Guide

A.2.18.1 Expansions

This option provides near maximum performance for many applications by expanding to the following compilation options.

Table A–5 The -fast Expansion

Option 

SPARC  

x86  

–fns

–fsimple=2

–nofstore

-xarch

-xbuiltin=%all

-xdepend

–xlibmil

–xlibmopt

–xmemalign

–xO5

-xregs=frameptr

–xtarget=native

Interactions

The -fast macro expands into compilation options that may affect other specified options. For example, in the following command, the expansion of the -fast macro includes -xtarget=native which reverts -xarch to one of the 32-bit architecture options.

Incorrect:


example% CC -xarch=v9 -fast test.cc

Correct:


example% CC -fast -xarch=v9 test.cc

See the description for each option to determine possible interactions.

The code generation option, the optimization level, the optimization of built-in functions, and the use of inline template files can be overridden by subsequent options (see examples). The optimization level that you specify overrides a previously set optimization level.

The –fast option includes –fns –ftrap=%none; that is, this option turns off all trapping.

Examples

The following compiler command results in an optimization level of –xO3.


example% CC –fast –xO3

The following compiler command results in an optimization level of –xO5.


example% CC -xO3 –fast

Warnings

If you compile and link in separate steps, the -fast option must appear in both the compile command and the link command.

Code that is compiled with the -fast option is not portable. For example, using the following command on an UltraSPARC III system generates a binary that will not execute on an UltraSPARC II system.


example% CC -fast test.cc

Do not use this option for programs that depend on IEEE standard floating-point arithmetic; different numerical results, premature program termination, or unexpected SIGFPE signals can occur.

In previous SPARC releases, the -fast macro expanded to -fsimple=1. Now it expands to -fsimple=2.

In previous releases, the -fast macro expanded to -xO4. Now it expands to -xO5.


Note –

In previous SPARC releases, the –fast macro option included –fnonstd; now it does not. Nonstandard floating-point mode is not initialized by –fast. See the Numerical Computation Guide, ieee_sun(3M).


See also

-fns, -fsimple, -ftrap=%none, -xlibmil, -nofstore, -xO5, -xlibmopt, -xtarget=native