Sun Studio 12 Update 1: 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

-xcache

-xchip

–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.

Object binaries compiled with the-fast option are 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.

The expansion of -fast includes -D_MATHERR_ERRNO_DONTCARE.

To display the expansion of —fast on any platform, run the command CC —dryrun —fast


>CC -dryrun -fast
###     command line files and options (expanded):
### -dryrun -xO5 -xarch=sparcvis2 -xcache=64/32/4:1024/64/4 \
-xchip=ultra3i -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none \
-xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE

See also

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