Restricting Floating-point Arithmetic Precision
The -mp option restricts some optimizations
to maintain declared precision and to ensure that floating-point arithmetic
conforms more closely to the ANSI and IEEE standards.
For most programs, specifying this option adversely affects performance.
If you are not sure whether your application needs this option, try compiling
and running your program both with and without it to evaluate the effects
on performance versus precision.
Specifying this option has the following effects on program compilation:
- User variables declared as floating-point types are
not assigned to registers.
- Floating-point arithmetic comparisons conform to
IEEE 754 except for NaN behavior.
- The exact operations specified in the code are performed.
For example, division is never changed to multiplication by the reciprocal.
- The compiler performs floating-point operations in
the order specified without reassociation.
- The compiler does not perform the constant folding
on floating-point values. Constant folding also eliminates any multiplication
by 1, division by 1, and addition or subtraction of 0. For example, code
that adds 0.0 to a number is executed exactly as written. Compile-time
floating-point arithmetic is not performed to ensure that floating-point
exceptions are also maintained.
- For IA-32 systems, whenever an expression is spilled,
it is spilled as 80 bits (EXTENDED PRECISION), not 64 bits (DOUBLE PRECISION).
Floating-point operations conform to IEEE 754. When assignments to type
REAL and DOUBLE PRECISION are made, the precision is rounded from 80 bits
(EXTENDED) down to 32 bits (REAL) or 64 bits (DOUBLE PRECISION). When
you do not specify -O0, the extra bits of precision
are not always rounded away before the variable is reused.
- Even if vectorization is enabled by the -xK,
-xW, -axK, or -axW
options, the compiler does not vectorize reduction loops (loops computing
the dot product) and loops with mixed precision types.