From: Jeff Law Date: Sun, 7 Jun 2026 04:53:09 +0000 (-0600) Subject: Restore building for SH after bswap related changes X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;ds=sidebyside;p=thirdparty%2Fgcc.git 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 --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 98790f6f7fe..0ead908e883 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"