Patchwork [x86] Use vector moves in memmove expanding

login
register
mail settings
Submitter Michael Zolotukhin
Date Sept. 9, 2013, 9:23 a.m.
Message ID <20130909092329.GE53568@msticlxl57.ims.intel.com>
Download mbox | patch
Permalink /patch/273533/
State New
Headers show

Comments

Michael Zolotukhin - Sept. 9, 2013, 9:23 a.m.
> 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.
Thanks, fixed.  Ok to commit?

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
> 	Jakub
Uros Bizjak - Sept. 9, 2013, 9:25 a.m.
On Mon, Sep 9, 2013 at 11:23 AM, Michael V. Zolotukhin
<michael.v.zolotukhin@gmail.com> wrote:
>> 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.
> Thanks, fixed.  Ok to commit?

No -march in runtime tests, please.

Uros.
Michael Zolotukhin - Sept. 9, 2013, 10:12 a.m.
> No -march in runtime tests, please.
Is mtune ok here?

Michael
> Uros.
Uros Bizjak - Sept. 9, 2013, 10:14 a.m.
On Mon, Sep 9, 2013 at 12:12 PM, Michael V. Zolotukhin
<michael.v.zolotukhin@gmail.com> wrote:
>> No -march in runtime tests, please.
> Is mtune ok here?

Yes.

Uros.
Jakub Jelinek - Sept. 9, 2013, 10:17 a.m.
On Mon, Sep 09, 2013 at 02:12:35PM +0400, Michael V. Zolotukhin wrote:
> > No -march in runtime tests, please.
> Is mtune ok here?

Please verify that with the s/-march/-mtune/ change without the i386.c fix the testcase
will fail with
make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} dg-torture.exp=pr58*.c'
and with the i386.c fix will succeed (that is pretty much a general rule for
most of the testcases for some PR being added into the testsuite).

	Jakub
Uros Bizjak - Sept. 9, 2013, 10:19 a.m.
On Mon, Sep 9, 2013 at 12:17 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Sep 09, 2013 at 02:12:35PM +0400, Michael V. Zolotukhin wrote:
>> > No -march in runtime tests, please.
>> Is mtune ok here?
>
> Please verify that with the s/-march/-mtune/ change without the i386.c fix the testcase

It will fail, I have checked it.

Uros.

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..f8e8974
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/memcpy-1.c
@@ -0,0 +1,22 @@ 
+/* { dg-do run } */
+/* { dg-additional-options "-march=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;
+}
+