This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Porposal: Floating-Point Options
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> On Tue, 14 Jun 2005, Geoffrey Keating wrote:
>
> > So, what I think you want to do is to add another flag under
> > -ffast-math, perhaps called -fwiden-math, which specifically allows
> > the compiler to compute values in a wider mode (that would be 80-bit
> > x87 FP) even when ISO C doesn't allow it. You would have this flag on
> > by default on x86.
>
> I suggest the name -fno-float-store, since -ffloat-store is the flag meant
> to yield better conformance with the standard requirements for excess
> precision (which only does so for explicit assignments at present).
Although it does do some of this, -ffloat-store also has some rather nasty
side-effects, because of what it is actually documented to do:
> @item -ffloat-store
> @opindex ffloat-store
> Do not store floating point variables in registers, and inhibit other
> options that might change whether a floating point value is taken from a
> register or memory.
For instance, on powerpc, the flag should be a no-op, but
-ffloat-store is certainly not a no-op on powerpc. Likewise, the flag
should be a no-op if SSE2 instructions are being used for arithmetic
(in fact, it should cause that to happen if the instructions are
available).
> Implementation outline: stop x86 back end from claiming to support
> float/double operations when it doesn't; teach C and C++ front ends to
> distinguish two types for an expression, the type used for computation
> (always long double for x87 floating point) and the logical type at the C
> language level; ensure that in conforming mode all conversions from long
> double to double or float are executed properly but in nonconforming mode
> allow them to be discarded; ensure that -ansi / -std=c89 / -std=c99 / ...
> enable -ffloat-store on platforms with excess precision.
I think this is a good implementation outline, except that the flag
setting should not vary depending on the backend. Users should be able
to say "I want FP without widening" or "I want FP and don't mind
widening" portably.