diff options
author | Andrew Stubbs <ams@baylibre.com> | 2025-07-28 13:58:03 +0000 |
---|---|---|
committer | Andrew Stubbs <ams@baylibre.com> | 2025-08-08 14:23:07 +0000 |
commit | 49cb093be7f293bbceb9c822ca3034c55bd95e4d (patch) | |
tree | 84897f797061cd557ac4947f72335b729ea494d9 /gcc/tree-if-conv.c | |
parent | 6847a222ba5f411584e20f5ed2e946ca19c9fcb4 (diff) | |
download | gcc-devel/omp/gcc-15.zip gcc-devel/omp/gcc-15.tar.gz gcc-devel/omp/gcc-15.tar.bz2 |
vect: Add target hook to prefer gather/scatter instructionsdevel/omp/gcc-15
For AMD GCN, the instructions available for loading/storing vectors are
always scatter/gather operations (i.e. there are separate addresses for
each vector lane), so the current heuristic to avoid gather/scatter
operations with too many elements in get_group_load_store_type is
counterproductive. Avoiding such operations in that function can
subsequently lead to a missed vectorization opportunity whereby later
analyses in the vectorizer try to use a very wide array type which is
not available on this target, and thus it bails out.
This patch adds a target hook to override the "single_element_p"
heuristic in the function as a target hook, and activates it for GCN. This
allows much better code to be generated for affected loops.
Co-authored-by: Julian Brown <julian@codesourcery.com>
gcc/
* doc/tm.texi.in (TARGET_VECTORIZE_PREFER_GATHER_SCATTER): Add
documentation hook.
* doc/tm.texi: Regenerate.
* target.def (prefer_gather_scatter): Add target hook under vectorizer.
* hooks.cc (hook_bool_mode_int_unsigned_false): New function.
* hooks.h (hook_bool_mode_int_unsigned_false): New prototype.
* tree-vect-stmts.cc (vect_use_strided_gather_scatters_p): Add
parameters group_size and single_element_p, and rework to use
targetm.vectorize.prefer_gather_scatter.
(get_group_load_store_type): Move some of the condition into
vect_use_strided_gather_scatters_p.
* config/gcn/gcn.cc (gcn_prefer_gather_scatter): New function.
(TARGET_VECTORIZE_PREFER_GATHER_SCATTER): Define hook.
(cherry picked from commit 36c5a7aa9a6dbaed07e3a2482c66743ddcb3e776)
Diffstat (limited to 'gcc/tree-if-conv.c')
0 files changed, 0 insertions, 0 deletions