-qfloat

Category

Floating-point and integer control

Purpose

Selects different strategies for speeding up or improving the accuracy of floating-point calculations.

Syntax

Read syntax diagramSkip visual syntax diagram
                  .-:----------------.   
                  | .-nostrictnmaf-. |   
                  | +-single-------+ |   
                  | +-norsqrt------+ |   
                  | +-norrm--------+ |   
                  | +-rngchk-------+ |   
                  | +-rndsngl------+ |   
                  | +-nonans-------+ |   
                  | +-maf----------+ |   
                  | +-nohssngl-----+ |   
                  | +-nohsflt------+ |   
                  | +-nohscmplx----+ |   
                  | +-fold---------+ |   
                  | +-nofltint-----+ |   
                  V +-nofenv-------+ |   
>>- -q--float--=----+-fenv---------+-+-------------------------><
                    +-fltint-------+     
                    +-nofold-------+     
                    +-hscmplx------+     
                    +-hsflt--------+     
                    +-hssngl-------+     
                    +-nomaf--------+     
                    +-nans---------+     
                    +-norndsngl----+     
                    +-norngchk-----+     
                    +-rrm----------+     
                    +-rsqrt--------+     
                    +-nosingle-----+     
                    '-strictnmaf---'     

@PROCESS:

@PROCESS FLOAT(suboptions)

Defaults

Parameters

fenv | nofenv
Specifies whether the code depends on the hardware environment and whether to suppress optimizations that could cause unexpected results due to this dependency.

Certain floating-point operations rely on the status of Floating-Point Status and Control Register (FPSCR), for example, to control the rounding mode or to detect underflow. In particular, many compiler built-in functions read values directly from the FPSCR.

When nofenv is in effect, the compiler assumes that the program does not depend on the hardware environment, and that aggressive compiler optimizations that change the sequence of floating-point operations are allowed. When fenv is in effect, such optimizations are suppressed.

You should use fenv for any code containing statements that read or set the hardware floating-point environment, to guard against optimizations that could cause unexpected behavior.

fltint | nofltint
Speeds up floating-point-to-integer conversions by using an inline sequence of code instead of a call to a library function. The library function, which is called when nofltint is in effect, checks for floating-point values outside the representable range of integers and returns the minimum or maximum representable integer if passed an out-of-range floating-point value.

The Fortran language does not require checking for floating-point values outside the representable range of integers. In order to improve efficiency, the inline sequence used by -qfloat=fltint does not perform this check. If passed a value that is out of range, the inline sequence will produce undefined results.

If -qarch is set to a processor that has an instruction to convert from floating point to integer, that instruction will be used regardless of the [no]fltint setting. This conversion also applies to all Power® processors in 64-bit mode.

If you compile with the -O3 or higher optimization level, fltint is enabled automatically. To disable it, also specify -qstrict, -qstrict=operationprecision, or -qstrict=exceptions.

fold | nofold
Evaluates constant floating-point expressions at compile time, which may yield slightly different results from evaluating them at run time. The compiler always evaluates constant expressions in specification statements, even if you specify nofold.

The -qfloat=[no]fold option replaces the deprecated -q[no]fold option. Use -qfloat=[no]fold in your new applications.

hscmplx | nohscmplx
Speeds up operations involving complex division and complex absolute value. This suboption, which provides a subset of the optimizations of the hsflt suboption, is preferred for complex calculations.
hsflt | nohsflt
Speeds up calculations by preventing rounding for single-precision expressions and by replacing floating-point division by multiplication with the reciprocal of the divisor. It also uses the same technique as the fltint suboption for floating-point-to-integer conversions. hsflt implies hscmplx.

The hsflt suboption overrides the nans and spnans suboptions.

Note: Use -qfloat=hsflt on applications that perform complex division and floating-point conversions where floating-point calculations have known characteristics. In particular, all floating-point results must be within the defined range of representation of single precision. Use with discretion, as this option may produce unexpected results without warning. For complex computations, it is recommended that you use the hscmplx suboption (described above), which provides equivalent speed-up without the undesirable results of hsflt.
hssngl | nohssngl

Specifies that single-precision expressions are rounded only when the results are stored into memory locations, but not after expression evaluation. Using hssngl can improve runtime performance and is safer than using hsflt.

This option only affects double-precision expressions being assigned to a single-precision, in which a store instruction is generated, when -qfloat=nosingle is in effect. Do not use this option if you are compiling with the default -qfloat=single.

