]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add global REAL_VALUE_TYPE infinities to real.*.
authorAldy Hernandez <aldyh@redhat.com>
Thu, 1 Sep 2022 14:07:18 +0000 (16:07 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Thu, 1 Sep 2022 18:06:19 +0000 (20:06 +0200)
We're starting to abuse the infinity endpoints in the frange code and
the associated range operators.  Building infinities are rather cheap,
and we could even inline them, but I think it's best to just not
recalculate them all the time.

I see about 20 uses of real_inf in the source code, not including the
backends.  And I'm about to add more :).

gcc/ChangeLog:

* emit-rtl.cc (init_emit_once): Initialize dconstinf and
dconstninf.
* real.h: Add dconstinf and dconstninf.

gcc/emit-rtl.cc
gcc/real.h

index 3929ee08986cb9137dada62b0edcc30ed81cc1a4..f25fb70ab974596f2007c48db36bd141bb926d92 100644 (file)
@@ -107,6 +107,8 @@ REAL_VALUE_TYPE dconst1;
 REAL_VALUE_TYPE dconst2;
 REAL_VALUE_TYPE dconstm1;
 REAL_VALUE_TYPE dconsthalf;
+REAL_VALUE_TYPE dconstinf;
+REAL_VALUE_TYPE dconstninf;
 
 /* Record fixed-point constant 0 and 1.  */
 FIXED_VALUE_TYPE fconst0[MAX_FCONST0];
@@ -6210,6 +6212,9 @@ init_emit_once (void)
   dconsthalf = dconst1;
   SET_REAL_EXP (&dconsthalf, REAL_EXP (&dconsthalf) - 1);
 
+  real_inf (&dconstinf);
+  real_inf (&dconstninf, true);
+
   for (i = 0; i < 3; i++)
     {
       const REAL_VALUE_TYPE *const r =
index ec78e8a89324a7f8992b5395924512cbca407c7f..2f490ef9b72d0952372c4d17530a3673fe3e8226 100644 (file)
@@ -462,6 +462,8 @@ extern REAL_VALUE_TYPE dconst1;
 extern REAL_VALUE_TYPE dconst2;
 extern REAL_VALUE_TYPE dconstm1;
 extern REAL_VALUE_TYPE dconsthalf;
+extern REAL_VALUE_TYPE dconstinf;
+extern REAL_VALUE_TYPE dconstninf;
 
 #define dconst_e() (*dconst_e_ptr ())
 #define dconst_third() (*dconst_third_ptr ())