float Code Generation Option (AIX)

Syntax: Default:
gen(float, option[, yes])
gen(float, option, no)
gen(float, emulate, no)
gen(float, fltint, no)
gen(float, fold, yes)
gen(float, hsflt, no)
gen(float, hssngl, no)
gen(float, maf, yes)
gen(float, nans, no)
gen(float, rndsngl, no)  See the description below.
gen(float, rrm, no)
gen(float, rsqrt, no)
gen(float, spnans, no)

This option specifies various floating-point options.  These options provide different strategies for speeding up or improving the accuracy of floating-point calculations.   They affect the generated code, but not operations performed in library functions. The following float options can be specified:

emulate
fltint
fold
hsflt
hssngl
maf
nans
rndsngl
rrm
rsqrt
spnans

Each option can be turned on and off independently.  The purpose of each option is described in the table below.

Using the gen(float) options may produce results that are not precisely the same as the default. Incorrect results may be produced if not all required conditions are met.   For these reasons, you should only use this option if you are experienced with floating-point calculations involving IEEE floating-point values and can properly assess the possibility of introducing errors in your program.

You can also specify floating-point options by using #pragma options float=option. The pragma overrides the configuration file option.

emulate Emulates the floating-point instructions omitted by the PowerPC 403 processor. The default is gen(float, emulate, no).

If gen(float, emulate, yes) is set, function calls are emitted in place of PowerPC floating-point instructions. Use this option only in a single-threaded, stand-alone environment targeting the PowerPC 403 processor.

Note: Currently you must also manually link in the /usr/lib/libfpCS.a library to use this option. You can add a source "libfpCS.a" directive to your configuration file.

Do not specify gen(float, emulate, yes) with any of the following options:

  • gen(arch, pwr), gen(arch, pwr2), gen(arch,pwr2s), gen(arch, pwrx), gen(arch,p2sc)
  • gen(longDouble), this is the default
  • defaults(string), where string names any compiler stanza that includes any one of the options listed above, such as defaults(xlC128)
fltint Speeds up floating-point-to-integer conversions by using faster inline code that does not check for overflows.  The default is gen(float, fltint, no), which checks floating-point-to-integer conversions for out-of-range values.

The default depends on the optimization level and strict options.

  • For opt(level, 2), the default is gen(float, fltint, no).
  • For opt(level, 3), the default is gen(float, fltint, yes). To include range checking in floating-point-to-integer conversions with the opt(level, 3) option, specify gen(float, fltint, no).
  • opt(strict, no) sets gen(float, fltint, yes).

Changing the optimization level will not change the setting of the fltint option if gen(float, fltint, yes) has already been specified.

If the opt(strict) and gen(float) options conflict, the last setting is used.

fold Controls whether constant floating-point expressions are to be evaluated at compile time or at run time. The default is gen(float, fold, yes), which enables compile-time evaluation of constant floating-point expressions.
hsflt Specifies that:
  • double precision values are truncated instead of rounded when converted to single precision for storing in a variable
  • conversion from double precision to single precision can occur before expression evaluation
  • either the full double precision value or the truncated single precision value of a variable may be used in subsequent expressions; not all usage need be of the same value
  • floating-point-to-integer conversions are not checked for out-of-range values

The default is gen(float, hsflt, no), which specifies that single-precision expressions are rounded after expression evaluation and floating-point-to-integer conversions are checked for out-of-range values.

Specifying gen(float, hsflt, yes) speeds up calculations, but should be used only for specific applications in which floating-point computations have known characteristics. Using this option when you are compiling other application programs can produce incorrect results without warning.

This suboption overrides the nans, rndsngl, and spnans suboptions.

hssngl Specifies that single-precision expressions are rounded only when the results are stored into float memory locations, and subsequent calculations using values of variables which are still in registers may use their unrounded double-precision values. The default is gen(float, hssngl, no), which specifies that single-precision expressions are rounded after expression evaluation.

Using gen(float, hssngl) can improve run-time performance, but it is safer than using gen(float, hsflt).

maf Controls whether floating-point multiply-add instructions are used where appropriate. The default is gen(float, maf, yes).

Specifying gen(float, maf, yes) makes floating-point calculations faster and, usually, more accurate.  The results may not be exactly equivalent to those from similar calculations performed at compile time or on other types of computers.  This option may affect the precision of floating-point intermediate results.

nans Controls whether extra instructions are generated to detect signaling NaN (Not-a-Number) when converting from single precision to double precision at run time.   The default is gen(float, nans, no), which specifies that this conversion is not detected.  The default also permits more folding of floating-point expressions; for example, the expression "x*1.0" could be folded to "x".

You must specify gen(float, nans, yes) for full compliance to the IEEE 754 standard.

When used with the gen(floatTrap, invalidOption) option, the compiler detects invalid operation exceptions in comparison operations that occur when one of the operands is a signaling NaN. If your program contains signaling NaNs, you should use the gen(floatTrap, invalid) option along with the gen(float, nans) option to trap any exceptions.

The hsflt suboption overrides the nans suboption.

rndsngl Controls whether the result of each single-precision (float) operation is rounded to single precision. When gen(arch) is used to specify any PowerPC architecture, this option is always on.

Specifying gen(float, rndsngl, yes) may sacrifice speed for consistency with results from similar calculations on other types of computers.

The hsflt option overrides the rndsngl option.

rrm Prevents floating-point optimizations that are incompatible with run-time rounding to plus or minus infinity or zero modes.  Informs the compiler that the floating-point rounding mode may change at run time or that the floating-point rounding mode is not round to nearest at run time. The default is gen(float, rrm, no).

You must specify gen(float, rrm) if the Floating Point Status and Control register is changed at run time.

rsqrt Specifies whether a sequence of code that involves division by the result of a square root can be replaced by calculating the reciprocal of the square root and multiplying. Allowing this replacement produces code that runs faster. The default is gen(float, rsqrt, no).

The following notes apply to this option:

  • For opt(level, 2), the default is gen(float, rsqrt, no).
  • For opt(level, 3), the default is gen(float, rsqrt, yes). Specify gen(float, rsqrt, no) to override this default.
  • opt(strict, no) sets gen(float, rsqrt, yes). (Note that this means that errno will not be set for any sqrt function calls.)
  • Specifying gen(float, rsqrt, yes) has no effect when gen(arch, pwr2/pwrx/pwr2s/p2sc) is also specified.
  • Specifying gen(float, rsqrt, yes) has no effect unless opt(ignerrno) is also specified.

Changing the optimization level will not change the setting of the rsqrt option if gen(float, rsqrt, yes) has already been specified.

If the opt(strict) and gen(float) options conflict, the last setting is used.

spnans Controls whether extra instructions are generated to detect signaling NaN on conversion from single precision to double precision. The default is gen(float, spnans, no), which specifies that this conversion need not be detected.

This option is obsolete, and is replaced by the equivalent gen(float, nans) option.



Incremental C++ Build
C Compilation
Configuration Files


Set Build Options
Build


Code Generation Options
Code Generation Options