]> git.ipfire.org Git - people/ms/gcc.git/commit
tree-optimization/108724 - vectorized code getting piecewise expanded
authorRichard Biener <rguenther@suse.de>
Fri, 10 Feb 2023 10:07:30 +0000 (11:07 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 15 Mar 2023 09:07:42 +0000 (10:07 +0100)
commit21e7145aaf582c263e69a3ee05dfa9d42bdbd1aa
treea69b50b8d18e380217228747518b1052a1cef99b
parente19e9c36abc7fff9c628cf744e55e4c0e686ea53
tree-optimization/108724 - vectorized code getting piecewise expanded

This fixes an oversight to when removing the hard limits on using
generic vectors for the vectorizer to enable both SLP and BB
vectorization to use those.  The vectorizer relies on vector lowering
to expand plus, minus and negate to bit operations but vector
lowering has a hard limit on the minimum number of elements per
work item.  Vectorizer costs for the testcase at hand work out
to vectorize a loop with just two work items per vector and that
causes element wise expansion and spilling.

The fix for now is to re-instantiate the hard limit, matching what
vector lowering does.  For the future the way to go is to emit the
lowered sequence directly from the vectorizer instead.

PR tree-optimization/108724
* tree-vect-stmts.cc (vectorizable_operation): Avoid
using word_mode vectors when vector lowering will
decompose them to elementwise operations.

* gcc.target/i386/pr108724.c: New testcase.

(cherry picked from commit dc87e1391c55c666c7ff39d4f0dea87666f25468)
gcc/testsuite/gcc.target/i386/pr108724.c [new file with mode: 0644]
gcc/tree-vect-stmts.cc