The folding of comparisons against Inf (to constants or comparisons with the maximum finite value) has various cases where it introduces or loses "invalid" exceptions for comparisons with NaNs. Folding x > +Inf to 0 should not be about HONOR_SNANS - ordered comparisons of both quiet and signaling NaNs should raise invalid. x <= +Inf is not the same as x == x, because again that loses an exception (equality comparisons don't raise exceptions except for signaling NaNs). x == +Inf is not the same as x > DBL_MAX, and a similar issue applies with the x != +Inf case - that transformation causes a spurious exception. This patch fixes the conditionals on the folding to avoid such introducing or losing exceptions. Bootstrapped with no regressions on x86_64-pc-linux-gnu (where the cases involving spurious exceptions wouldn't have failed anyway before GCC 8 because of unordered comparisons wrongly always having formerly been used by the back end). Also tested for powerpc-linux-gnu soft-float that this fixes many glibc math/ test failures that arose in that configuration because this folding affected the IBM long double support in libgcc (no such failures appeared for hard-float because of the bug of powerpc hard-float always using unordered comparisons) - some failures remain, but I believe them to be unrelated. PR tree-optimization/64811 gcc: * match.pd: When optimizing comparisons with Inf, avoid introducing or losing exceptions from comparisons with NaN. gcc/testsuite: * gcc.dg/torture/inf-compare-1.c, gcc.dg/torture/inf-compare-2.c, gcc.dg/torture/inf-compare-3.c, gcc.dg/torture/inf-compare-4.c, gcc.dg/torture/inf-compare-5.c, gcc.dg/torture/inf-compare-6.c, gcc.dg/torture/inf-compare-7.c, gcc.dg/torture/inf-compare-8.c: New tests. * gcc.c-torture/execute/ieee/fp-cmp-7.x: New file. From-SVN: r256380
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
ada | Loading commit data... | |
brig.dg | Loading commit data... | |
c-c++-common | Loading commit data... | |
config | Loading commit data... | |
g++.dg | Loading commit data... | |
g++.old-deja | Loading commit data... | |
gcc.c-torture | Loading commit data... | |
gcc.dg | Loading commit data... | |
gcc.misc-tests | Loading commit data... | |
gcc.target | Loading commit data... | |
gcc.test-framework | Loading commit data... | |
gfortran.dg | Loading commit data... | |
gfortran.fortran-torture | Loading commit data... | |
gnat.dg | Loading commit data... | |
go.dg | Loading commit data... | |
go.go-torture/execute | Loading commit data... | |
go.test | Loading commit data... | |
jit.dg | Loading commit data... | |
lib | Loading commit data... | |
obj-c++.dg | Loading commit data... | |
objc | Loading commit data... | |
objc-obj-c++-shared | Loading commit data... | |
objc.dg | Loading commit data... | |
selftests | Loading commit data... | |
.gitattributes | Loading commit data... | |
ChangeLog | Loading commit data... | |
ChangeLog-1993-2007 | Loading commit data... | |
ChangeLog-2008 | Loading commit data... | |
ChangeLog-2009 | Loading commit data... | |
ChangeLog-2010 | Loading commit data... | |
ChangeLog-2011 | Loading commit data... | |
ChangeLog-2012 | Loading commit data... | |
ChangeLog-2013 | Loading commit data... | |
ChangeLog-2014 | Loading commit data... | |
ChangeLog-2015 | Loading commit data... | |
ChangeLog-2016 | Loading commit data... | |
ChangeLog-2017 | Loading commit data... | |
ChangeLog.graphite | Loading commit data... | |
ChangeLog.jit | Loading commit data... | |
ChangeLog.ptr | Loading commit data... | |
ChangeLog.tree-ssa | Loading commit data... | |
README | Loading commit data... | |
README.compat | Loading commit data... | |
README.gcc | Loading commit data... |