diff mbox

[x86] Use vector moves in memmove expanding

Message ID 20130909090912.GD53568@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Michael Zolotukhin Sept. 9, 2013, 9:09 a.m. UTC
> I think it is worthwhile, various targets have many different ways to expand
> memcpy, admittedly i?86/x86_64 probably the biggest number of these, and
> while right now you've encountered it on ia32 with certain options doesn't
> mean that in a few years it couldn't hit some unrelated target, arm, sh,
> sparc, whatever.
Ok, that makes sense.
I've never written torture tests before, could you please check if I did it
right?

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.c-torture/execute/memcpy-3.c: New test.
	* gcc.c-torture/execute/memcpy-3.x: New file.


Michael
> 	Jakub

Comments

Jakub Jelinek Sept. 9, 2013, 9:13 a.m. UTC | #1
On Mon, Sep 09, 2013 at 01:09:12PM +0400, Michael V. Zolotukhin wrote:
> I've never written torture tests before, could you please check if I did it
> right?

Please don't introduce new *.x files, for tests where you need something
like that just stick it into gcc.dg/torture/ instead and use normal dg stuff
in there.

So:
/* { dg-do run } */
/* { dg-additional-options "-march=pentiumpro" { target ia32 } } */                                                                                
/* { dg-additional-options "-minline-all-stringops" { target { i?86-*-* x86_64-*-* } } } */                                                        
in gcc.dg/torture/memcpy-1.c would do it.

	Jakub
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.c-torture/execute/memcpy-3.c b/gcc/testsuite/gcc.c-torture/execute/memcpy-3.c
new file mode 100644
index 0000000..f1ceb88
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/memcpy-3.c
@@ -0,0 +1,18 @@ 
+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;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/memcpy-3.x b/gcc/testsuite/gcc.c-torture/execute/memcpy-3.x
new file mode 100644
index 0000000..4458269
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/memcpy-3.x
@@ -0,0 +1,7 @@ 
+if { [istarget "i?86-*-*"] } {
+  set additional_flags "-mtune=pentiumpro -minline-all-stringops"
+}
+if { [istarget "x86_64-*-*"] } {
+  set additional_flags "-minline-all-stringops"
+}
+return 0