]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Declare dconstm0 to go along with dconst0 and friends.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 12 Apr 2023 12:05:57 +0000 (14:05 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 18 Apr 2023 14:05:37 +0000 (16:05 +0200)
Negating dconst0 is getting pretty old, and we will keep adding copies
of the same idiom.  Fixed by adding a dconstm0 constant to go along
with dconst1, dconstm1, etc.

gcc/ChangeLog:

* emit-rtl.cc (init_emit_once): Initialize dconstm0.
* gimple-range-op.cc (class cfn_signbit): Remove dconstm0
declaration.
* range-op-float.cc (zero_range): Use dconstm0.
(zero_to_inf_range): Same.
* real.h (dconstm0): New.
* value-range.cc (frange::flush_denormals_to_zero): Use dconstm0.
(frange::set_zero): Do not declare dconstm0.

gcc/emit-rtl.cc
gcc/gimple-range-op.cc
gcc/range-op-float.cc
gcc/real.h
gcc/value-range.cc

index a11f72f606b3326ab2672857563ee3cc0bcc5f86..4036f4b64f76911b2e1e5ce5bc082dfd88a73d0a 100644 (file)
@@ -105,6 +105,7 @@ rtx const_true_rtx;
 REAL_VALUE_TYPE dconst0;
 REAL_VALUE_TYPE dconst1;
 REAL_VALUE_TYPE dconst2;
+REAL_VALUE_TYPE dconstm0;
 REAL_VALUE_TYPE dconstm1;
 REAL_VALUE_TYPE dconsthalf;
 REAL_VALUE_TYPE dconstinf;
@@ -6206,6 +6207,9 @@ init_emit_once (void)
   real_from_integer (&dconst1, double_mode, 1, SIGNED);
   real_from_integer (&dconst2, double_mode, 2, SIGNED);
 
+  dconstm0 = dconst0;
+  dconstm0.sign = 1;
+
   dconstm1 = dconst1;
   dconstm1.sign = 1;
 
index 4ca32a7b5d52f8426b09d1446a336650e143b41f..f7409e35a992b7bec3f3ba056338850b50f01906 100644 (file)
@@ -360,8 +360,6 @@ public:
       }
     if (!lhs.contains_p (build_zero_cst (lhs.type ())))
       {
-       REAL_VALUE_TYPE dconstm0 = dconst0;
-       dconstm0.sign = 1;
        r.set (type, frange_val_min (type), dconstm0);
        r.update_nan (true);
        return true;
index e0e91bad44d6d1d7739768ccf662c882ba49b7ea..9d184611ae9257ea6fa60d71792f45c58f26896d 100644 (file)
@@ -2263,7 +2263,7 @@ zero_range (REAL_VALUE_TYPE &lb, REAL_VALUE_TYPE &ub, int signbit_known)
 {
   ub = lb = dconst0;
   if (signbit_known <= 0)
-    lb = real_value_negate (&dconst0);
+    lb = dconstm0;
   if (signbit_known < 0)
     ub = lb;
 }
@@ -2297,7 +2297,7 @@ zero_to_inf_range (REAL_VALUE_TYPE &lb, REAL_VALUE_TYPE &ub, int signbit_known)
   else if (signbit_known < 0)
     {
       lb = dconstninf;
-      ub = real_value_negate (&dconst0);
+      ub = dconstm0;
     }
   else
     {
@@ -2634,7 +2634,7 @@ private:
            if (real_isneg (&lh_lb) == real_isneg (&lh_ub))
              cp[1] = dconst0;
            else
-             cp[1] = real_value_negate (&dconst0);
+             cp[1] = dconstm0;
          }
        else
          cp[1] = cp[0];
index dd41c65d7866371b0bffe792fa86e6cbbe02eb06..9e02139ad6334e059fd2b703bf61123402eb665e 100644 (file)
@@ -468,6 +468,7 @@ extern void real_ldexp (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int);
 extern REAL_VALUE_TYPE dconst0;
 extern REAL_VALUE_TYPE dconst1;
 extern REAL_VALUE_TYPE dconst2;
+extern REAL_VALUE_TYPE dconstm0;
 extern REAL_VALUE_TYPE dconstm1;
 extern REAL_VALUE_TYPE dconsthalf;
 extern REAL_VALUE_TYPE dconstinf;
index 8b5d0cb53e46896ff8c01c3af39f3d19df8b4412..3b3102bc6d071482251512ace7dba81c59f7a830 100644 (file)
@@ -322,9 +322,10 @@ frange::flush_denormals_to_zero ()
   // Flush [x, -DENORMAL] to [x, -0.0].
   if (real_isdenormal (&m_max, mode) && real_isneg (&m_max))
     {
-      m_max = dconst0;
       if (HONOR_SIGNED_ZEROS (m_type))
-       m_max.sign = 1;
+       m_max = dconstm0;
+      else
+       m_max = dconst0;
     }
   // Flush [+DENORMAL, x] to [+0.0, x].
   if (real_isdenormal (&m_min, mode) && !real_isneg (&m_min))
@@ -837,8 +838,6 @@ frange::set_zero (tree type)
 {
   if (HONOR_SIGNED_ZEROS (type))
     {
-      REAL_VALUE_TYPE dconstm0 = dconst0;
-      dconstm0.sign = 1;
       set (type, dconstm0, dconst0);
       clear_nan ();
     }