From patchwork Tue Jun 1 19:32:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 1486210 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fvj460Rntz9sSn for ; Wed, 2 Jun 2021 05:32:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 081873986801 for ; Tue, 1 Jun 2021 19:32:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from gcc1-power7.osuosl.org (gcc1-power7.osuosl.org [140.211.15.137]) by sourceware.org (Postfix) with ESMTP id 828B83985824 for ; Tue, 1 Jun 2021 19:32:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 828B83985824 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gcc1-power7.osuosl.org Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id B980A12402FF; Tue, 1 Jun 2021 19:32:18 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Subject: [PATCH] rtl: constm64_rtx..const64_rtx Date: Tue, 1 Jun 2021 19:32:15 +0000 Message-Id: X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Segher Boessenkool Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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 * 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];