]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Convert rest of compiler to dconst[n]inf.
authorAldy Hernandez <aldyh@redhat.com>
Thu, 1 Sep 2022 15:00:14 +0000 (17:00 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Fri, 2 Sep 2022 19:35:21 +0000 (21:35 +0200)
gcc/ChangeLog:

* builtins.cc (fold_builtin_inf): Convert use of real_info to dconstinf.
(fold_builtin_fpclassify): Same.
* fold-const-call.cc (fold_const_call_cc): Same.
* match.pd: Same.
* omp-low.cc (omp_reduction_init_op): Same.
* realmpfr.cc (real_from_mpfr): Same.
* tree.cc (build_complex_inf): Same.

gcc/builtins.cc
gcc/fold-const-call.cc
gcc/match.pd
gcc/omp-low.cc
gcc/realmpfr.cc
gcc/tree.cc

index f1f7c0ce33724532f78887158ab2a1075ccb6873..5f319b2803027f64e9fb699a969958cee35013cd 100644 (file)
@@ -8696,8 +8696,6 @@ fold_builtin_strlen (location_t loc, tree expr, tree type, tree arg)
 static tree
 fold_builtin_inf (location_t loc, tree type, int warn)
 {
-  REAL_VALUE_TYPE real;
-
   /* __builtin_inff is intended to be usable to define INFINITY on all
      targets.  If an infinity is not available, INFINITY expands "to a
      positive constant of type float that overflows at translation
@@ -8708,8 +8706,7 @@ fold_builtin_inf (location_t loc, tree type, int warn)
   if (!MODE_HAS_INFINITIES (TYPE_MODE (type)) && warn)
     pedwarn (loc, 0, "target format does not support infinity");
 
-  real_inf (&real);
-  return build_real (type, real);
+  return build_real (type, dconstinf);
 }
 
 /* Fold function call to builtin sincos, sincosf, or sincosl.  Return
@@ -9336,9 +9333,8 @@ fold_builtin_fpclassify (location_t loc, tree *args, int nargs)
 
   if (tree_expr_maybe_infinite_p (arg))
     {
-      real_inf (&r);
       tmp = fold_build2_loc (loc, EQ_EXPR, integer_type_node, arg,
-                        build_real (type, r));
+                        build_real (type, dconstinf));
       res = fold_build3_loc (loc, COND_EXPR, integer_type_node, tmp,
                         fp_infinite, res);
     }
index c18256825af3a09cabdf8af50b2cf9f8953c46f5..72953875414ab79ab41f07e9389849aa9f0adedd 100644 (file)
@@ -1116,7 +1116,7 @@ fold_const_call_cc (real_value *result_real, real_value *result_imag,
     CASE_CFN_CPROJ:
       if (real_isinf (arg_real) || real_isinf (arg_imag))
        {
-         real_inf (result_real);
+         *result_real = dconstinf;
          *result_imag = dconst0;
          result_imag->sign = arg_imag->sign;
        }
index f5fec6342798c47b7efae5b8648f164d3c7d693b..17318f523fb6dfd59fb91e18532246f4b8f1c858 100644 (file)
@@ -5300,7 +5300,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
                 if (cmp == LT_EXPR || cmp == GE_EXPR)
                   tow = dconst0;
                 else
-                  real_inf (&tow);
+                  tow = dconstinf;
                 real_nextafter (&c2alt, fmt, &c2, &tow);
                 real_convert (&c2alt, fmt, &c2alt);
                 if (REAL_VALUE_ISINF (c2alt))
index f54dea923bf99c21b58dcdeb7afbb47bd74a0bac..e9e4bd05d7291011b4bf2cff232278ca6af68d3c 100644 (file)
@@ -4524,12 +4524,9 @@ omp_reduction_init_op (location_t loc, enum tree_code op, tree type)
     case MAX_EXPR:
       if (SCALAR_FLOAT_TYPE_P (type))
        {
-         REAL_VALUE_TYPE max, min;
+         REAL_VALUE_TYPE min;
          if (HONOR_INFINITIES (type))
-           {
-             real_inf (&max);
-             real_arithmetic (&min, NEGATE_EXPR, &max, NULL);
-           }
+           real_arithmetic (&min, NEGATE_EXPR, &dconstinf, NULL);
          else
            real_maxval (&min, 1, TYPE_MODE (type));
          return build_real (type, min);
@@ -4551,7 +4548,7 @@ omp_reduction_init_op (location_t loc, enum tree_code op, tree type)
        {
          REAL_VALUE_TYPE max;
          if (HONOR_INFINITIES (type))
-           real_inf (&max);
+           max = dconstinf;
          else
            real_maxval (&max, 0, TYPE_MODE (type));
          return build_real (type, max);
index 54d097f5965a70d4933270d45682db7c1c9f466b..f7f096330ce954f83e506bd08205b2276b728351 100644 (file)
@@ -68,7 +68,7 @@ real_from_mpfr (REAL_VALUE_TYPE *r, mpfr_srcptr m, const real_format *format,
   /* Take care of Infinity and NaN.  */
   if (mpfr_inf_p (m))
     {
-      real_inf (r);
+      *r = dconstinf;
       if (mpfr_sgn (m) < 0)
        *r = real_value_negate (r);
       return;
index 007c9325b17076f474e6681c49966c59cf6b91c7..0179c0fdc9d3b2d6b312aed0c015290435c86c3f 100644 (file)
@@ -2535,11 +2535,10 @@ build_complex (tree type, tree real, tree imag)
 tree
 build_complex_inf (tree type, bool neg)
 {
-  REAL_VALUE_TYPE rinf, rzero = dconst0;
+  REAL_VALUE_TYPE rzero = dconst0;
 
-  real_inf (&rinf);
   rzero.sign = neg;
-  return build_complex (type, build_real (TREE_TYPE (type), rinf),
+  return build_complex (type, build_real (TREE_TYPE (type), dconstinf),
                        build_real (TREE_TYPE (type), rzero));
 }