For this target, the GR_REGS register class contains several subclasses,
which are indeed passed to the TARGET_SECONDARY_RELOAD hook function.
However, the current implementation only compares these against GR_REGS or
RL_REGS, which may lead to incorrect results.

This patch ensures accuracy in the determination by using
reg_class_subset_p() within the hook function to evaluate the register
class.

gcc/ChangeLog:

        * config/xtensa/xtensa.cc (xtensa_secondary_reload):
        Change to use reg_class_subset_p() for evaluating the provided
        register class.
---
 gcc/config/xtensa/xtensa.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index bfc8e8bfa01..6ebf8c72453 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -4537,7 +4537,7 @@ xtensa_secondary_reload (bool in_p, rtx x, reg_class_t 
rclass,
regno = xt_true_regnum (x);
   if (ACC_REG_P (regno))
-    return ((rclass == GR_REGS || rclass == RL_REGS) ? NO_REGS : RL_REGS);
+    return (reg_class_subset_p (rclass, GR_REGS) ? NO_REGS : RL_REGS);
   if (rclass == ACC_REG)
     return (GP_REG_P (regno) ? NO_REGS : RL_REGS);
--
2.39.5

Reply via email to