B.2.26 -fsimple[=n]
Allows the optimizer to
make simplifying assumptions concerning floating-point arithmetic.
The compiler defaults to -fsimple=0. Specifying -fsimple, is equivalent to -fsimple=1.
If n is present, it must be 0, 1, or 2.
Table B–8 The
-fsimple Flags
Value
|
Meaning
|
-fsimple=0
|
Permits no simplifying assumptions. Preserve strict IEEE 754 conformance.
|
-fsimple=1
|
Allows conservative simplifications. The resulting code does not strictly
conform to IEEE 754, but numeric results of most programs are unchanged.
With -fsimple=1, the optimizer can assume the following:
-
IEEE 754 default rounding/trapping modes do not change after
process initialization.
-
Computations producing no visible result other than potential
floating point exceptions may be deleted.
-
Computations with Infinity or NaNs as operands need not propagate
NaNs to their results; for example, x*0 may be replaced
by 0.
-
Computations do not depend on sign of zero.
With -fsimple=1, the optimizer is not allowed to
optimize completely without regard to roundoff or exceptions. In particular,
a floating-point computation cannot be replaced by one that produces different
results with rounding modes held constant at runtime.
|
-fsimple=2
|
Includes all the functionality of -fsimple=1 and also
enables use of SIMD instructions to compute reductions when -xvector=simd is in effect.
The compiler attempts aggressive floating point optimizations that may
cause many programs to produce different numeric results due to changes in
rounding. For example, -fsimple=2 permits the optimizer
to replace all computations of x/y in a given loop with x*z, where x/y is guaranteed to be evaluated
at least once in the loop, z=1/y, and the values of y and z are known to have constant values during
execution of the loop.
|
Even with -fsimple=2, the optimizer is not permitted
to introduce a floating point exception in a program that otherwise produces
none.
See Techniques for Optimizing Applications: High Performance
Computing written by Rajat Garg and Ilya Sharapov for a more detailed
explanation of how optimization can impact precision.