]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Restore building for SH after bswap related changes master trunk
authorJeff Law <jeffrey.law@oss.qualcomm.com>
Sun, 7 Jun 2026 04:53:09 +0000 (22:53 -0600)
committerJeff Law <jeffrey.law@oss.qualcomm.com>
Sun, 7 Jun 2026 04:53:09 +0000 (22:53 -0600)
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.

gcc/config/sh/sh.md

index 98790f6f7fe2abedaa334a2d41cb9febb490409d..0ead908e883b787a600106dbc20292711a6b6bf5 100644 (file)
 (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"