2.6. Managing Floating Point Support

Assuming that a floating-point ABI has been selected with the -mfloat-abi option and, if floating-point hardware is available, it has been made known to the compiler via the -mfpu option, then the following command-line options can be used to further refine the compiler’s assumptions about what floating-point characteristics are enabled.

armcl Option

tiarmclang Option

--float_operations_allowed=<all|none|32|64>

not supported

The armcl compiler supports a --float_operations_allowed option, which allows you to indicate to the compiler the maximum floating-point precision that can be assumed for a floating-point type data object. For example, you can specify ‘--float_operations_allowed=32’, causing the armcl compiler to flag an error if an attempt is made to use a floating-point type whose size is greater than 32-bits.

The tiarmclang compiler does not provide a mechanism to restrict the use of floating-point types by type size. The tiarmclang compiler assumes that all legal floating-point types are supported. This matches the armcl compiler’s default behavior (e.g. --float_operations_allowed=all).

armcl Option

tiarmclang Option

--fp_mode=<relaxed|strict>

-ffp-model=<precise|strict|fast>

-ffast-math -fno-fast-math

-ffp_contract=[on|off]

-frounding-math -fno-rounding-math

-ffp-exception-behavior=<ignore|maytrap|strict>

By default, the armcl compiler supports ‘strict’ conformance to the IEEE-754 floating-point standard, but you can also use the ‘--fp_mode=relaxed’ option to allow the compiler to be more aggressive about using floating-point hardware instructions, allow floating-point arithmetic reassociation, and aggressively convert double-precision floating-point terms in an expression to single-precision when the result type is single-precision.

The tiarmclang compiler provides an ‘-ffp-model’ option that allows you to instruct the compiler to assume a general set of rules for generating code that implements floating-point math. Each of the available arguments to the ‘-ffp-model’ option will effect the settings for other, single-purpose, floating-point options.

The available arguments to the -ffp-model option are:

  • precise - If no ‘-ffp-model’ option is explicitly specified on the tiarmclang command-line, then the compiler will assume the ‘precise’ floating-point model by default.

    ‘-ffp-model=precise’ is the recommended tiarmclang compiler option to be used in place of armcl’s ‘--fp_mode=strict’ option.

    When the ‘precise’ floating-point model is in effect, all optimizations that are not value-safe on floating-point data are disabled. However, if the indicated Arm processor’s floating-point unit (FPU) supports a fused multiply and add (FMA) instruction, then the compiler will assume that any floating-point contraction optimizations are safe (-ffp-contract=on).

  • strict - Specifying ‘strict’ as the argument to the -ffp-model option enables floating-point rounding (-frounding-math) and sets the floating-point exception behavior option to strict (-ffp-exception-behavior=strict). However, floating-point contraction optimizations are disabled (-ffp-contract=off). Also, no ‘fast-math’ optimizations are enabled (-fno-fast-math).

  • fast - Specifying ‘fast’ as the argument to the -ffp_model option will enable all ‘fast math’ optimizations (-ffast-math) and it will enable more aggressive floating-point contraction optimizations (-fp-contract=fast).

    The tiarmclang ‘-ffp-model=fast’ option is the most functionally similar to the armcl ‘--fp_mode=relaxed’ option among the available arguments to the ‘-ffp-model’ option.

For more detailed information about the separate, single purpose floating-point options mentioned here, please see the Floating-Point Arithmetic section of the Optimization Options chapter.

armcl Option

tiarmclang Option

--fp_reassoc

not supported

The tiarmclang compiler does not provide an option that controls whether reassociation is allowed in floating-point operations. Instead, the tiarmclang’s -ffp-mode=std option can be used to disallow reassociation (the default), and tiarmclang’s -ffp-mode=fast option can be used to allow reassociation.