rs6000.c (rtx_is_swappable_p): Change UNSPEC_VSX__XXSPLTD to require special splat...
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 16 Jan 2017 15:05:35 +0000 (15:05 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Mon, 16 Jan 2017 15:05:35 +0000 (15:05 +0000)
[gcc]

2017-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

* config/rs6000/rs6000.c (rtx_is_swappable_p): Change
UNSPEC_VSX__XXSPLTD to require special splat handling.

[gcc/testsuite]

2017-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

* gcc.target/powerpc/swaps-p8-27.c: New.

From-SVN: r244495

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c [new file with mode: 0644]

index b1eeaf3fa9b268451e5bccf677602ef4c3bbe369..7520de88a3ca05a8c5452cfadbbd65de7c3f20f6 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * config/rs6000/rs6000.c (rtx_is_swappable_p): Change
+       UNSPEC_VSX__XXSPLTD to require special splat handling.
+
 2017-01-16  David Malcolm  <dmalcolm@redhat.com>
 
        PR bootstrap/78616
index f1d5d9d1f9d7c85262b12ebfad6c68f10884415d..29b3fd65624d4ba99b956435129b3b7116163f0d 100644 (file)
@@ -41318,6 +41318,7 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
          case UNSPEC_VSX_VEC_INIT:
            return 0;
          case UNSPEC_VSPLT_DIRECT:
+         case UNSPEC_VSX_XXSPLTD:
            *special = SH_SPLAT;
            return 1;
          case UNSPEC_REDUC_PLUS:
index aeb050a77c9b35c402a78d311f2cd8d8ca3d7c2f..e5fa65af9b841b48c568d2eb130b084ac0b93ad8 100644 (file)
@@ -1,3 +1,7 @@
+2017-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * gcc.target/powerpc/swaps-p8-27.c: New.
+
 2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/71737
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c
new file mode 100644 (file)
index 0000000..832f0c7
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O3 " } */
+/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */
+/* { dg-final { scan-assembler-times "stxvd2x" 1 } } */
+/* { dg-final { scan-assembler-times "xxpermdi" 3 } } */
+
+/* Verify that swap optimization works correctly for a VSX direct splat.
+   The three xxpermdi's that are generated correspond to two splats
+   and the __builtin_vsx_xxpermdi.  */
+
+int printf (const char *__restrict __format, ...);
+typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
+
+double s1[] = {2134.3343, 6678.346};
+double s2[] = {41124.234, 6678.346};
+long long dd[] = {1, 2}, d[2];
+union{long long l[2]; double d[2];} e;
+
+void
+foo ()
+{
+  __m128d source1, source2, dest;
+  __m128d a, b, c;
+
+  e.d[1] = s1[1];
+  e.l[0] = !__builtin_isunordered(s1[0], s2[0]) 
+    && s1[0] == s2[0] ? -1 : 0;
+  source1 = __builtin_vec_vsx_ld (0, s1);
+  source2 = __builtin_vec_vsx_ld (0, s2);
+  a = __builtin_vec_splat (source1, 0);
+  b = __builtin_vec_splat (source2, 0);
+  c = (__m128d)__builtin_vec_cmpeq (a, b);
+  dest = __builtin_vsx_xxpermdi (source1, c, 1);
+  *(__m128d *)d = dest;
+}