Hi, The attached patch fixes PR 67391. Some additional reg overlapping were added to the addsi3 patterns while making LRA on SH work, but not all of them seem to be good. Removing them, seems to be working just fine. Tested on sh-elf (LRA enabled) with make -k check RUNTESTFLAGS="--target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}" and by Kaz on sh4-linux.
Committed to trunk as r228046 and to the GCC 5 branch as r228047. Cheers, Oleg gcc/ChangeLog: PR target/67391 * config/sh/sh.md (addsi3, *addsi3_compact): Don't check for overlapping regs when matching the pattern.
Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 228020) +++ gcc/config/sh/sh.md (working copy) @@ -2129,11 +2129,6 @@ { if (TARGET_SHMEDIA) operands[1] = force_reg (SImode, operands[1]); - else if (! arith_operand (operands[2], SImode)) - { - if (reg_overlap_mentioned_p (operands[0], operands[1])) - FAIL; - } }) (define_insn "addsi3_media" @@ -2172,10 +2167,7 @@ [(set (match_operand:SI 0 "arith_reg_dest" "=r,&u") (plus:SI (match_operand:SI 1 "arith_operand" "%0,r") (match_operand:SI 2 "arith_or_int_operand" "rI08,rn")))] - "TARGET_SH1 - && ((rtx_equal_p (operands[0], operands[1]) - && arith_operand (operands[2], SImode)) - || ! reg_overlap_mentioned_p (operands[0], operands[1]))" + "TARGET_SH1" "@ add %2,%0 #"