Four of these tests ask for vect_int from gcc.dg/tree-ssa, and the fifth,
minmax-swar-5.c, needs the same guard. The flags those selectors are
answered under come from vect.exp, which is also what adds -msse2,
-maltivec or the NEON options and what skips a target that cannot
vectorize at all. Move all five there, keep the requirement, and drop the
ia32 option line vect.exp supplies itself.
The rules ask target_supports_op_p for the vector MIN_EXPR, so the vector
spelling folds only where the target has one: on cortex-m0 all six
functions of minmax-swar-5.c stop at VEC_COND_EXPR. The two tests that
assume a 16-byte vector gate their scans on vect128, and the widths come
from sizeof.
Tested on x86_64-pc-linux-gnu and aarch64-linux-gnu, and with an
arm-none-eabi cross on cortex-a15 NEON and cortex-m0 soft.
Assisted-by: Claude Opus 5 (Anthropic)
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/minmax-swar-5.c: Move to...
* gcc.dg/vect/minmax-swar-5.c: ...here. Require vect_int, take the
flags from vect.exp, size the vector with sizeof and gate the scans.
* gcc.dg/tree-ssa/minmax-swar-6.c: Move to...
* gcc.dg/vect/minmax-swar-6.c: ...here. Take the flags from vect.exp.
* gcc.dg/tree-ssa/minmax-swar-7.c: Move to...
* gcc.dg/vect/minmax-swar-7.c: ...here. Likewise.
* gcc.dg/tree-ssa/minmax-negate-3.c: Move to...
* gcc.dg/vect/minmax-negate-3.c: ...here. Likewise.
* gcc.dg/tree-ssa/vector-alignup-1.c: Move to...
* gcc.dg/vect/vector-alignup-1.c: ...here. Likewise, size the
vectors with sizeof and gate the scans.
Signed-off-by: Dominic P <[email protected]>
---
.../gcc.dg/tree-ssa/vector-alignup-1.c | 16 ------------
.../{tree-ssa => vect}/minmax-negate-3.c | 3 +--
.../gcc.dg/{tree-ssa => vect}/minmax-swar-5.c | 25 +++++++++++--------
.../gcc.dg/{tree-ssa => vect}/minmax-swar-6.c | 3 +--
.../gcc.dg/{tree-ssa => vect}/minmax-swar-7.c | 3 +--
gcc/testsuite/gcc.dg/vect/vector-alignup-1.c | 15 +++++++++++
6 files changed, 32 insertions(+), 33 deletions(-)
delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/vector-alignup-1.c
rename gcc/testsuite/gcc.dg/{tree-ssa => vect}/minmax-negate-3.c (92%)
rename gcc/testsuite/gcc.dg/{tree-ssa => vect}/minmax-swar-5.c (55%)
rename gcc/testsuite/gcc.dg/{tree-ssa => vect}/minmax-swar-6.c (92%)
rename gcc/testsuite/gcc.dg/{tree-ssa => vect}/minmax-swar-7.c (89%)
create mode 100644 gcc/testsuite/gcc.dg/vect/vector-alignup-1.c
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vector-alignup-1.c
b/gcc/testsuite/gcc.dg/tree-ssa/vector-alignup-1.c
deleted file mode 100644
index 5b32c668710..00000000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/vector-alignup-1.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
-/* { dg-additional-options "-msse2" { target ia32 } } */
-
-/* Rounding up by adding the padding, spelled with vectors. */
-
-typedef unsigned int v4ui __attribute__((vector_size (16)));
-typedef int v4si __attribute__((vector_size (16)));
-
-v4ui f1 (v4ui x) { return x + ((-x) & 15); }
-v4si f2 (v4si x) { return x + ((-x) & 63); }
-
-/* { dg-final { scan-tree-dump-not "= -" "optimized" } } */
-/* { dg-final { scan-tree-dump-times " \\+ " 2 "optimized" } } */
-/* { dg-final { scan-tree-dump-times " & " 2 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-negate-3.c
b/gcc/testsuite/gcc.dg/vect/minmax-negate-3.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/tree-ssa/minmax-negate-3.c
rename to gcc/testsuite/gcc.dg/vect/minmax-negate-3.c
index 562e76bfde9..cea581a5daf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/minmax-negate-3.c
+++ b/gcc/testsuite/gcc.dg/vect/minmax-negate-3.c
@@ -1,7 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O3 -fdump-tree-optimized" } */
-/* { dg-additional-options "-msse2" { target ia32 } } */
+/* { dg-additional-options "-fdump-tree-optimized" } */
/* The rule reaching vector code. It matches the scalar loop body, so what is
left to vectorize is a vector MAX or MIN of the unnegated loads and a vector
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-5.c
b/gcc/testsuite/gcc.dg/vect/minmax-swar-5.c
similarity index 55%
rename from gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-5.c
rename to gcc/testsuite/gcc.dg/vect/minmax-swar-5.c
index 931d5a0d741..9ab595e36d8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-5.c
+++ b/gcc/testsuite/gcc.dg/vect/minmax-swar-5.c
@@ -1,14 +1,17 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Wno-psabi -fdump-tree-forwprop1-raw" } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-Wno-psabi -fdump-tree-forwprop1-raw" } */
/* All six rules on a vector type. The selects against zero are spelled with
- >, not <: a vector x < 0 is canonicalised to the sign mask x >> 31, and the
- rule that turns x & (x >> 31) into MIN <x, 0> is scalar, so that spelling
- forms no vector MIN_EXPR at all. The scan is on forwprop1, which runs
- before the vector lowering that would split a MAX_EXPR the target cannot
- do. */
+ >, not <: a vector x < 0 is canonicalised to the sign mask
+ x >> (precision - 1), and the rule that turns x & (x >> (precision - 1))
+ into MIN <x, 0> is scalar, so that spelling forms no vector MIN_EXPR at
+ all. The scan is on forwprop1, which runs before the vector lowering that
+ would split a MAX_EXPR the target cannot do. The rules ask
+ target_supports_op_p for the vector MIN_EXPR, hence the selector on the
+ scans. */
-typedef int v4si __attribute__ ((vector_size (16)));
+typedef int v4si __attribute__ ((vector_size (4 * sizeof (int))));
/* Y + MIN (X - Y, 0) -> MIN (X, Y). */
v4si
@@ -64,7 +67,7 @@ clamp_hi_vec (v4si x, v4si y)
return ((s & m) | (y & ~m)) - y;
}
-/* { dg-final { scan-tree-dump-not "<plus_expr," "forwprop1" } } */
-/* { dg-final { scan-tree-dump-not "<minus_expr," "forwprop1" } } */
-/* { dg-final { scan-tree-dump-times "<min_expr," 3 "forwprop1" } } */
-/* { dg-final { scan-tree-dump-times "<max_expr," 3 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-not "<plus_expr," "forwprop1" { target {
vect128 && { ! vect_no_int_min_max } } } } } */
+/* { dg-final { scan-tree-dump-not "<minus_expr," "forwprop1" { target {
vect128 && { ! vect_no_int_min_max } } } } } */
+/* { dg-final { scan-tree-dump-times "<min_expr," 3 "forwprop1" { target {
vect128 && { ! vect_no_int_min_max } } } } } */
+/* { dg-final { scan-tree-dump-times "<max_expr," 3 "forwprop1" { target {
vect128 && { ! vect_no_int_min_max } } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-6.c
b/gcc/testsuite/gcc.dg/vect/minmax-swar-6.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-6.c
rename to gcc/testsuite/gcc.dg/vect/minmax-swar-6.c
index 4f096a00229..fc17027ff70 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-6.c
+++ b/gcc/testsuite/gcc.dg/vect/minmax-swar-6.c
@@ -1,7 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O3 -fdump-tree-optimized" } */
-/* { dg-additional-options "-msse2" { target ia32 } } */
+/* { dg-additional-options "-fdump-tree-optimized" } */
/* The two difference pairs reaching vector code through the loop vectorizer:
the fold is on the scalar loop body, so what is left to vectorize is a
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-7.c
b/gcc/testsuite/gcc.dg/vect/minmax-swar-7.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-7.c
rename to gcc/testsuite/gcc.dg/vect/minmax-swar-7.c
index 125fcb3016c..e70fc309176 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/minmax-swar-7.c
+++ b/gcc/testsuite/gcc.dg/vect/minmax-swar-7.c
@@ -1,7 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O3 -fdump-tree-optimized" } */
-/* { dg-additional-options "-msse2" { target ia32 } } */
+/* { dg-additional-options "-fdump-tree-optimized" } */
/* MINMAX (X + Y, Y) - Y through the loop vectorizer: the vector add and the
vector subtract both go, leaving the clamp against zero. */
diff --git a/gcc/testsuite/gcc.dg/vect/vector-alignup-1.c
b/gcc/testsuite/gcc.dg/vect/vector-alignup-1.c
new file mode 100644
index 00000000000..dd69d1f1eed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vector-alignup-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-fdump-tree-optimized" } */
+
+/* Rounding up by adding the padding, spelled with vectors. */
+
+typedef unsigned int v4ui __attribute__((vector_size (4 * sizeof (int))));
+typedef int v4si __attribute__((vector_size (4 * sizeof (int))));
+
+v4ui f1 (v4ui x) { return x + ((-x) & 15); }
+v4si f2 (v4si x) { return x + ((-x) & 63); }
+
+/* { dg-final { scan-tree-dump-not "= -" "optimized" { target vect128 } } } */
+/* { dg-final { scan-tree-dump-times " \\+ " 2 "optimized" { target vect128 }
} } */
+/* { dg-final { scan-tree-dump-times " & " 2 "optimized" { target vect128 } }
} */
--
2.55.0