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]
Other format: [Raw text]

Re: [RFC] Fold floating-point comparisons


This lack of RTL documentation and conflicting beliefs in behaviour
creates real problems.  For example, the C99 standard requires that
isunordered, isgreater, isgreaterequal etc... explicitly don't trap.
However, rtlanal.c's may_trap_p reveals that at the RTL level all of
the corresponding RTL codes (UNORDERED, UNLE, UNLT etc..) are currently
implemented assuming that they do trap.

Are they? Remember that the mode of the comparison is *not* a floating point mode -- you have (unlt:BI x y), not (unlt:DF x y). More interesting is the fact that LTGT is not said to trap.


BTW, isgreater (x, y) is expanded (using c-common.c's expand_unordered_cmp) to NOT_EXPR (UNLE_EXPR (x, y)) exactly to avoid trapping.

Paolo


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