PR target/16357
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Jul 2004 06:37:10 +0000 (06:37 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Jul 2004 06:37:10 +0000 (06:37 +0000)
* config/mips/mips.c (mips_block_move_straight): Pass BLKmode memrefs
to mips_expand_unaligned_load, mips_expand_unaligned_store, and
move_by_pieces.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84108 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20040705-1.c [new file with mode: 0644]

index 2db8938..5d77ac0 100644 (file)
@@ -1,3 +1,10 @@
+2004-07-05  Richard Sandiford  <rsandifo@redhat.com>
+
+       PR target/16357
+       * config/mips/mips.c (mips_block_move_straight): Pass BLKmode memrefs
+       to mips_expand_unaligned_load, mips_expand_unaligned_store, and
+       move_by_pieces.
+
 2004-07-05  Josef Zlomek  <zlomekj@suse.cz>
 
        * var-tracking.c: Fix some comments.
index c2f7ce9..8382b02 100644 (file)
@@ -3402,33 +3402,33 @@ mips_block_move_straight (rtx dest, rtx src, HOST_WIDE_INT length)
      the source has enough alignment, otherwise use left/right pairs.  */
   for (offset = 0, i = 0; offset + delta <= length; offset += delta, i++)
     {
-      rtx part;
-
       regs[i] = gen_reg_rtx (mode);
-      part = adjust_address (src, mode, offset);
-      if (MEM_ALIGN (part) >= bits)
-       emit_move_insn (regs[i], part);
-      else if (!mips_expand_unaligned_load (regs[i], part, bits, 0))
-       abort ();
+      if (MEM_ALIGN (src) >= bits)
+       emit_move_insn (regs[i], adjust_address (src, mode, offset));
+      else
+       {
+         rtx part = adjust_address (src, BLKmode, offset);
+         if (!mips_expand_unaligned_load (regs[i], part, bits, 0))
+           abort ();
+       }
     }
 
   /* Copy the chunks to the destination.  */
   for (offset = 0, i = 0; offset + delta <= length; offset += delta, i++)
-    {
-      rtx part;
-
-      part = adjust_address (dest, mode, offset);
-      if (MEM_ALIGN (part) >= bits)
-       emit_move_insn (part, regs[i]);
-      else if (!mips_expand_unaligned_store (part, regs[i], bits, 0))
-       abort ();
-    }
+    if (MEM_ALIGN (dest) >= bits)
+      emit_move_insn (adjust_address (dest, mode, offset), regs[i]);
+    else
+      {
+       rtx part = adjust_address (dest, BLKmode, offset);
+       if (!mips_expand_unaligned_store (part, regs[i], bits, 0))
+         abort ();
+      }
 
   /* Mop up any left-over bytes.  */
   if (offset < length)
     {
-      src = adjust_address (src, mode, offset);
-      dest = adjust_address (dest, mode, offset);
+      src = adjust_address (src, BLKmode, offset);
+      dest = adjust_address (dest, BLKmode, offset);
       move_by_pieces (dest, src, length - offset,
                      MIN (MEM_ALIGN (src), MEM_ALIGN (dest)), 0);
     }
index b90f61d..82c559d 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-05  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gcc.c-torture/compile/20040705-1.c: New test.
+
 2004-07-04  Bud Davis  <bdavis9659@comcast.net>
 
        * gfortran.fortran-torture/execute/seq_io.f90: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040705-1.c b/gcc/testsuite/gcc.c-torture/compile/20040705-1.c
new file mode 100644 (file)
index 0000000..1e45ee2
--- /dev/null
@@ -0,0 +1,2 @@
+extern char foo[], bar[];
+void f (void) { memcpy (foo, bar, 7); }