https://gcc.gnu.org/g:f75e33b7c1ddc42ce9d6d455e0076dbe373b46b5

commit r17-5771-gf75e33b7c1ddc42ce9d6d455e0076dbe373b46b5
Author: Takayuki 'January June' Suwa <[email protected]>
Date:   Fri Oct 30 21:00:36 2026 +0900

    xtensa: Improve register class checks in TARGET_SECONDARY_RELOAD
    
    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.

Diff:
---
 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 bfc8e8bfa013..6ebf8c724533 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);

Reply via email to