https://gcc.gnu.org/g:13390e1b65f499ba33b7b5ff76bd9936e81b74e4

commit r16-1758-g13390e1b65f499ba33b7b5ff76bd9936e81b74e4
Author: Georg-Johann Lay <a...@gjlay.de>
Date:   Sat Jun 28 16:22:50 2025 +0200

    AVR: target/120856 - Deny R24:DI in avr_hard_regno_mode_ok with Reload.
    
    This fixes an ICE with -mno-lra when split2 tries to split the following
    zero_extendsidi2 insn:
    
       (set (reg:DI 24)
            (zero_extend:DI (reg:SI **)))
    
    The ICE is because avr_hard_regno_mode_ok allows R24:DI but disallows
    R28:SI when Reload is used.  R28:SI is a result of zero_extendsidi2.
    
    This ICE only occurs with Reload (which will die before very long),
    but it occurs when building libgcc.
    
    gcc/
            PR target/120856
            * config/avr/avr.cc (avr_hard_regno_mode_ok) [-mno-lra]: Deny
            hard regs >= 4 bytes that overlap Y.

Diff:
---
 gcc/config/avr/avr.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index f651692536b1..c469297d6d09 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -14148,7 +14148,7 @@ avr_hard_regno_mode_ok (unsigned int regno, 
machine_mode mode)
        address registers is extreme stress test for reload.  */
 
   if (GET_MODE_SIZE (mode) >= 4
-      && regno >= REG_X
+      && regno + GET_MODE_SIZE (mode) >= REG_30
       // This problem only concerned the old reload.
       && ! avropt_lra_p)
     return false;

Reply via email to