summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2016-11-19 13:59:47 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2016-11-19 13:59:47 +0000
commite8fe0e46170419bfe47bbaf381e38e7ddc525ef6 (patch)
tree104c3168dfae8aed6ed2e6f9059e1610d3949759
parent0333b8d06de3c9ac38360e351f89c87ccac23fcc (diff)
downloadgcc-e8fe0e46170419bfe47bbaf381e38e7ddc525ef6.tar.gz
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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/sh/sh-mem.cc6
2 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 65e927ad223..fd09a790494 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2016-11-19 Kaz Kojima <kkojima@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.
+
2016-11-19 Krister Walfridsson <krister.walfridsson@gmail.com>
* 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 b965aed1684..f91afa5064f 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;