[rs6000] Testcase adds for vec_unpack

Message ID 1531163329.17604.40.camel@brimstone.rchland.ibm.com
State New
Headers show
Series
  • [rs6000] Testcase adds for vec_unpack
Related show

Commit Message

Will Schmidt July 9, 2018, 7:08 p.m.
Hi,
  Testcases to exercise the vec_unpack intrinsics.
    
Tested clean across assorted systems.
OK for trunk?
    
Thanks,
-Will
    
[testsuite]
    
2018-07-09  Will Schmidt  <will_schmidt@vnet.ibm.com>
    
	* gcc.target/powerpc/fold-vec-unpack-char.c: New.
	* gcc.target/powerpc/fold-vec-unpack-float.c: New.
	* gcc.target/powerpc/fold-vec-unpack-int.c: New.
	* gcc.target/powerpc/fold-vec-unpack-pixel.c: New.
	* gcc.target/powerpc/fold-vec-unpack-short.c: New.

Comments

Segher Boessenkool July 11, 2018, 11:05 p.m. | #1
Hi Will,


On Mon, Jul 09, 2018 at 02:08:49PM -0500, Will Schmidt wrote:
> 	* gcc.target/powerpc/fold-vec-unpack-char.c: New.
> 	* gcc.target/powerpc/fold-vec-unpack-float.c: New.
> 	* gcc.target/powerpc/fold-vec-unpack-int.c: New.
> 	* gcc.target/powerpc/fold-vec-unpack-pixel.c: New.
> 	* gcc.target/powerpc/fold-vec-unpack-short.c: New.

This looks fine.  Okay for trunk.  Thanks!


Segher

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-char.c
new file mode 100644
index 0000000..7f4b372
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-char.c
@@ -0,0 +1,36 @@ 
+/* Verify that overloaded built-ins for vec_unpackh and vec_unpackl 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 bool short
+testbc_l (vector bool char vbc2)
+{
+  return vec_unpackl (vbc2);
+}
+
+vector signed short
+testsc_l (vector signed char vsc2)
+{
+  return vec_unpackl (vsc2);
+}
+
+vector bool short
+testbc_h (vector bool char vbc2)
+{
+  return vec_unpackh (vbc2);
+}
+
+vector signed short
+testsc_h (vector signed char vsc2)
+{
+  return vec_unpackh (vsc2);
+}
+
+/* { dg-final { scan-assembler-times "vupkhsb" 2 } } */
+/* { dg-final { scan-assembler-times "vupklsb" 2 } } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-float.c
new file mode 100644
index 0000000..78e8eb3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-float.c
@@ -0,0 +1,23 @@ 
+/* Verify that overloaded built-ins for vec_unpackh and vec_unpackl with float
+   inputs produce the right code.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mpower8-vector -O2" } */
+
+#include <altivec.h>
+
+vector double
+testf_l (vector float vf2)
+{
+  return vec_unpackl (vf2);
+}
+
+vector double
+testf_h (vector float vf2)
+{
+  return vec_unpackh (vf2);
+}
+
+/* { dg-final { scan-assembler-times "xxsldwi" 4 } } */
+/* { dg-final { scan-assembler-times "xvcvspdp" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-int.c
new file mode 100644
index 0000000..621c4eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-int.c
@@ -0,0 +1,35 @@ 
+/* Verify that overloaded built-ins for vec_unpackh and vec_unpackl with int
+   inputs produce the right code.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mpower8-vector -O2" } */
+
+#include <altivec.h>
+
+vector bool long long
+testbi_l (vector bool int vbi2)
+{
+  return vec_unpackl (vbi2);
+}
+
+vector signed long long
+testsi_l (vector signed int vsi2)
+{
+  return vec_unpackl (vsi2);
+}
+
+vector bool long long
+testbi_h (vector bool int vbi2)
+{
+  return vec_unpackh (vbi2);
+}
+
+vector signed long long
+testsi_h (vector signed int vsi2)
+{
+  return vec_unpackh (vsi2);
+}
+
+/* { dg-final { scan-assembler-times "vupkhsw" 2 } } */
+/* { dg-final { scan-assembler-times "vupklsw" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-pixel.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-pixel.c
new file mode 100644
index 0000000..8e7d110
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-pixel.c
@@ -0,0 +1,23 @@ 
+/* Verify that overloaded built-ins for vec_unpackh and vec_unpackl with pixel
+   inputs produce the right code.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -O2" } */
+
+#include <altivec.h>
+
+vector unsigned int
+testf_el (vector pixel vpx2)
+{
+  return vec_unpackl (vpx2);
+}
+
+vector unsigned int
+testf_eh (vector pixel vpx2)
+{
+  return vec_unpackh (vpx2);
+}
+
+/* { dg-final { scan-assembler-times "vupkhpx" 1 } } */
+/* { dg-final { scan-assembler-times "vupklpx" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-short.c
new file mode 100644
index 0000000..da51012
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-unpack-short.c
@@ -0,0 +1,36 @@ 
+/* Verify that overloaded built-ins for vec_unpackh and vec_unpackl with int
+   inputs produce the right code.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -O2" } */
+
+#include <altivec.h>
+
+vector bool int
+testbi_el (vector bool short vbs2)
+{
+  return vec_unpackl (vbs2);
+}
+
+vector signed int
+testsi_el (vector signed short vss2)
+{
+  return vec_unpackl (vss2);
+}
+
+vector bool int
+testbi_eh (vector bool short vbs2)
+{
+  return vec_unpackh (vbs2);
+}
+
+vector signed int
+testsi_eh (vector signed short vss2)
+{
+  return vec_unpackh (vss2);
+}
+
+/* { dg-final { scan-assembler-times "vupkhsh" 2 } } */
+/* { dg-final { scan-assembler-times "vupklsh" 2 } } */
+