This is the mail archive of the
mailing list for the GCC project.
Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- To: "Gcc at Gcc dot Gnu. Org" <gcc at gcc dot gnu dot org>
- Subject: Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- From: "Vincent Penquerc'h" <vincent at qubesoft dot com>
- Date: Wed, 1 Aug 2001 11:02:30 +0100
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.