Sun WorkShop Compiler C 5.0 User's Guide

-fast

Selects the optimum combination of compilation options for speed. This should provide close to the maximum performance for most realistic applications. Modules compiled with -fast must also be linked with -fast.

The -fast option is unsuitable for programs intended to run on a different target than the compilation machine. In such cases, follow -fast with the appropriate xtarget option. For example:

cc -fast -xtarget=ultra ...

For C modules that depend on exception handling specified by SVID, follow -fast by -xnolibmil:

% cc -fast -xnolibmil

With -xlibmil, exceptions cannot be noted by setting errno or calling matherr(3m).

The -fast option is unsuitable for programs that require strict conformance to the IEEE 754 Standard.

The following table lists the set of options selected by -fast across platforms:

Option 

SPARC 

x86 

-dalign

   X 

  - 

-fns

   X 

  X 

-fsimple=1

   X 

  - 

-ftrap=%none

   X 

  X 

-xlibmil

   X  

  X 

-xtarget=native

   X 

  X 

-nofstore

   - 

  X 

-xO4

   X 

  X 

-fsingle

   X 

  X 

-fast acts like a macro expansion on the command line. Therefore, you can override the optimization level and code generation option aspects by following -fast with the desired optimization level or code generation option. Compiling with the -fast -xO4 pair is like compiling with the -xO2 -xO4 pair. The latter specification takes precedence.

In previous releases, the -fast macro option included -fnonstd; now it includes -fns instead.

You can usually improve performance for most programs with this option.

Do not use this option for programs that depend on IEEE standard exception handling; you can get different numerical results, premature program termination, or unexpected SIGFPE signals.