https://gcc.gnu.org/g:4616bb2295a8437582df7ee1bbc1436262d39ac1

commit r17-1403-g4616bb2295a8437582df7ee1bbc1436262d39ac1
Author: Jeff Law <[email protected]>
Date:   Sat Jun 6 22:53:09 2026 -0600

    Restore building for SH after bswap related changes
    
    Recent changes result in triggering a compile-time error if the bswap 
pattern
    FAILs.  This tripped on the SH port where one of the bswap patterns FAILs 
if we
    can't create new pseudos.  We can restore building for SH by moving the 
check
    into the pattern's condition.
    
    Tested by building sh3-linux-gnu/sh3eb-linux-gnu where the compiler builds
    again and there are no testsuite regressions relative to the last clean 
build a
    few days ago.  sh4/sh4eb, which bootstrap, will run sometime over the coming
    days.
    
    Pushing to the trunk.
    
    gcc/
            * config/sh/sh.md (bswapsi2): Move check for can_create_pseudos_p
            into condition rather than FAILing.

Diff:
---
 gcc/config/sh/sh.md | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 98790f6f7fe2..0ead908e883b 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -4597,20 +4597,15 @@
 (define_expand "bswapsi2"
   [(set (match_operand:SI 0 "arith_reg_dest" "")
        (bswap:SI (match_operand:SI 1 "arith_reg_operand" "")))]
-  "TARGET_SH1"
+  "TARGET_SH1 && can_create_pseudo_p ()"
 {
-  if (! can_create_pseudo_p ())
-    FAIL;
-  else
-    {
-      rtx tmp0 = gen_reg_rtx (SImode);
-      rtx tmp1 = gen_reg_rtx (SImode);
+  rtx tmp0 = gen_reg_rtx (SImode);
+  rtx tmp1 = gen_reg_rtx (SImode);
 
-      emit_insn (gen_swapbsi2 (tmp0, operands[1]));
-      emit_insn (gen_rotlsi3_16 (tmp1, tmp0));
-      emit_insn (gen_swapbsi2 (operands[0], tmp1));
-      DONE;
-    }
+  emit_insn (gen_swapbsi2 (tmp0, operands[1]));
+  emit_insn (gen_rotlsi3_16 (tmp1, tmp0));
+  emit_insn (gen_swapbsi2 (operands[0], tmp1));
+  DONE;
 })
 
 (define_insn "swapbsi2"

Reply via email to