This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: rtlanal.c patch for trapping FP compares
- To: wilson at cygnus dot com (Jim Wilson)
- Subject: Re: rtlanal.c patch for trapping FP compares
- From: Brad Lucier <lucier at math dot purdue dot edu>
- Date: Wed, 13 Dec 2000 14:04:39 -0500 (EST)
- Cc: lucier at math dot purdue dot edu, gcc-patches at gcc dot gnu dot org
> The documentation for -ffast-math says that the compiler can assume that
> no floating-point values are NaNs. Thus we can already assume that compares
> do not trap when -ffast-math is used.
-ffast-math allows, in principle, lots of down-and-dirty tricks to get
fp arithmetic to go faster, here's the description from toplev.c:
/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
operations in the interest of optimization. For example it allows
GCC to assume arguments to sqrt are nonnegative numbers, allowing
faster code for sqrt to be generated. */
Perhaps there should be a flag where gcc does not violate any IEEE or ANSI rules,
so allows infinities, NaNs, gradual underflow, etc., but can assume that
IEEE fp is running without any (visible) traps. E.g., if, internally,
gcc needs a HW trap instruction after sqrt to get sqrt(-1) right, then so be
it, but the flag would say that the user expects a NaN returned,
not a user-visible trap thrown.
Brad