On Thu, 31 Aug 2023, Robin Dapp wrote: > Hi, > > on some targets we fail to vectorize with the first type the vectorizer > tries but succeed with the second. This patch changes several regex > patterns to reflect that behavior. > > Before we would look for a single occurrence of e.g. > "vect_recog_dot_prod_pattern" but would possible find two (one for each > attempted mode). The new pattern tries to match sequences where we > first have a "vect_recog_dot_prod_pattern" and a "succeeded" afterwards > while making sure there is no "failed" or "Re-trying" in between. > > I realized we already only do scan-tree-dump instead of > scan-tree-dump-times in some related testcases, probably for the same > reason but I didn't touch them for now. > > Testsuite unchanged on x86, aarch64 and Power10.
LGTM. Thanks for discovering the required TCL regex magic. Richard. > Regards > Robin > > gcc/testsuite/ChangeLog: > > * gcc.dg/vect/vect-reduc-dot-s16a.c: Adjust regex pattern. > * gcc.dg/vect/vect-reduc-dot-s8a.c: Ditto. > * gcc.dg/vect/vect-reduc-dot-s8b.c: Ditto. > * gcc.dg/vect/vect-reduc-dot-u16a.c: Ditto. > * gcc.dg/vect/vect-reduc-dot-u16b.c: Ditto. > * gcc.dg/vect/vect-reduc-dot-u8a.c: Ditto. > * gcc.dg/vect/vect-reduc-dot-u8b.c: Ditto. > * gcc.dg/vect/vect-reduc-pattern-1a.c: Ditto. > * gcc.dg/vect/vect-reduc-pattern-1b-big-array.c: Ditto. > * gcc.dg/vect/vect-reduc-pattern-1c-big-array.c: Ditto. > * gcc.dg/vect/vect-reduc-pattern-2a.c: Ditto. > * gcc.dg/vect/vect-reduc-pattern-2b-big-array.c: Ditto. > * gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c: Ditto. > --- > gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c | 4 ++-- > gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c | 4 ++-- > gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c | 5 +++-- > gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c | 2 +- > gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c | 2 +- > gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c | 4 ++-- > 13 files changed, 18 insertions(+), 17 deletions(-) > > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c > index ffbc9706901..d826828e3d6 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c > @@ -51,7 +51,7 @@ main (void) > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_sdot_hi } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_widen_mult_hi_to_si } } } */ > > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c > index 05e343ad782..4e1e0b234f4 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c > @@ -55,8 +55,8 @@ int main (void) > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" } } */ > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_sdot_qi } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > { vect_widen_mult_qi_to_hi && vect_widen_sum_hi_to_si } } } } */ > > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c > index 82c648cc73c..cb88ad5b639 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c > @@ -53,8 +53,8 @@ int main (void) > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" { xfail *-*-* } } } */ > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" { xfail *-*-* } } } > */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_widen_mult_qi_to_hi } } } */ > > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c > index 4bf4a1e3c2c..9adb23a32f6 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c > @@ -37,6 +37,7 @@ int main (void) > for (i=0; i<N; i++) { > X[i] = i; > Y[i] = 64-i; > + __asm__ volatile (""); > } > > dot1 = foo1 (N); > @@ -47,5 +48,5 @@ int main (void) > } > > /* The initialization loop in main also gets vectorized. */ > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" { xfail *-*-* } } } */ > -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target > { vect_short_mult && vect_widen_sum_hi_to_si } } } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" { xfail *-*-* } } } > */ > +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > { vect_short_mult && vect_widen_sum_hi_to_si } } } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c > index 0fc112012cf..be9ed905b00 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c > @@ -46,6 +46,6 @@ int main (void) > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > { vect_pack_trunc || vect_udot_hi } } } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c > index e23ebd9b072..969cdafe4a7 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c > @@ -53,7 +53,7 @@ int main (void) > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_udot_qi } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > { vect_widen_mult_qi_to_hi && vect_widen_sum_qi_to_si } } } } */ > > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c > index 288be13440d..35627ba4d53 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c > @@ -45,7 +45,7 @@ int main (void) > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > > /* When the vectorizer is enhanced to vectorize accumulation into short for > targets that support accumulation into int (powerpc, ia64) we'd have: > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c > index 1ddbe96ebc3..eef8b8d29b6 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c > @@ -41,6 +41,6 @@ main (void) > return foo (); > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_widen_sum_hi_to_si } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target > { ! vect_widen_sum_hi_to_si } } } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c > index 7ae2c838344..561ed00c77f 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c > @@ -41,6 +41,6 @@ main (void) > return foo (); > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > { vect_widen_sum_qi_to_si || vect_unpack } } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target > { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c > index 91ce0ef934e..cdccd1a3202 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c > @@ -41,6 +41,6 @@ main (void) > return foo (); > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_widen_sum_qi_to_hi } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target > { ! vect_widen_sum_qi_to_hi } } } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c > index 2190eaa6242..3f23cb859e5 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2a.c > @@ -41,6 +41,6 @@ main (void) > return foo (); > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_widen_sum_hi_to_si } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target > { ! vect_widen_sum_hi_to_si } } } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c > b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c > index 6ad645b3bdd..c69a8896e5e 100644 > --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c > @@ -42,6 +42,6 @@ main (void) > return foo (); > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > { vect_widen_sum_qi_to_si && vect_unpack } } } } */ > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target > { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */ > diff --git a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c > b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c > index 6fc7a282351..751352649ce 100644 > --- a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c > +++ b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c > @@ -46,8 +46,8 @@ int main (void) > return 0; > } > > -/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" > 1 "vect" } } */ > -/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: > detected" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > +/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: > detected(?:(?!failed)(?!Re-trying).)*succeeded" 1 "vect" } } */ > > /* When vectorizer is enhanced to vectorize accumulation into short for > targets > that support accumulation into int (e.g. ia64) we'd have: > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)