Joseph, On Sat, Jan 06, 2018 at 08:45:33AM +0100, Richard Biener wrote: > On January 5, 2018 10:13:34 PM GMT+01:00, Joseph Myers > <jos...@codesourcery.com> wrote:
> >unrelated. OK to commit? > > OK. > > Richard. > >Index: gcc/match.pd > >=================================================================== > >--- gcc/match.pd (revision 256279) > >+++ gcc/match.pd (working copy) > >+ /* x <= +Inf is the same as x == x, i.e. !isnan(x), but this loses > >+ an "invalid" exception. */ > >+ (if (!flag_trapping_math) > >+ (eq @0 @0)))) > >+ /* x == +Inf and x >= +Inf are always equal to x > DBL_MAX, but > >+ for == this introduces an exception for x a NaN. */ What does "x a NaN" mean? x OP NaN resp. x CMP NaN ? > >+ (if ((code == EQ_EXPR && !(HONOR_NANS (@0) && > >flag_trapping_math)) > >+ || code == GE_EXPR) > > (with { real_maxval (&max, neg, TYPE_MODE (TREE_TYPE (@0))); } > > (if (neg) > > (lt @0 { build_real (TREE_TYPE (@0), max); }) > >@@ -3072,7 +3076,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > > (if (neg) > > (ge @0 { build_real (TREE_TYPE (@0), max); }) > > (le @0 { build_real (TREE_TYPE (@0), max); })))) > >- /* x != +Inf is always equal to !(x > DBL_MAX). */ > >+ /* x != +Inf is always equal to !(x > DBL_MAX), but this > >introduces > >+ an exception for x a NaN so use an unordered comparison. */ Likewise. > >Index: gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-7.x > >=================================================================== > >--- gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-7.x (nonexistent) > >+++ gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-7.x (working copy) > >@@ -0,0 +1,2 @@ > >+lappend additional_flags "-fno-trapping-math" > >+return 0 > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-1.c > >=================================================================== > >--- gcc/testsuite/gcc.dg/torture/inf-compare-1.c (nonexistent) > >+++ gcc/testsuite/gcc.dg/torture/inf-compare-1.c (working copy) > >@@ -0,0 +1,19 @@ > >+/* { dg-do run } */ > >+/* { dg-add-options ieee } */ > >+/* { dg-require-effective-target fenv_exceptions } */ > >+ > >+#include <fenv.h> > >+ > >+extern void abort (void); > >+extern void exit (int); > >+ > >+volatile double x = __builtin_nan (""); > >+volatile int i; > >+ > >+int > >+main (void) > >+{ > >+ i = x > __builtin_inf (); > >+ if (i != 0 || !fetestexcept (FE_INVALID)) > >+ abort (); > >+} Shouldn't run tests return 0 here? Also drop the exit() declaration since it's unused? Same for all new tests in this patch. thanks, > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-2.c > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-3.c > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-4.c > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-5.c > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-6.c > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-7.c > >Index: gcc/testsuite/gcc.dg/torture/inf-compare-8.c