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_mode=<std|fast|full> |
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 -ffp_mode option can be used to indicate the level of floating-point standard conformance. The available arguments to the –ffp-mode option are:
- std - The default, is similar to the armcl default of –fp_mode=strict. ‘std’ tells the tiarmclang compiler to generate code where IEEE finite values with denormals are flushed to zero, rounding mode is round-to-nearest, and no exceptions are thrown.
- fast - This is similar to the armcl –fp_mode=relaxed option.
- full - This option fully implements the IEEE-754 standard for floating-point arithmetic. It supports things like runtime switching of floating point behavior. This variant of the –ffp-mode option is currently an untested feature in the tiarmclang compiler.
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.