]> git.ipfire.org Git - thirdparty/gcc.git/commit
Record gather/scatter scale and base in the SLP tree
authorRichard Biener <rguenther@suse.de>
Mon, 4 Aug 2025 09:27:54 +0000 (11:27 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 6 Aug 2025 13:17:04 +0000 (15:17 +0200)
commit79e4f386ad836b7f9e1bdaf6aded4585035432ef
tree7af5bcb2e7fee9515c7b63169bf76cbc4c432c5f
parent3da5038ed58578d3373d5d5e371d6a15b172b201
Record gather/scatter scale and base in the SLP tree

The main gather/scatter discovery happens at SLP discovery time,
the base address and the offset scale are currently not explicitly
represented in the SLP tree.  This requires re-discovery of them
during vectorizable_store/load.  The following fixes this by
recording this info into the SLP tree.  This allows the main
vect_check_gather_scatter call to be elided from get_load_store_type
and replaced with target support checks for IFN/decl or fallback
emulated mode.

There's vect_check_gather_scatter left in the path using gather/scatter
for strided load/store.  I hope to deal with this later.

* tree-vectorizer.h (_slp_tree::gs_scale): New.
(_slp_tree::gs_base): Likewise.
(SLP_TREE_GS_SCALE): Likewise.
(SLP_TREE_GS_BASE): Likewise.
(vect_describe_gather_scatter_call): Declare.
* tree-vect-slp.cc (_slp_tree::_slp_tree): Initialize
new members.
(vect_build_slp_tree_2): Record gather/scatter base and scale.
(vect_get_and_check_slp_defs): For gather/scatter IFNs
describe the call to first_gs_info.
* tree-vect-data-refs.cc (vect_gather_scatter_fn_p): Add
mode of operation with fixed offset vector type.
(vect_describe_gather_scatter_call): Export.
* tree-vect-stmts.cc (get_load_store_type): Do not call
vect_check_gather_scatter to fill gs_info, instead populate
from the SLP tree.  Check which of, IFN, decl or fallback
is supported and record that decision.
gcc/tree-vect-data-refs.cc
gcc/tree-vect-slp.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h