]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Drop -0.0 in frange::set() for !HONOR_SIGNED_ZEROS.
authorAldy Hernandez <aldyh@redhat.com>
Fri, 14 Oct 2022 10:06:56 +0000 (12:06 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Fri, 14 Oct 2022 14:27:40 +0000 (16:27 +0200)
Similar to what we do for NANs when !HONOR_NANS and Inf when
flag_finite_math_only, we can remove -0.0 from the range at creation
time.

We were kinda sorta doing this because there is a bug in
real_isdenormal that is causing flush_denormals_to_zero to saturate
[x, -0.0] to [x, +0.0] when !HONOR_SIGNED_ZEROS.  Fixing this bug
(upcoming), causes us to leave -0.0 in places where we aren't
expecting it (the intersection code).

gcc/ChangeLog:

* value-range.cc (frange::set): Drop -0.0 for !HONOR_SIGNED_ZEROS.

gcc/value-range.cc

index 26a2b782e2cc70aed8f83f4d8805a082cf9cf0c1..86550f158b890f5007a449335a2c6cc795a7e38b 100644 (file)
@@ -324,6 +324,14 @@ frange::set (tree type,
       m_neg_nan = false;
     }
 
+  if (!HONOR_SIGNED_ZEROS (m_type))
+    {
+      if (real_iszero (&m_min, 1))
+       m_min.sign = 0;
+      if (real_iszero (&m_max, 1))
+       m_max.sign = 0;
+    }
+
   // For -ffinite-math-only we can drop ranges outside the
   // representable numbers to min/max for the type.
   if (flag_finite_math_only)