This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Fold floating-point comparisons
- From: Paolo Bonzini <paolo dot bonzini at polimi dot it>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Paolo Bonzini <bonzini at gnu dot org>, gcc-patches at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>
- Date: Fri, 28 May 2004 16:23:33 +0200
- Subject: Re: [RFC] Fold floating-point comparisons
- References: <Pine.LNX.firstname.lastname@example.org>
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