From: Uros Bizjak <ubizjak@gmail.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] i386: Introduce LEGACY_SSE_REGNO_P predicate
Date: Wed, 17 Nov 2021 20:34:32 +0100 [thread overview]
Message-ID: <CAFULd4aOC9eBFS_+p-BHAPJE3MNzXU+Xy-00aiatfj-Yr4BLpg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
Introduce LEGACY_SSE_REGNO_P predicate to simplify a couple of places.
No functional changes.
2021-11-17 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/i386.h (LEGACY_SSE_REGNO_P): New predicate.
(SSE_REGNO_P): Use LEGACY_SSE_REGNO_P predicate.
* config/i386/i386.c (zero_all_vector_registers):
Use LEGACY_SSE_REGNO_P predicate.
(ix86_register_priority): Use REX_INT_REGNO_P, REX_SSE_REGNO_P
and EXT_REG_SSE_REGNO_P predicates.
(ix86_hard_regno_call_part_clobbered): Use REX_SSE_REGNO_P
and LEGACY_SSE_REGNO_P predicates.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Pushed to master.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 2642 bytes --]
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 73c4d5115bb..0c5439dc7a7 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3665,7 +3665,7 @@ zero_all_vector_registers (HARD_REG_SET need_zeroed_hardregs)
return NULL;
for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if ((IN_RANGE (regno, FIRST_SSE_REG, LAST_SSE_REG)
+ if ((LEGACY_SSE_REGNO_P (regno)
|| (TARGET_64BIT
&& (REX_SSE_REGNO_P (regno)
|| (TARGET_AVX512F && EXT_REX_SSE_REGNO_P (regno)))))
@@ -19089,15 +19089,13 @@ ix86_register_priority (int hard_regno)
return 0;
if (hard_regno == BP_REG)
return 1;
- /* New x86-64 int registers result in bigger code size. Discourage
- them. */
- if (IN_RANGE (hard_regno, FIRST_REX_INT_REG, LAST_REX_INT_REG))
+ /* New x86-64 int registers result in bigger code size. Discourage them. */
+ if (REX_INT_REGNO_P (hard_regno))
return 2;
- /* New x86-64 SSE registers result in bigger code size. Discourage
- them. */
- if (IN_RANGE (hard_regno, FIRST_REX_SSE_REG, LAST_REX_SSE_REG))
+ /* New x86-64 SSE registers result in bigger code size. Discourage them. */
+ if (REX_SSE_REGNO_P (hard_regno))
return 2;
- if (IN_RANGE (hard_regno, FIRST_EXT_REX_SSE_REG, LAST_EXT_REX_SSE_REG))
+ if (EXT_REX_SSE_REGNO_P (hard_regno))
return 1;
/* Usage of AX register results in smaller code. Prefer it. */
if (hard_regno == AX_REG)
@@ -19974,9 +19972,8 @@ ix86_hard_regno_call_part_clobbered (unsigned int abi_id, unsigned int regno,
/* Special ABI for vzeroupper which only clobber higher part of sse regs. */
if (abi_id == ABI_VZEROUPPER)
return (GET_MODE_SIZE (mode) > 16
- && ((TARGET_64BIT
- && (IN_RANGE (regno, FIRST_REX_SSE_REG, LAST_REX_SSE_REG)))
- || (IN_RANGE (regno, FIRST_SSE_REG, LAST_SSE_REG))));
+ && ((TARGET_64BIT && REX_SSE_REGNO_P (regno))
+ || LEGACY_SSE_REGNO_P (regno)));
return SSE_REGNO_P (regno) && GET_MODE_SIZE (mode) > 16;
}
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index e35c79c192c..2fda1e0686e 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1409,10 +1409,13 @@ enum reg_class
#define SSE_REG_P(X) (REG_P (X) && SSE_REGNO_P (REGNO (X)))
#define SSE_REGNO_P(N) \
- (IN_RANGE ((N), FIRST_SSE_REG, LAST_SSE_REG) \
+ (LEGACY_SSE_REGNO_P (N) \
|| REX_SSE_REGNO_P (N) \
|| EXT_REX_SSE_REGNO_P (N))
+#define LEGACY_SSE_REGNO_P(N) \
+ IN_RANGE ((N), FIRST_SSE_REG, LAST_SSE_REG)
+
#define REX_SSE_REGNO_P(N) \
IN_RANGE ((N), FIRST_REX_SSE_REG, LAST_REX_SSE_REG)
reply other threads:[~2021-11-17 19:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CAFULd4aOC9eBFS_+p-BHAPJE3MNzXU+Xy-00aiatfj-Yr4BLpg@mail.gmail.com \
--to=ubizjak@gmail.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).