fold-vec-splats-char.c: New.
authorWill Schmidt <will_schmidt@vnet.ibm.com>
Tue, 10 Oct 2017 16:26:03 +0000 (16:26 +0000)
committerWill Schmidt <willschm@gcc.gnu.org>
Tue, 10 Oct 2017 16:26:03 +0000 (16:26 +0000)
[testsuite]

2017-10-10  Will Schmidt <will_schmidt@vnet.ibm.com>

* gcc.target/powerpc/fold-vec-splats-char.c: New.
* gcc.target/powerpc/fold-vec-splats-floatdouble.c: New.
* gcc.target/powerpc/fold-vec-splats-int.c: New.
* gcc.target/powerpc/fold-vec-splats-longlong.c: New.
* gcc.target/powerpc/fold-vec-splats-short.c: New.

From-SVN: r253590

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c [new file with mode: 0644]

index 9317e4df749c93fdd0de5e89c4e557046cfed21d..29b5277180ef9dfa9f3fe8d3d43c5925c5cf7714 100644 (file)
@@ -1,3 +1,11 @@
+2017-10-10  Will Schmidt <will_schmidt@vnet.ibm.com>
+
+       * gcc.target/powerpc/fold-vec-splats-char.c: New.
+       * gcc.target/powerpc/fold-vec-splats-floatdouble.c: New.
+       * gcc.target/powerpc/fold-vec-splats-int.c: New.
+       * gcc.target/powerpc/fold-vec-splats-longlong.c: New.
+       * gcc.target/powerpc/fold-vec-splats-short.c: New.
+
 2017-10-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/82437
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c
new file mode 100644 (file)
index 0000000..8f21153
--- /dev/null
@@ -0,0 +1,22 @@
+/* Verify that overloaded built-ins for vec_splats() with char
+   inputs produce the right code.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -O2 " } */
+
+#include <altivec.h>
+
+vector signed char
+test1s (signed char x)
+{
+  return vec_splats (x);
+}
+
+vector unsigned char
+test1u (unsigned char x)
+{
+  return vec_splats (x);
+}
+
+/* { dg-final { scan-assembler-times "vspltb" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c
new file mode 100644 (file)
index 0000000..c4544f1
--- /dev/null
@@ -0,0 +1,27 @@
+/* Verify that overloaded built-ins for vec_splat with float and
+   double inputs for VSX produce the right code.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx -O1" } */
+
+#include <altivec.h>
+
+vector float
+test1d (float x)
+{
+  return vec_splats (x);
+}
+
+vector double
+test1f (double x)
+{
+  return vec_splats (x);
+}
+
+// float test generates the permute instruction.
+/* { dg-final { scan-assembler-times "xxpermdi" 1 } } */
+
+// double test generates a convert (double to single non-signalling) followed by a splat.
+/* { dg-final { scan-assembler-times {\mxscvdpspn?\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mvspltw\M|\mxxspltw\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c
new file mode 100644 (file)
index 0000000..6671523
--- /dev/null
@@ -0,0 +1,22 @@
+/* Verify that overloaded built-ins for vec_splat with int
+   inputs produce the right code.  */
+
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -O2 " } */
+
+#include <altivec.h>
+
+vector signed int
+test3s (signed int x)
+{
+  return vec_splats (x);
+}
+
+vector unsigned int
+test3u (unsigned int x)
+{
+  return vec_splats (x);
+}
+
+/* { dg-final { scan-assembler-times {\mvspltw\M|\mxxspltw\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c
new file mode 100644 (file)
index 0000000..c5884ba
--- /dev/null
@@ -0,0 +1,22 @@
+/* Verify that overloaded built-ins for vec_splat with long long
+   inputs produce the right code.  */
+
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx -O2" } */
+
+#include <altivec.h>
+
+vector signed long long
+test3s (signed long long x)
+{
+  return vec_splats (x);
+}
+
+vector unsigned long long
+test3u (unsigned long long x)
+{
+  return vec_splats (x);
+}
+
+/* { dg-final { scan-assembler-times "xxpermdi" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c
new file mode 100644 (file)
index 0000000..18102ac
--- /dev/null
@@ -0,0 +1,23 @@
+/* Verify that overloaded built-ins for vec_splat with short
+   inputs produce the right code.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -O2" } */
+
+#include <altivec.h>
+
+vector signed short
+test3s (signed short x)
+{
+  return vec_splats (x);
+}
+
+vector unsigned short
+test3u (unsigned short x)
+{
+  return vec_splats (x);
+}
+
+/* { dg-final { scan-assembler-times "vsplth" 2 } } */
+