This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Perform constant folding of math builtins

>>>>> "Kaveh" == Kaveh R Ghazi <> writes:

 >> From: Gabriel Dos Reis <>
 >> "Kaveh R. Ghazi" <> writes:
 >> | Assuming I remembered everything correctly, these are
 >> mathematical | identities.  But I'm not sure which if any are
 >> valid/invalid in the | presence of NaNs, etc.
 >> Well, I'm not sure we want to restart the discussion about what
 >> -funsafe-transformations should mean, but if we were to consider
 >> all those mentioned transformations (which are valid under
 >> appropriate conditions) I think we ought to clearly state what we
 >> want -funsae-transformation to do.  -- Gaby

 Kaveh> The descriptions of the various fast math flags in invoke.texi
 Kaveh> (including -funsafe-math-optimizations if that's what you
 Kaveh> meant) are all pretty explicit and clear IMHO.

I'm sorry I have to disagree.  -funsafe... mentions two kinds of
optimizations that are turned on: (a) those that assume the arguments
were valid and (b) those that violate IEEE or ANSI standards.

(a) is clear enough, but what on earth does (b) mean?  Interpreted
literally, it would allow all floating point expressions to be
optimized to 0.0.  But clearly that wasn't what was meant.

The next paragraph contains the phrase "programs which depend on an
exact implementation of IEEE ... rules for math functions".  The word
"exact" suggests that (b) is meant to cover ONLY those optimizations
that fail to produce exact IEEE results but will produce results "very
close" to that.

So my guess of what was meant is that turning on this option may
produce answers that are off by one bit or so from the IEEE answers.
But I see nothing at all in the description that supports this wild

If that's indeed what was meant, it would be good to say so.  If
that's not what was meant, it would be REALLY good to say what was
meant instead.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]