tree-optimization/104112 - add check for vect epilogue reduc reuse
authorRichard Biener <rguenther@suse.de>
Wed, 19 Jan 2022 11:31:30 +0000 (12:31 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 19 Jan 2022 13:55:15 +0000 (14:55 +0100)
commit5b6788ae5a365aecd6776f563e44022acb93a57a
treebee81495b90c4dc66434d00a6e3ffe311366d03c
parent68aa3c08ef1c33d9ad1263f4b939638920de9f11
tree-optimization/104112 - add check for vect epilogue reduc reuse

This adds a missing check for the availability of intermediate vector
types required to re-use the accumulator of a vectorized reduction
in the vectorized epilogue.  For SVE and VNx2DF vs V2DF with
-msve-vector-bits=512 for example V4DF is not available.

In addition to that we have to verify the reduction operation is
supported, otherwise we for example on i?86 get vector code that's
later decomposed again by vector lowering when trying to use
a V2HI epilogue for a V8HI reduction with a target without
TARGET_MMX_WITH_SSE.

It might be we want -Wvector-operation-performance for all vect.exp
tests but that seems to have existing regressions.

2022-01-19  Richard Biener  <rguenther@suse.de>

PR tree-optimization/104112
* tree-vect-loop.cc (vect_find_reusable_accumulator): Check
for required intermediate vector types.

* gcc.dg/vect/pr104112-1.c: New testcase.
* gcc.dg/vect/pr104112-2.c: New testcase.
gcc/testsuite/gcc.dg/vect/pr104112-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/pr104112-2.c [new file with mode: 0644]
gcc/tree-vect-loop.cc