vect: Fix mask handling for SLP gathers [PR103761]
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 6 Apr 2022 07:56:07 +0000 (08:56 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 6 Apr 2022 07:56:07 +0000 (08:56 +0100)
commitd037d9ad323ec9eef3e50c6e2cbc1e31191daa5d
tree0be7d39ffefc8d74f893438bd6d011711a2ff925
parentf0d29224558e1d625a3d0d13019e2059c56f5b82
vect: Fix mask handling for SLP gathers [PR103761]

check_load_store_for_partial_vectors predates the support for SLP
gathers and so had a hard-coded assumption that gathers/scatters
(and load/stores lanes) would be non-SLP operations.  This patch
passes down the slp_node so that the routine can work out how
many vectors are needed in both the SLP and non-SLP cases.

gcc/
PR tree-optimization/103761
* tree-vect-stmts.cc (check_load_store_for_partial_vectors): Replace
the ncopies parameter with an slp_node parameter.  Calculate the
number of vectors based on it and vectype.  Rename lambda to
group_memory_nvectors.
(vectorizable_store, vectorizable_load): Update calls accordingly.

gcc/testsuite/
PR tree-optimization/103761
* gcc.dg/vect/pr103761.c: New test.
* gcc.target/aarch64/sve/pr103761.c: Likewise.
gcc/testsuite/gcc.dg/vect/pr103761.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pr103761.c [new file with mode: 0644]
gcc/tree-vect-stmts.cc