I've applied the attached patch to fix PR target/78426 which is a regression caused by rtl sharing with sh_expand_{cmpnstr,setmem}. Tested with "make -k check" on sh4-unknown-linux-gnu. I'll backport it to release branches.
Regards, kaz -- 2016-11-19 Kaz Kojima <kkoj...@gcc.gnu.org> PR target/78426 * config/sh/sh-mem.cc (sh_expand_cmpnstr): Use copy_to_mode_reg instead of force_reg. (sh_expand_setmem): Likewise. -- diff --git a/config/sh/sh-mem.cc b/config/sh/sh-mem.cc index b965aed..f91afa5 100644 --- a/config/sh/sh-mem.cc +++ b/config/sh/sh-mem.cc @@ -347,7 +347,7 @@ sh_expand_cmpnstr (rtx *operands) rtx_code_label *L_loop_byte = gen_label_rtx (); rtx_code_label *L_end_loop_byte = gen_label_rtx (); - rtx len = force_reg (SImode, operands[3]); + rtx len = copy_to_mode_reg (SImode, operands[3]); int constp = CONST_INT_P (operands[3]); const unsigned int addr1_alignment = MEM_ALIGN (operands[1]) / BITS_PER_UNIT; @@ -672,9 +672,9 @@ sh_expand_setmem (rtx *operands) rtx_insn *jump; rtx dest = copy_rtx (operands[0]); rtx dest_addr = copy_addr_to_reg (XEXP (dest, 0)); - rtx val = force_reg (SImode, operands[2]); + rtx val = copy_to_mode_reg (SImode, operands[2]); int align = INTVAL (operands[3]); - rtx len = force_reg (SImode, operands[1]); + rtx len = copy_to_mode_reg (SImode, operands[1]); if (! CONST_INT_P (operands[1])) return;