]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Update selftest such that [-Inf, +Inf] is always VARYING for -ffinite-math-only.
authorAldy Hernandez <aldyh@redhat.com>
Sat, 22 Oct 2022 14:22:50 +0000 (16:22 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Sat, 22 Oct 2022 14:26:05 +0000 (16:26 +0200)
[-Inf, +Inf] +-NAN gets normalized as VARYING.  There is a test that
drops the NAN possibility, and tests that the range is no longer
VARYING but [-Inf, +Inf].  However, for -ffinite-math-only targets
(Vax, RX, etc) the range would still be VARYING because the VARYING
range never had a NAN to begin with.  This fixes the test.

I have a precommit hook that does self-tests with
-fno-finite-math-only, -ffinite-math-only, and -ffast-math as a sanity
check, but my precommit hook last week was disabled because there was
a tree-ssa.exp in mainline failing which was throwing off my scripts.
My apologies.

gcc/ChangeLog:

* value-range.cc (range_tests_floats): Predicate [-Inf, +Inf] test
with !flag_finite_math_only.

gcc/value-range.cc

index bcda4987307c1e8e327df8ab04755eb455e27439..d779e9819e2e4288c4bf617a67203edbc0c3f6f0 100644 (file)
@@ -3960,8 +3960,11 @@ range_tests_floats ()
   if (r0.maybe_isnan ())
     ASSERT_TRUE (r0.varying_p ());
   // ...unless it has some special property...
-  r0.clear_nan ();
-  ASSERT_FALSE (r0.varying_p ());
+  if (!flag_finite_math_only)
+    {
+      r0.clear_nan ();
+      ASSERT_FALSE (r0.varying_p ());
+    }
 
   // For most architectures, where float and double are different
   // sizes, having the same endpoints does not necessarily mean the