Some SME instructions use w12-w15 to index ZA. This patch
adds a register class for that range.
gcc/
* config/aarch64/aarch64.h (ZA_INDEX_REGNUM_P): New macro.
(ZA_INDEX_REGS): New register class.
(REG_CLASS_NAMES, REG_CLASS_CONTENTS): Add entries for it.
* config/aarch64/aarch64.cc (aarch64_regno_regclass)
(aarch64_class_max_nregs, aarch64_register_move_cost): Handle
ZA_INDEX_REGS.
---
gcc/config/aarch64/aarch64.cc | 12 +++++++-----
gcc/config/aarch64/aarch64.h | 6 ++++++
2 files changed, 13 insertions(+), 5 deletions(-)
@@ -13553,6 +13553,9 @@ aarch64_label_mentioned_p (rtx x)
enum reg_class
aarch64_regno_regclass (unsigned regno)
{
+ if (ZA_INDEX_REGNUM_P (regno))
+ return ZA_INDEX_REGS;
+
if (STUB_REGNUM_P (regno))
return STUB_REGS;
@@ -13917,6 +13920,7 @@ aarch64_class_max_nregs (reg_class_t regclass, machine_mode mode)
unsigned int nregs, vec_flags;
switch (regclass)
{
+ case ZA_INDEX_REGS:
case STUB_REGS:
case TAILCALL_ADDR_REGS:
case POINTER_REGS:
@@ -16252,13 +16256,11 @@ aarch64_register_move_cost (machine_mode mode,
const struct cpu_regmove_cost *regmove_cost
= aarch64_tune_params.regmove_cost;
- /* Caller save and pointer regs are equivalent to GENERAL_REGS. */
- if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS
- || to == STUB_REGS)
+ /* Trest any subset of GENERAL_REGS as though it were GENERAL_REGS. */
+ if (reg_class_subset_p (to, GENERAL_REGS))
to = GENERAL_REGS;
- if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS
- || from == STUB_REGS)
+ if (reg_class_subset_p (from, GENERAL_REGS))
from = GENERAL_REGS;
/* Make RDFFR very expensive. In particular, if we know that the FFR
@@ -643,6 +643,9 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF;
&& (REGNO) != R17_REGNUM \
&& (REGNO) != R30_REGNUM) \
+#define ZA_INDEX_REGNUM_P(REGNO) \
+ IN_RANGE (REGNO, R12_REGNUM, R15_REGNUM)
+
#define FP_REGNUM_P(REGNO) \
(((unsigned) (REGNO - V0_REGNUM)) <= (V31_REGNUM - V0_REGNUM))
@@ -666,6 +669,7 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF;
enum reg_class
{
NO_REGS,
+ ZA_INDEX_REGS,
TAILCALL_ADDR_REGS,
STUB_REGS,
GENERAL_REGS,
@@ -690,6 +694,7 @@ enum reg_class
#define REG_CLASS_NAMES \
{ \
"NO_REGS", \
+ "ZA_INDEX_REGS", \
"TAILCALL_ADDR_REGS", \
"STUB_REGS", \
"GENERAL_REGS", \
@@ -711,6 +716,7 @@ enum reg_class
#define REG_CLASS_CONTENTS \
{ \
{ 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
+ { 0x0000f000, 0x00000000, 0x00000000 }, /* ZA_INDEX_REGS */ \
{ 0x00030000, 0x00000000, 0x00000000 }, /* TAILCALL_ADDR_REGS */\
{ 0x3ffcffff, 0x00000000, 0x00000000 }, /* STUB_REGS */ \
{ 0x7fffffff, 0x00000000, 0x00000003 }, /* GENERAL_REGS */ \