From 280a59d9211b36f8ddb8ca18e8dcba29643ca5da Mon Sep 17 00:00:00 2001 From: Xionghu Luo Date: Thu, 28 Jan 2021 20:47:07 -0600 Subject: [PATCH] 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 * 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. --- .../gcc.target/powerpc/pr79251-run.c | 30 ------------------- .../gcc.target/powerpc/pr79251-run.p8.c | 14 +++++++++ .../gcc.target/powerpc/pr79251-run.p9.c | 14 +++++++++ gcc/testsuite/gcc.target/powerpc/pr79251.h | 17 +++++++++++ gcc/testsuite/gcc.target/powerpc/pr79251.p8.c | 2 -- gcc/testsuite/gcc.target/powerpc/pr79251.p9.c | 2 -- 6 files changed, 45 insertions(+), 34 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/powerpc/pr79251-run.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr79251-run.p8.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr79251-run.p9.c diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251-run.c b/gcc/testsuite/gcc.target/powerpc/pr79251-run.c deleted file mode 100644 index 6afd357c7ba..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr79251-run.c +++ /dev/null @@ -1,30 +0,0 @@ -/* { dg-do run } */ -/* { dg-require-effective-target vsx_hw } */ -/* { dg-options "-O2 -mvsx" } */ - -#include -#include -#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; -} diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251-run.p8.c b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p8.c new file mode 100644 index 00000000000..47d4d288f3c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p8.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-require-effective-target p8vector_hw } */ +/* { dg-options "-O2 -mvsx -mdejagnu-cpu=power8" } */ + +#include +#include +#include "pr79251.h" + +int +main (void) +{ + TEST_VEC_INSERT_ALL (run_test) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251-run.p9.c b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p9.c new file mode 100644 index 00000000000..fd56b2356f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p9.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-O2 -mvsx -mdejagnu-cpu=power9" } */ + +#include +#include +#include "pr79251.h" + +int +main (void) +{ + TEST_VEC_INSERT_ALL (run_test) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.h b/gcc/testsuite/gcc.target/powerpc/pr79251.h index addb067f9ed..2684b660966 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr79251.h +++ b/gcc/testsuite/gcc.target/powerpc/pr79251.h @@ -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 (); \ + } \ + } + diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c index d31a905a013..77e8cbb55cc 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c +++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c @@ -6,8 +6,6 @@ #include #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 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c index 78abd80f447..d4095d38319 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c +++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c @@ -6,8 +6,6 @@ #include #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 } } } */