Split gcc.dg/pr123109.c into scalar and vector parts as suggested by Jakub.

gcc/testsuite/ChangeLog:

        * gcc.dg/pr123109.c: Move to...
        * gcc.dg/pr123109-vector.c: ...here.
        * gcc.dg/pr123109-scalar.c: New test.

Signed-off-by: Pengxuan Zheng <[email protected]>
---
 .../gcc.dg/{pr123109.c => pr123109-scalar.c}  | 12 ++---------
 gcc/testsuite/gcc.dg/pr123109-vector.c        | 21 +++++++++++++++++++
 2 files changed, 23 insertions(+), 10 deletions(-)
 rename gcc/testsuite/gcc.dg/{pr123109.c => pr123109-scalar.c} (54%)
 create mode 100644 gcc/testsuite/gcc.dg/pr123109-vector.c

diff --git a/gcc/testsuite/gcc.dg/pr123109.c 
b/gcc/testsuite/gcc.dg/pr123109-scalar.c
similarity index 54%
rename from gcc/testsuite/gcc.dg/pr123109.c
rename to gcc/testsuite/gcc.dg/pr123109-scalar.c
index 0d51863ca40..dda903a2cee 100644
--- a/gcc/testsuite/gcc.dg/pr123109.c
+++ b/gcc/testsuite/gcc.dg/pr123109-scalar.c
@@ -1,9 +1,6 @@
-/* { dg-do compile { target { x86_64-*-* aarch64-*-* } } } */
+/* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-optimized" } */
 
-typedef int v4si __attribute__((vector_size(4 * sizeof(int))));
-typedef unsigned int v4usi __attribute__((vector_size(4 * sizeof(unsigned 
int))));
-
 #define TEST_NE(type)                                         \
   type test_ne_##type (type a) { return (a >> 31) != 0; }
 
@@ -12,14 +9,9 @@ typedef unsigned int v4usi __attribute__((vector_size(4 * 
sizeof(unsigned int)))
 
 TEST_NE(int)
 TEST_NE(unsigned)
-TEST_NE(v4si)
-TEST_NE(v4usi)
 TEST_EQ(int)
 TEST_EQ(unsigned)
-TEST_EQ(v4si)
-TEST_EQ(v4usi)
 
 /* { dg-final { scan-tree-dump-times ">= 0" 2 optimized } } */
 /* { dg-final { scan-tree-dump-times "< 0" 2 optimized } } */
-/* { dg-final { scan-tree-dump-times ">= { 0, 0, 0, 0 }" 2 optimized } } */
-/* { dg-final { scan-tree-dump-times ">> 31" 2 optimized } } */
+
diff --git a/gcc/testsuite/gcc.dg/pr123109-vector.c 
b/gcc/testsuite/gcc.dg/pr123109-vector.c
new file mode 100644
index 00000000000..35a0f2eff62
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr123109-vector.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-Wno-psabi -O2 -fdump-tree-forwprop2" } */
+/* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
+
+typedef int v4si __attribute__((vector_size(4 * sizeof(int))));
+typedef unsigned int v4usi __attribute__((vector_size(4 * sizeof(unsigned 
int))));
+
+#define TEST_NE(type)                                         \
+  type test_ne_##type (type a) { return (a >> 31) != 0; }
+
+#define TEST_EQ(type)                                         \
+  type test_eq_##type (type a) { return (a >> 31) == 0; }
+
+TEST_NE(v4si)
+TEST_NE(v4usi)
+TEST_EQ(v4si)
+TEST_EQ(v4usi)
+
+/* { dg-final { scan-tree-dump-times ">= { 0, 0, 0, 0 }" 2 forwprop2 } } */
+/* "a < 0 ? -1 : 0" will be optimized to "a >> 31" only if there's an optab.  
*/
+/* { dg-final { scan-tree-dump-times ">> 31" 2 forwprop2 { target { i?86-*-* 
x86_64-*-* aarch64-*-* } } } } */
-- 
2.34.1

Reply via email to