This is the mail archive of the gcc@gcc.gnu.org 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]

Re: What is acceptable for -ffast-math? (Was: associative law in combine)


Hi,

I'd like to point out that it seems right to me to allow
non-perfect results when using -ffast-math, for the simple
reason that if we get two methods for computing FP operations
and one is faster, there is no point using the slowest (unless
you happen to use -Os and this one is smaller, etc, but this
is special case). Therefore, the very existence of such a
-ffast-math option acknowledges that its results are less
perfect than the default behavior, be it on average error,
domain, etc. This has been mentionned already, but I wanted
to state it clearly.
As long as the differences and gotchas between these two
modes is well documented, I see little reason to dismiss
-ffast-math on the grounds that it is less than perfect
compared to the default behavior.
Moreover, if the drawbacks of some optimizations are too
dangerous (very reduced domain, etc), a solution could be
(yes, I realize there are too many already) to allow the
user to specify how hard one wants the compiler to try and
speed up the code using -ffast-math-<N>, as in -O<N>, or
adding --fmath-allow-domain-shrinking, or -fmath-ignore-nans
or whatever could be used by the programmer to tell the
compiler what is important to him/her and what can be
sacrificed for sped.

-- 
Lyrian 


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