From: Aldy Hernandez Date: Thu, 1 Sep 2022 14:07:18 +0000 (+0200) Subject: Add global REAL_VALUE_TYPE infinities to real.*. X-Git-Tag: basepoints/gcc-14~4862 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5924b6b2e75afa95f09f75ad3ef9ccbeac65d55d;p=thirdparty%2Fgcc.git Add global REAL_VALUE_TYPE infinities to real.*. 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. --- diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc index 3929ee08986c..f25fb70ab974 100644 --- a/gcc/emit-rtl.cc +++ b/gcc/emit-rtl.cc @@ -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 = diff --git a/gcc/real.h b/gcc/real.h index ec78e8a89324..2f490ef9b72d 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -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 ())