testsuite: Run vec_insert case on P8 and P9 with option specified

Move run_test and TEST_VEC_INSERT_ALL to header file for share usage.

gcc/testsuite/ChangeLog:

2021-01-29  Xionghu Luo  <luoxhu@linux.ibm.com>

	* gcc.target/powerpc/pr79251.p8.c: Move TEST_VEC_INSERT_ALL
	to ...
	* gcc.target/powerpc/pr79251.h: ...this.
	* gcc.target/powerpc/pr79251.p9.c: Likewise.
	* gcc.target/powerpc/pr79251-run.c: Move run_test to pr79251.h.
	Rename to...
	* gcc.target/powerpc/pr79251-run.p8.c: ...this.
	* gcc.target/powerpc/pr79251-run.p9.c: New test.
This commit is contained in:
Xionghu Luo 2021-01-28 20:47:07 -06:00
parent f8f5388c9e
commit 280a59d921
6 changed files with 45 additions and 34 deletions

View File

@ -1,30 +0,0 @@
/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
#include <stddef.h>
#include <altivec.h>
#include "pr79251.h"
TEST_VEC_INSERT_ALL (test)
#define run_test(TYPE, num) \
{ \
vector TYPE v; \
vector TYPE u = {0x0}; \
for (long k = 0; k < 16 / sizeof (TYPE); k++) \
v[k] = 0xaa; \
for (long k = 0; k < 16 / sizeof (TYPE); k++) \
{ \
u = test##num (v, 254, k); \
if (u[k] != (TYPE) 254) \
__builtin_abort (); \
} \
}
int
main (void)
{
TEST_VEC_INSERT_ALL (run_test)
return 0;
}

View File

@ -0,0 +1,14 @@
/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-O2 -mvsx -mdejagnu-cpu=power8" } */
#include <stddef.h>
#include <altivec.h>
#include "pr79251.h"
int
main (void)
{
TEST_VEC_INSERT_ALL (run_test)
return 0;
}

View File

@ -0,0 +1,14 @@
/* { dg-do run } */
/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-O2 -mvsx -mdejagnu-cpu=power9" } */
#include <stddef.h>
#include <altivec.h>
#include "pr79251.h"
int
main (void)
{
TEST_VEC_INSERT_ALL (run_test)
return 0;
}

View File

@ -17,3 +17,20 @@
T (unsigned long long, 7) \
T (float, 8) \
T (double, 9)
TEST_VEC_INSERT_ALL (test)
#define run_test(TYPE, num) \
{ \
vector TYPE v; \
vector TYPE u = {0x0}; \
for (long k = 0; k < 16 / sizeof (TYPE); k++) \
v[k] = 0xaa; \
for (long k = 0; k < 16 / sizeof (TYPE); k++) \
{ \
u = test##num (v, 254, k); \
if (u[k] != (TYPE) 254) \
__builtin_abort (); \
} \
}

View File

@ -6,8 +6,6 @@
#include <altivec.h>
#include "pr79251.h"
TEST_VEC_INSERT_ALL (test)
/* { dg-final { scan-assembler-not {\mstxw\M} } } */
/* { dg-final { scan-assembler-times {\mlvsl\M} 10 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mlvsr\M} 3 { target lp64 } } } */

View File

@ -6,8 +6,6 @@
#include <altivec.h>
#include "pr79251.h"
TEST_VEC_INSERT_ALL (test)
/* { dg-final { scan-assembler-not {\mstxw\M} } } */
/* { dg-final { scan-assembler-times {\mlvsl\M} 10 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mlvsr\M} 10 { target lp64 } } } */