From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH] rtl: constm64_rtx..const64_rtx
Date: Tue, 1 Jun 2021 19:32:15 +0000 [thread overview]
Message-ID: <eddbfc3dee2bc59de17609dc849c4a3fd7cd6a84.1622575820.git.segher@kernel.crashing.org> (raw)
Since times immemorial there has been const_int_rtx for all values from
-64 to 64, but only constm1_rtx..const2_rtx have been available for
convenient use. Change this, so that we can use all values in
{-64,...,64} in RTL easily. This matters, because then we we just say
if (XEXP (x, 1) == const16_rtx)
and things like that, since all const_int in that range are unique. We
already do for -1, 0, 1, 2, but we could for everything.
2021-06-01 Segher Boessenkool <segher@kernel.crashing.org>
* rtl.h (constm64_rtx, ..., constm2_rtx): New.
(const3_rtx, ..., const64_rtx): New.
doc/
* rtl.texi (Constants): Document the new names.
---
Tested on powerpc64-linux {-m32,-m64}, but this of course doesn't mean
all that much until any of the new names are actually used.
Is this okay for trunk?
Segher
gcc/doc/rtl.texi | 20 +++++----
gcc/rtl.h | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 137 insertions(+), 10 deletions(-)
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 5af71137a878..5dbfb6028095 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -1658,19 +1658,21 @@ copies of the top bit. Note however that values are neither
inherently signed nor inherently unsigned; where necessary, signedness
is determined by the rtl operation instead.
+@findex constm64_rtx
+@findex constm1_rtx
@findex const0_rtx
@findex const1_rtx
@findex const2_rtx
-@findex constm1_rtx
-There is only one expression object for the integer value zero; it is
+@findex const64_rtx
+There is only one expression object for the integer value zero: it is
the value of the variable @code{const0_rtx}. Likewise, the only
-expression for integer value one is found in @code{const1_rtx}, the only
-expression for integer value two is found in @code{const2_rtx}, and the
-only expression for integer value negative one is found in
-@code{constm1_rtx}. Any attempt to create an expression of code
-@code{const_int} and value zero, one, two or negative one will return
-@code{const0_rtx}, @code{const1_rtx}, @code{const2_rtx} or
-@code{constm1_rtx} as appropriate.
+expression for integer value one is found in @code{const1_rtx}, and more
+generally, the only expression for integer value @var{N} is found in
+@code{const@var{N}_rtx}, and the only expression for integer value negative
+@var{N} is found in @code{constm@var{N}_rtx}, both for any @var{N} from 1 up
+to 64 inclusive. Any attempt to create an expression of code
+@code{const_int} and value in that range will return @code{const0_rtx},
+@code{const1_rtx}, and so on, as appropriate.
@findex const_true_rtx
Similarly, there is only one object for the integer whose value is
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 35178b5bfaca..5429b7a3f4ac 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3768,10 +3768,135 @@ extern unsigned int split_all_insns_noflow (void);
#define MAX_SAVED_CONST_INT 64
extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
+#define constm64_rtx (const_int_rtx[MAX_SAVED_CONST_INT-64])
+#define constm63_rtx (const_int_rtx[MAX_SAVED_CONST_INT-63])
+#define constm62_rtx (const_int_rtx[MAX_SAVED_CONST_INT-62])
+#define constm61_rtx (const_int_rtx[MAX_SAVED_CONST_INT-61])
+#define constm60_rtx (const_int_rtx[MAX_SAVED_CONST_INT-60])
+#define constm59_rtx (const_int_rtx[MAX_SAVED_CONST_INT-59])
+#define constm58_rtx (const_int_rtx[MAX_SAVED_CONST_INT-58])
+#define constm57_rtx (const_int_rtx[MAX_SAVED_CONST_INT-57])
+#define constm56_rtx (const_int_rtx[MAX_SAVED_CONST_INT-56])
+#define constm55_rtx (const_int_rtx[MAX_SAVED_CONST_INT-55])
+#define constm54_rtx (const_int_rtx[MAX_SAVED_CONST_INT-54])
+#define constm53_rtx (const_int_rtx[MAX_SAVED_CONST_INT-53])
+#define constm52_rtx (const_int_rtx[MAX_SAVED_CONST_INT-52])
+#define constm51_rtx (const_int_rtx[MAX_SAVED_CONST_INT-51])
+#define constm50_rtx (const_int_rtx[MAX_SAVED_CONST_INT-50])
+#define constm49_rtx (const_int_rtx[MAX_SAVED_CONST_INT-49])
+#define constm48_rtx (const_int_rtx[MAX_SAVED_CONST_INT-48])
+#define constm47_rtx (const_int_rtx[MAX_SAVED_CONST_INT-47])
+#define constm46_rtx (const_int_rtx[MAX_SAVED_CONST_INT-46])
+#define constm45_rtx (const_int_rtx[MAX_SAVED_CONST_INT-45])
+#define constm44_rtx (const_int_rtx[MAX_SAVED_CONST_INT-44])
+#define constm43_rtx (const_int_rtx[MAX_SAVED_CONST_INT-43])
+#define constm42_rtx (const_int_rtx[MAX_SAVED_CONST_INT-42])
+#define constm41_rtx (const_int_rtx[MAX_SAVED_CONST_INT-41])
+#define constm40_rtx (const_int_rtx[MAX_SAVED_CONST_INT-40])
+#define constm39_rtx (const_int_rtx[MAX_SAVED_CONST_INT-39])
+#define constm38_rtx (const_int_rtx[MAX_SAVED_CONST_INT-38])
+#define constm37_rtx (const_int_rtx[MAX_SAVED_CONST_INT-37])
+#define constm36_rtx (const_int_rtx[MAX_SAVED_CONST_INT-36])
+#define constm35_rtx (const_int_rtx[MAX_SAVED_CONST_INT-35])
+#define constm34_rtx (const_int_rtx[MAX_SAVED_CONST_INT-34])
+#define constm33_rtx (const_int_rtx[MAX_SAVED_CONST_INT-33])
+#define constm32_rtx (const_int_rtx[MAX_SAVED_CONST_INT-32])
+#define constm31_rtx (const_int_rtx[MAX_SAVED_CONST_INT-31])
+#define constm30_rtx (const_int_rtx[MAX_SAVED_CONST_INT-30])
+#define constm29_rtx (const_int_rtx[MAX_SAVED_CONST_INT-29])
+#define constm28_rtx (const_int_rtx[MAX_SAVED_CONST_INT-28])
+#define constm27_rtx (const_int_rtx[MAX_SAVED_CONST_INT-27])
+#define constm26_rtx (const_int_rtx[MAX_SAVED_CONST_INT-26])
+#define constm25_rtx (const_int_rtx[MAX_SAVED_CONST_INT-25])
+#define constm24_rtx (const_int_rtx[MAX_SAVED_CONST_INT-24])
+#define constm23_rtx (const_int_rtx[MAX_SAVED_CONST_INT-23])
+#define constm22_rtx (const_int_rtx[MAX_SAVED_CONST_INT-22])
+#define constm21_rtx (const_int_rtx[MAX_SAVED_CONST_INT-21])
+#define constm20_rtx (const_int_rtx[MAX_SAVED_CONST_INT-20])
+#define constm19_rtx (const_int_rtx[MAX_SAVED_CONST_INT-19])
+#define constm18_rtx (const_int_rtx[MAX_SAVED_CONST_INT-18])
+#define constm17_rtx (const_int_rtx[MAX_SAVED_CONST_INT-17])
+#define constm16_rtx (const_int_rtx[MAX_SAVED_CONST_INT-16])
+#define constm15_rtx (const_int_rtx[MAX_SAVED_CONST_INT-15])
+#define constm14_rtx (const_int_rtx[MAX_SAVED_CONST_INT-14])
+#define constm13_rtx (const_int_rtx[MAX_SAVED_CONST_INT-13])
+#define constm12_rtx (const_int_rtx[MAX_SAVED_CONST_INT-12])
+#define constm11_rtx (const_int_rtx[MAX_SAVED_CONST_INT-11])
+#define constm10_rtx (const_int_rtx[MAX_SAVED_CONST_INT-10])
+#define constm9_rtx (const_int_rtx[MAX_SAVED_CONST_INT-9])
+#define constm8_rtx (const_int_rtx[MAX_SAVED_CONST_INT-8])
+#define constm7_rtx (const_int_rtx[MAX_SAVED_CONST_INT-7])
+#define constm6_rtx (const_int_rtx[MAX_SAVED_CONST_INT-6])
+#define constm5_rtx (const_int_rtx[MAX_SAVED_CONST_INT-5])
+#define constm4_rtx (const_int_rtx[MAX_SAVED_CONST_INT-4])
+#define constm3_rtx (const_int_rtx[MAX_SAVED_CONST_INT-3])
+#define constm2_rtx (const_int_rtx[MAX_SAVED_CONST_INT-2])
+#define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
#define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
#define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
#define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
-#define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
+#define const3_rtx (const_int_rtx[MAX_SAVED_CONST_INT+3])
+#define const4_rtx (const_int_rtx[MAX_SAVED_CONST_INT+4])
+#define const5_rtx (const_int_rtx[MAX_SAVED_CONST_INT+5])
+#define const6_rtx (const_int_rtx[MAX_SAVED_CONST_INT+6])
+#define const7_rtx (const_int_rtx[MAX_SAVED_CONST_INT+7])
+#define const8_rtx (const_int_rtx[MAX_SAVED_CONST_INT+8])
+#define const9_rtx (const_int_rtx[MAX_SAVED_CONST_INT+9])
+#define const10_rtx (const_int_rtx[MAX_SAVED_CONST_INT+10])
+#define const11_rtx (const_int_rtx[MAX_SAVED_CONST_INT+11])
+#define const12_rtx (const_int_rtx[MAX_SAVED_CONST_INT+12])
+#define const13_rtx (const_int_rtx[MAX_SAVED_CONST_INT+13])
+#define const14_rtx (const_int_rtx[MAX_SAVED_CONST_INT+14])
+#define const15_rtx (const_int_rtx[MAX_SAVED_CONST_INT+15])
+#define const16_rtx (const_int_rtx[MAX_SAVED_CONST_INT+16])
+#define const17_rtx (const_int_rtx[MAX_SAVED_CONST_INT+17])
+#define const18_rtx (const_int_rtx[MAX_SAVED_CONST_INT+18])
+#define const19_rtx (const_int_rtx[MAX_SAVED_CONST_INT+19])
+#define const20_rtx (const_int_rtx[MAX_SAVED_CONST_INT+20])
+#define const21_rtx (const_int_rtx[MAX_SAVED_CONST_INT+21])
+#define const22_rtx (const_int_rtx[MAX_SAVED_CONST_INT+22])
+#define const23_rtx (const_int_rtx[MAX_SAVED_CONST_INT+23])
+#define const24_rtx (const_int_rtx[MAX_SAVED_CONST_INT+24])
+#define const25_rtx (const_int_rtx[MAX_SAVED_CONST_INT+25])
+#define const26_rtx (const_int_rtx[MAX_SAVED_CONST_INT+26])
+#define const27_rtx (const_int_rtx[MAX_SAVED_CONST_INT+27])
+#define const28_rtx (const_int_rtx[MAX_SAVED_CONST_INT+28])
+#define const29_rtx (const_int_rtx[MAX_SAVED_CONST_INT+29])
+#define const30_rtx (const_int_rtx[MAX_SAVED_CONST_INT+30])
+#define const31_rtx (const_int_rtx[MAX_SAVED_CONST_INT+31])
+#define const32_rtx (const_int_rtx[MAX_SAVED_CONST_INT+32])
+#define const33_rtx (const_int_rtx[MAX_SAVED_CONST_INT+33])
+#define const34_rtx (const_int_rtx[MAX_SAVED_CONST_INT+34])
+#define const35_rtx (const_int_rtx[MAX_SAVED_CONST_INT+35])
+#define const36_rtx (const_int_rtx[MAX_SAVED_CONST_INT+36])
+#define const37_rtx (const_int_rtx[MAX_SAVED_CONST_INT+37])
+#define const38_rtx (const_int_rtx[MAX_SAVED_CONST_INT+38])
+#define const39_rtx (const_int_rtx[MAX_SAVED_CONST_INT+39])
+#define const40_rtx (const_int_rtx[MAX_SAVED_CONST_INT+40])
+#define const41_rtx (const_int_rtx[MAX_SAVED_CONST_INT+41])
+#define const42_rtx (const_int_rtx[MAX_SAVED_CONST_INT+42])
+#define const43_rtx (const_int_rtx[MAX_SAVED_CONST_INT+43])
+#define const44_rtx (const_int_rtx[MAX_SAVED_CONST_INT+44])
+#define const45_rtx (const_int_rtx[MAX_SAVED_CONST_INT+45])
+#define const46_rtx (const_int_rtx[MAX_SAVED_CONST_INT+46])
+#define const47_rtx (const_int_rtx[MAX_SAVED_CONST_INT+47])
+#define const48_rtx (const_int_rtx[MAX_SAVED_CONST_INT+48])
+#define const49_rtx (const_int_rtx[MAX_SAVED_CONST_INT+49])
+#define const50_rtx (const_int_rtx[MAX_SAVED_CONST_INT+50])
+#define const51_rtx (const_int_rtx[MAX_SAVED_CONST_INT+51])
+#define const52_rtx (const_int_rtx[MAX_SAVED_CONST_INT+52])
+#define const53_rtx (const_int_rtx[MAX_SAVED_CONST_INT+53])
+#define const54_rtx (const_int_rtx[MAX_SAVED_CONST_INT+54])
+#define const55_rtx (const_int_rtx[MAX_SAVED_CONST_INT+55])
+#define const56_rtx (const_int_rtx[MAX_SAVED_CONST_INT+56])
+#define const57_rtx (const_int_rtx[MAX_SAVED_CONST_INT+57])
+#define const58_rtx (const_int_rtx[MAX_SAVED_CONST_INT+58])
+#define const59_rtx (const_int_rtx[MAX_SAVED_CONST_INT+59])
+#define const60_rtx (const_int_rtx[MAX_SAVED_CONST_INT+60])
+#define const61_rtx (const_int_rtx[MAX_SAVED_CONST_INT+61])
+#define const62_rtx (const_int_rtx[MAX_SAVED_CONST_INT+62])
+#define const63_rtx (const_int_rtx[MAX_SAVED_CONST_INT+63])
+#define const64_rtx (const_int_rtx[MAX_SAVED_CONST_INT+64])
extern GTY(()) rtx const_true_rtx;
extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
--
1.8.3.1
next reply other threads:[~2021-06-01 19:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 19:32 Segher Boessenkool [this message]
2021-06-02 17:07 ` Richard Sandiford
2021-06-02 22:43 ` Segher Boessenkool
2021-06-03 19:32 ` Jeff Law
2021-06-03 23:09 ` Segher Boessenkool
2021-06-04 6:32 ` Richard Sandiford
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=eddbfc3dee2bc59de17609dc849c4a3fd7cd6a84.1622575820.git.segher@kernel.crashing.org \
--to=segher@kernel.crashing.org \
--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).