re PR target/78426 (wrong code with strncmp on SH)
authorKaz Kojima <kkojima@gcc.gnu.org>
Sat, 19 Nov 2016 13:59:47 +0000 (13:59 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Sat, 19 Nov 2016 13:59:47 +0000 (13:59 +0000)
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
gcc/config/sh/sh-mem.cc

index 65e927ad2238e2d2c3a7bdb71f249ec9635c006c..fd09a79049435ea9545367884bb9fd36335aa8b1 100644 (file)
@@ -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.
index b965aed1684a810735e87cc4f08895eafc4c8a79..f91afa5064f70bd114dc4cc383be35acb124ddc7 100644 (file)
@@ -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;