From e8fe0e46170419bfe47bbaf381e38e7ddc525ef6 Mon Sep 17 00:00:00 2001 From: Kaz Kojima Date: Sat, 19 Nov 2016 13:59:47 +0000 Subject: [PATCH] re PR target/78426 (wrong code with strncmp on SH) PR target/78426 * config/sh/sh-mem.cc (sh_expand_cmpnstr): Use copy_to_mode_reg instead of force_reg. (sh_expand_setmem): Likewise. From-SVN: r242622 --- gcc/ChangeLog | 7 +++++++ gcc/config/sh/sh-mem.cc | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65e927a..fd09a79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-11-19 Kaz Kojima + + PR target/78426 + * config/sh/sh-mem.cc (sh_expand_cmpnstr): Use copy_to_mode_reg + instead of force_reg. + (sh_expand_setmem): Likewise. + 2016-11-19 Krister Walfridsson * config.gcc (*-*-netbsd): Set use_gcc_stdint=wrap. diff --git a/gcc/config/sh/sh-mem.cc b/gcc/config/sh/sh-mem.cc index b965aed..f91afa5 100644 --- a/gcc/config/sh/sh-mem.cc +++ b/gcc/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; -- 2.7.4