On Tue, 8 May 2012, Richard Sandiford wrote:

Marc Glisse <marc.gli...@inria.fr> writes:
Here is a new version.

gcc/ChangeLog
2012-05-08  Marc Glisse  <marc.gli...@inria.fr>

        * simplify-rtx.c (simplify_binary_operation_1): Optimize shuffle
        of concatenations.

OK, thanks.  I'll leave an x86 maintainer to review the testcase,
but it looks like it'll need some markup to ensure an SSE target.

Oups, I'd thought about that, then completely forgot. For 64 bits, it always works. For 32 bits, it requires -msse2 -mfpmath=sse (without -mfpmath=sse we can still test for shufpd, but apparently not unpcklpd, I could remove that second test if people prefer, as it isn't important). Since this is a compile-only test, I think this would be enough:

/* { dg-options "-O -msse2 -mfpmath=sse" } */

Note to self: if you want to grep for "shuf" in the asm, don't put "shuf"
in the name of the file...

Yeah :-)  For MIPS tests I tend to add "\t" to the beginning of the regexp.
(And to the end if possible.)

Good idea. I was trying to make the check as wide as possible, but that's not so useful. Attached a new version of the testcase.

--
Marc Glisse
Index: gcc.target/i386/shuf-concat.c
===================================================================
--- gcc.target/i386/shuf-concat.c       (revision 0)
+++ gcc.target/i386/shuf-concat.c       (revision 0)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -msse2 -mfpmath=sse" } */
+
+typedef double v2df __attribute__ ((__vector_size__ (16)));
+
+v2df f(double d,double e){
+  v2df x={-d,d};
+  v2df y={-e,e};
+  return __builtin_ia32_shufpd(x,y,1);
+}
+
+/* { dg-final { scan-assembler-not "\tv?shufpd\t" } } */
+/* { dg-final { scan-assembler-times "\tv?unpcklpd\t" 1 } } */

Property changes on: gcc.target/i386/shuf-concat.c
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision URL

Reply via email to