maf | nomaf
Makes floating-point calculations faster and more accurate by using floating-point multiply-add instructions where appropriate. The results may not be exactly equivalent to those from similar calculations performed at compile time or on other types of computers. Negative zero results may be produced. This suboption may affect the precision of floating-point intermediate results. If -qfloat=nomaf is specified, no multiply-add instructions will be generated unless they are required for correctness.

The -qfloat=[no]maf option replaces the deprecated -q[no]maf option. Use -qfloat=[no]maf in your new applications.

nans | nonans
Allows you to use the -qflttrap=invalid:enable option to detect and deal with exception conditions that involve signaling NaN (not-a-number) values. Use this suboption only if your program explicitly creates signaling NaN values, because these values never result from other floating-point operations.

The hsflt option overrides the nans option.

The -qfloat=[no]nans option replaces the deprecated -qfloat=[no]spnans option and the -q[no]spnans option. Use -qfloat=[no]nans in your new applications.

norndsngl | rndsngl
Rounds the result of each single-precision operation to single-precision, rather than waiting until the full expression is evaluated. It sacrifices speed for consistency with results from similar calculations on other types of computers.

This option only affects double-precision expressions cast to single-precision. You can only specify norndsngl when -qfloat=nosingle is in effect.

The hsflt suboption overrides the rndsngl option.

rngchk | norngchk
At optimization level -O3 and above, and without -qstrict, controls whether range checking is performed for input arguments for software divide and inlined square root operations. Specifying norngchk instructs the compiler to skip range checking, allowing for increased performance where division and square root operations are performed repeatedly within a loop.
Note that with norngchk in effect the following restrictions apply:
  • The dividend of a division operation must not be +/-INF.
  • The divisor of a division operation must not be 0.0, +/- INF, or denormalized values.
  • The quotient of dividend and divisor must not be +/-INF.
  • The input for a square root operation must not be INF.
If any of these conditions are not met, incorrect results may be produced. For example, if the divisor for a division operation is 0.0 or a denormalized number (absolute value < 2-1022 for double precision, and absolute value < 2-126 for single precision), NaN, instead of INF, may result; when the divisor is +/- INF, NaN instead of 0.0 may result. If the input is +INF for a sqrt operation, NaN, rather than INF, may result.

norngchk is only allowed when -qnostrict is in effect. If -qstrict, -qstrict=infinities, -qstrict=operationprecision, or -qstrict=exceptions is in effect, norngchk is ignored.

rrm | norrm
Prevents floating-point optimizations that require the rounding mode to be the default, round-to-nearest, at run time, by informing the compiler that the floating-point rounding mode may change or is not round-to-nearest at run time. You should use rrm if your program changes the runtime rounding mode by any means; otherwise, the program may compute incorrect results.

The -qfloat=[no]rrm option replaces the deprecated -q[no]rrm option. Use -qfloat=[no]rrm in your new applications.

rsqrt | norsqrt
Speeds up some calculations by replacing division by the result of a square root with multiplication by the reciprocal of the square root.

If you compile with the -O3 or higher optimization level, rsqrt is enabled automatically. To disable it, also specify -qstrict, -qstrict=nans, -qstrict=infinities, -qstrict=zerosigns, or -qstrict=exceptions.

single | nosingle
Allows single-precision arithmetic instructions to be generated for single-precision floating-point values. All Power processors support single-precision instructions; however, if you want to preserve the behavior of applications compiled for earlier architectures, in which all floating-point arithmetic was performed in double-precision and then truncated to single-precision, you can use -qfloat=nosingle:norndsngl. This suboption provides computation precision results compatible with those provided by the deprecated options -qarch=com|pwr|pwrx|pwr2|p2sc|601|602|603. -qfloat=nosingle can be specified in 32-bit mode only.
strictnmaf | nostrictnmaf
Turns off floating-point transformations that are used to introduce negative MAF instructions, as these transformations do not preserve the sign of a zero value. By default, the compiler enables these types of transformations.

To ensure strict semantics, specify both -qstrict and -qfloat=strictnmaf.

Note: For details about the relationship between -qfloat suboptions and their -qstrict counterparts, see -qstrict.

Usage

Using -qfloat suboptions other than the default settings may produce incorrect results in floating-point computations if not all required conditions for a given suboption are met. For this reason, 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. See also Implementation details of XL Fortran floating-point processing for more information.

If the -qstrict | -qnostrict and float suboptions conflict, the last setting specified is used.

Examples

To compile myprogram.f so that constant floating-point expressions are evaluated at compile time and multiply-add instructions are not generated, enter:
xlf myprogram.f -qfloat=fold:nomaf

Related information