https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118019
--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Robin Dapp <[email protected]>: https://gcc.gnu.org/g:85ab3a22ed11c948aa0c4885f1e710f94ef5cd0f commit r16-4391-g85ab3a22ed11c948aa0c4885f1e710f94ef5cd0f Author: Robin Dapp <[email protected]> Date: Fri Sep 5 16:19:18 2025 +0200 vect: Handle grouped accesses via gather/scatter. This patch adds gather/scatter handling for grouped access. The idea is to e.g. replace an access (for uint8_t elements) like arr[0] arr[1] arr[2] arr[3] arr[0 + step] arr[1 + step] ... by gather loads of uint32_t arr[0..3] arr[0 + step * 1..3 + step * 1] arr[0 + step * 2..3 + step * 2] ... where the offset vector is a simple series with step STEP. If supported, such a gather can be implemented as a strided load. If we have a masked access the transformation is not performed. Masking could still be done after converting the data back to the original vectype but it does not seem worth it for now. PR target/118019 gcc/ChangeLog: * internal-fn.cc (get_supported_else_vals): Exit at invalid index. (internal_strided_fn_supported_p): New funtion. * internal-fn.h (internal_strided_fn_supported_p): Declare. * tree-vect-stmts.cc (vector_vector_composition_type): Add vector_only argument. (vect_use_grouped_gather): New function. (vect_get_store_rhs): Adjust docs of vector_vector_composition_type. (get_load_store_type): Try grouped gather. (vectorizable_store): Use punned vectype. (vectorizable_load): Ditto. * tree-vectorizer.h (struct vect_load_store_data): Add punned vectype. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr118019-2.c: New test.
