testsuite: Run vec_insert case on P8 and P9 with option specified
authorXionghu Luo <luoxhu@linux.ibm.com>
Fri, 29 Jan 2021 02:47:07 +0000 (20:47 -0600)
committerXionghu Luo <luoxhu@linux.ibm.com>
Fri, 29 Jan 2021 07:33:09 +0000 (01:33 -0600)
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.

gcc/testsuite/gcc.target/powerpc/pr79251-run.c [deleted file]
gcc/testsuite/gcc.target/powerpc/pr79251-run.p8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr79251-run.p9.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr79251.h
gcc/testsuite/gcc.target/powerpc/pr79251.p8.c
gcc/testsuite/gcc.target/powerpc/pr79251.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 (file)
index 6afd357..0000000
+++ /dev/null
@@ -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;
-}
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 (file)
index 0000000..47d4d28
--- /dev/null
@@ -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;
+}
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 (file)
index 0000000..fd56b23
--- /dev/null
@@ -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;
+}
index addb067f9ed8d13f93a0b8f61e85fda9adee4d47..2684b66096634775e352cfa1098742a085c301bb 100644 (file)
   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 ();                                                  \
+      }                                                                        \
+  }
+
index d31a905a013ce0bbbf4b46660634b8163675decb..77e8cbb55ccfc9f108b765f073d3e997525ffa85 100644 (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 } } } */
index 78abd80f447cff08e17f57086fc163634d81a00e..d4095d38319ef088cd55d4c617b25868d77beb23 100644 (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 } } } */