From 0ec8f0c6d6288ed5cf4f22ea699798fb7f0e080e Mon Sep 17 00:00:00 2001 From: Will Schmidt Date: Tue, 10 Oct 2017 16:26:03 +0000 Subject: [PATCH] fold-vec-splats-char.c: New. [testsuite] 2017-10-10 Will Schmidt * 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 | 8 ++++++ .../gcc.target/powerpc/fold-vec-splats-char.c | 22 +++++++++++++++ .../powerpc/fold-vec-splats-floatdouble.c | 27 +++++++++++++++++++ .../gcc.target/powerpc/fold-vec-splats-int.c | 22 +++++++++++++++ .../powerpc/fold-vec-splats-longlong.c | 22 +++++++++++++++ .../powerpc/fold-vec-splats-short.c | 23 ++++++++++++++++ 6 files changed, 124 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c create mode 100644 gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c create mode 100644 gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c create mode 100644 gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c create mode 100644 gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9317e4df749..29b5277180e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2017-10-10 Will Schmidt + + * 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 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 index 00000000000..8f211537d28 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c @@ -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 + +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 index 00000000000..c4544f1a452 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c @@ -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 + +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 index 00000000000..66715233bc7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c @@ -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 + +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 index 00000000000..c5884ba88f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c @@ -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 + +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 index 00000000000..18102ac1254 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c @@ -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 + +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 } } */ + -- 2.30.2