This is the mail archive of the gcc-patches@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: rtlanal.c patch for trapping FP compares


> 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

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