From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: [PATCH] Add global REAL_VALUE_TYPE infinities to real.*.
Date: Thu, 1 Sep 2022 16:13:24 +0200 [thread overview]
Message-ID: <20220901141324.2771267-1-aldyh@redhat.com> (raw)
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 :).
OK pending tests?
gcc/ChangeLog:
* emit-rtl.cc (init_emit_once): Initialize dconstinf and
dconstninf.
* real.h: Add dconstinf and dconstninf.
---
gcc/emit-rtl.cc | 5 +++++
gcc/real.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc
index 3929ee08986..f25fb70ab97 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 ec78e8a8932..2f490ef9b72 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 ())
--
2.37.1
WARNING: multiple messages have this Message-ID
From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] Add global REAL_VALUE_TYPE infinities to real.*.
Date: Thu, 1 Sep 2022 16:13:24 +0200 [thread overview]
Message-ID: <20220901141324.2771267-1-aldyh@redhat.com> (raw)
Message-ID: <20220901141324.ZQundRocgy9nvmQykT31gF42gmPF6BcPfKqBm0itK5w@z> (raw)
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 :).
OK pending tests?
gcc/ChangeLog:
* emit-rtl.cc (init_emit_once): Initialize dconstinf and
dconstninf.
* real.h: Add dconstinf and dconstninf.
---
gcc/emit-rtl.cc | 5 +++++
gcc/real.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc
index 3929ee08986..f25fb70ab97 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 ec78e8a8932..2f490ef9b72 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 ())
--
2.37.1
next reply other threads:[~2022-09-01 14:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 14:13 Aldy Hernandez [this message]
2022-09-01 14:13 ` Aldy Hernandez
2022-09-01 14:32 ` Jeff Law
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=20220901141324.2771267-1-aldyh@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@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).