diff mbox

[x86] Use vector moves in memmove expanding

Message ID 20130909102235.GG53568@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Michael Zolotukhin Sept. 9, 2013, 10:22 a.m. UTC
> > Is mtune ok here?
> Yes.
Thanks, fixed.  Ok to commit?
I verified that the test fails without fix in i386.c and passes with it.

Changelog:
gcc:
2013-09-09  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

	* config/i386/i386.c (ix86_expand_movmem): Fix epilogue generation.

gcc/testsuite:
2013-09-09  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

	* gcc.dg/torture/memcpy-1.c: New test.

Michael
> Uros.

Comments

Uros Bizjak Sept. 9, 2013, 11:50 a.m. UTC | #1
On Mon, Sep 9, 2013 at 12:22 PM, Michael V. Zolotukhin
<michael.v.zolotukhin@gmail.com> wrote:
>> > Is mtune ok here?
>> Yes.
> Thanks, fixed.  Ok to commit?
> I verified that the test fails without fix in i386.c and passes with it.
>
> Changelog:
> gcc:
> 2013-09-09  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
>
>         * config/i386/i386.c (ix86_expand_movmem): Fix epilogue generation.
>
> gcc/testsuite:
> 2013-09-09  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
>
>         * gcc.dg/torture/memcpy-1.c: New test.

OK.

Thanks,
Uros.
Kirill Yukhin Sept. 10, 2013, 7:54 a.m. UTC | #2
Hello,
On 09 Sep 13:50, Uros Bizjak wrote:
> OK.

Checked into main trunk: http://gcc.gnu.org/ml/gcc-cvs/2013-09/msg00286.html

--
Thanks, K
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a8d70bc..50e9fa9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -23329,7 +23329,7 @@  ix86_expand_movmem (rtx dst, rtx src, rtx count_exp, rtx align_exp,
 
   if (count_exp != const0_rtx && epilogue_size_needed > 1)
     expand_movmem_epilogue (dst, src, destreg, srcreg, count_exp,
-			    size_needed);
+			    epilogue_size_needed);
   if (jump_around_label)
     emit_label (jump_around_label);
   return true;
diff --git a/gcc/testsuite/gcc.dg/torture/memcpy-1.c b/gcc/testsuite/gcc.dg/torture/memcpy-1.c
new file mode 100644
index 0000000..290c789
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/memcpy-1.c
@@ -0,0 +1,22 @@ 
+/* { dg-do run } */
+/* { dg-additional-options "-mtune=pentiumpro" { target ia32 } } */
+/* { dg-additional-options "-minline-all-stringops" { target { i?86-*-* x86_64-*-* } } } */
+
+static void __attribute__((noinline, noclone))
+my_memcpy (char *dest, const char *src, int n)
+{
+  __builtin_memcpy (dest, src, n);
+}
+
+int
+main (void)
+{
+  char a1[4], a2[4];
+  __builtin_memset (a1, 'a', 4);
+  __builtin_memset (a2, 'b', 4);
+  my_memcpy (a2, a1, 4);
+  if (a2[0] != 'a')
+    __builtin_abort ();
+  return 0;
+}
+