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.
+++ /dev/null
-/* { 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;
-}
--- /dev/null
+/* { 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;
+}
--- /dev/null
+/* { 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;
+}
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 (); \
+ } \
+ }
+
#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 } } } */
#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 } } } */