+2017-08-23 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * gcc.target/powerpc/fold-vec-perm-char.c: New.
+ * gcc.target/powerpc/fold-vec-perm-double.c: New.
+ * gcc.target/powerpc/fold-vec-perm-float.c: New.
+ * gcc.target/powerpc/fold-vec-perm-int.c: New.
+ * gcc.target/powerpc/fold-vec-perm-longlong.c: New.
+ * gcc.target/powerpc/fold-vec-perm-pixel.c: New.
+ * gcc.target/powerpc/fold-vec-perm-short.c: New.
+
2017-08-23 Richard Biener <rguenther@suse.de>
* g++.dg/cpp1y/constexpr-instantiate.C: Adjust.
--- /dev/null
+/* Verify that overloaded built-ins for vec_perm 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 char
+testbc (vector bool char vbc2, vector bool char vbc3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vbc2, vbc3, vuc);
+}
+
+vector signed char
+testsc (vector signed char vsc2, vector signed char vsc3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vsc2, vsc3, vuc);
+}
+
+vector unsigned char
+testuc (vector unsigned char vuc2, vector unsigned char vuc3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vuc2, vuc3, vuc);
+}
+
+/* { dg-final { scan-assembler-times "vperm" 3 } } */
--- /dev/null
+/* Verify that overloaded built-ins for vec_perm with double
+ inputs produce the right code. */
+
+/* { dg-do compile } */
+// vector double needs -mvsx.
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx -O2" } */
+
+#include <altivec.h>
+
+vector double
+testd (vector double vd2, vector double vd3, vector unsigned char vuc)
+{
+ return vec_perm (vd2, vd3, vuc);
+}
+
+/* { dg-final { scan-assembler-times "vperm" 1 } } */
--- /dev/null
+/* Verify that overloaded built-ins for vec_perm with float
+ inputs produce the right code. */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -O2" } */
+
+#include <altivec.h>
+
+vector float
+testf (vector float vf2, vector float vf3, vector unsigned char vuc)
+{
+ return vec_perm (vf2, vf3, vuc);
+}
+
+/* { dg-final { scan-assembler-times "vperm" 1 } } */
--- /dev/null
+/* Verify that overloaded built-ins for vec_perm 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 (vector bool int vbi2, vector bool int vbi3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vbi2, vbi3, vuc);
+}
+
+vector signed int
+testsi (vector signed int vsi2, vector signed int vsi3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vsi2, vsi3, vuc);
+}
+
+vector unsigned int
+testui (vector unsigned int vui2, vector unsigned int vui3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vui2, vui3, vuc);
+}
+
+/* { dg-final { scan-assembler-times "vperm" 3 } } */
--- /dev/null
+/* Verify that overloaded built-ins for vec_perm with long long
+ inputs produce the right code. */
+
+/* { dg-do compile {target lp64} } */
+// 'long long' in Altivec types is invalid without -mvsx.
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx -O2" } */
+
+#include <altivec.h>
+
+vector bool long long
+testbl (vector bool long long vbl2, vector bool long long vbl3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vbl2, vbl3, vuc);
+}
+
+vector signed long long
+testsl (vector signed long vsl2, vector signed long vsl3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vsl2, vsl3, vuc);
+}
+
+vector unsigned long long
+testul (vector unsigned long long vul2, vector unsigned long long vul3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vul2, vul3, vuc);
+}
+
+/* { dg-final { scan-assembler-times "vperm" 3 } } */
--- /dev/null
+/* Verify that overloaded built-ins for vec_perm 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 pixel
+testpx (vector pixel px2, vector pixel px3, vector unsigned char vuc)
+{
+ return vec_perm (px2, px3, vuc);
+}
+
+/* { dg-final { scan-assembler-times "vperm" 1 } } */
--- /dev/null
+/* Verify that overloaded built-ins for vec_perm 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 bool short
+testbs (vector bool short vbs2, vector bool short vbs3,
+ vector unsigned char vuc)
+{
+ return vec_perm (vbs2, vbs3, vuc);
+}
+
+vector signed short
+testss (vector signed short vss2, vector signed short vss3, vector unsigned char vuc)
+{
+ return vec_perm (vss2, vss3, vuc);
+}
+
+vector unsigned short
+testus (vector unsigned short vus2, vector unsigned short vus3, vector unsigned char vuc)
+{
+ return vec_perm (vus2, vus3, vuc);
+}
+
+/* { dg-final { scan-assembler-times "vperm" 3 } } */