fold-vec-splats-char.c: New.

[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
This commit is contained in:
Will Schmidt 2017-10-10 16:26:03 +00:00 committed by Will Schmidt
parent 802b38c91f
commit 0ec8f0c6d6
6 changed files with 124 additions and 0 deletions

View 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

View file

@ -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 } } */

View file

@ -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 } } */

View file

@ -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 } } */

View file

@ -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 } } */

View file

@ -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 } } */