]> git.ipfire.org Git - thirdparty/gcc.git/commit
vect: Reduce group size of consecutive strided accesses.
authorRobin Dapp <rdapp@ventanamicro.com>
Thu, 9 Oct 2025 15:25:59 +0000 (17:25 +0200)
committerRobin Dapp <rdapp@ventanamicro.com>
Mon, 10 Nov 2025 12:50:26 +0000 (13:50 +0100)
commit0f8bcacf6c4603cb7614aa23ef4a9568e46bddfa
tree28c7efa18c14691da1c553d149cfc93940854e23
parentbbd96065fa7e256d03c892d10813cfa4b3e609a8
vect: Reduce group size of consecutive strided accesses.

Consecutive load permutations like {0, 1, 2, 3} or {4, 5, 6, 7} in a
group of 8 only read a part of the group, leaving a gap.

For strided accesses we can elide the permutation and, instead of
accessing the whole group, use the number of SLP lanes.  This
effectively increases the vector size as we don't load gaps.  On top we
do not need to emit the permutes at all.

gcc/ChangeLog:

* tree-vect-slp.cc (vect_load_perm_consecutive_p): New function.
(vect_lower_load_permutations): Use.
(vect_optimize_slp_pass::remove_redundant_permutations): Use.
* tree-vect-stmts.cc (has_consecutive_load_permutation): New
function that uses vect_load_perm_consecutive_p.
(get_load_store_type): Use.
(vectorizable_load): Reduce group size.
* tree-vectorizer.h (struct vect_load_store_data): Add
subchain_p.
(vect_load_perm_consecutive_p): Declare.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr118019-2.c:
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr118019-2.c
gcc/tree-vect-slp.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h