8.87 --fpmode=model

Specifies floating-point standard conformance. This controls which floating-point optimizations the compiler can perform, and also influences library selection.

Syntax

--fpmode=model

Where model is one of:

ieee_full

All facilities, operations, and representations guaranteed by the IEEE standard are available in single and double-precision. Modes of operation can be selected dynamically at runtime.

This defines the symbols:

__FP_IEEE
__FP_FENV_EXCEPTIONS
__FP_FENV_ROUNDING
__FP_INEXACT_EXCEPTION
ieee_fixed

IEEE standard with round-to-nearest and no inexact exceptions.

This defines the symbols:

__FP_IEEE
__FP_FENV_EXCEPTIONS
ieee_no_fenv

IEEE standard with round-to-nearest and no exceptions. This mode is stateless and is compatible with the Java floating-point arithmetic model.

This defines the symbol __FP_IEEE.

none

The compiler permits --fpmode=none as an alternative to --fpu=none, indicating that source code is not permitted to use floating-point types of any kind.

std

IEEE finite values with denormals flushed to zero, round-to-nearest, and no exceptions. This is compatible with standard C and C++ and is the default option.

Normal finite values are as predicted by the IEEE standard. However:

  • NaNs and infinities might not be produced in all circumstances defined by the IEEE model. When they are produced, they might not have the same sign.

  • The sign of zero might not be that predicted by the IEEE model.

  • Using NaNs in arithmetic operations with --fpmode=std causes undefined behavior.

fast

Perform more aggressive floating-point optimizations that might cause a small loss of accuracy to provide a significant performance increase. This option defines the symbol __FP_FAST.

This option results in behavior that is not fully compliant with the ISO C or C++ standard. However, numerically robust floating-point programs are expected to behave correctly.

A number of transformations might be performed, including:

  • Double-precision math functions might be converted to single precision equivalents if all floating-point arguments can be exactly represented as single precision values, and the result is immediately converted to a single-precision value.

    This transformation is only performed when the selected library contains the single-precision equivalent functions, for example, when the selected library is armcc or aeabi_glibc.

    For example:

    float f(float a)
    {
        return sqrt(a);
    }
    

    is transformed to

    float f(float a)
    {
        return sqrtf(a);
    }
    
  • Double-precision floating-point expressions that are narrowed to single-precision are evaluated in single-precision when it is beneficial to do so. For example, float y = (float)(x + 1.0) is evaluated as float y = (float)x + 1.0f.

  • Division by a floating-point constant is replaced by multiplication with the inverse. For example, x / 3.0 is evaluated as x * (1.0 / 3.0).

  • It is not guaranteed that the value of errno is compliant with the ISO C or C++ standard after math functions have been called. This enables the compiler to inline the VFP square root instructions in place of calls to sqrt() or sqrtf().

Using a NaN with --fpmode=fast can produce undefined behavior.

Note:

Initialization code might be required to enable the VFP.

Default

The default is --fpmode=std.

Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.