public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-2384] Convert rest of compiler to dconst[n]inf.
Date: Fri,  2 Sep 2022 19:36:35 +0000 (GMT)	[thread overview]
Message-ID: <20220902193635.C2BB33858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:bb9d434404b559a11bd2f85f0ce8085c77b8c4c8

commit r13-2384-gbb9d434404b559a11bd2f85f0ce8085c77b8c4c8
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Sep 1 17:00:14 2022 +0200

    Convert rest of compiler to dconst[n]inf.
    
    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.

Diff:
---
 gcc/builtins.cc        | 8 ++------
 gcc/fold-const-call.cc | 2 +-
 gcc/match.pd           | 2 +-
 gcc/omp-low.cc         | 9 +++------
 gcc/realmpfr.cc        | 2 +-
 gcc/tree.cc            | 5 ++---
 6 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index f1f7c0ce337..5f319b28030 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -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);
     }
diff --git a/gcc/fold-const-call.cc b/gcc/fold-const-call.cc
index c18256825af..72953875414 100644
--- a/gcc/fold-const-call.cc
+++ b/gcc/fold-const-call.cc
@@ -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;
 	}
diff --git a/gcc/match.pd b/gcc/match.pd
index f5fec634279..17318f523fb 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -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))
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index f54dea923bf..e9e4bd05d72 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -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);
diff --git a/gcc/realmpfr.cc b/gcc/realmpfr.cc
index 54d097f5965..f7f096330ce 100644
--- a/gcc/realmpfr.cc
+++ b/gcc/realmpfr.cc
@@ -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;
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 007c9325b17..0179c0fdc9d 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -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));
 }

                 reply	other threads:[~2022-09-02 19:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220902193635.C2BB33858D1E@sourceware.org \
    --to=aldyh@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).