diff options
author | Richard Biener <rguenther@suse.de> | 2023-08-07 14:44:20 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-08-08 14:38:10 +0200 |
commit | d9f3ea61fe36e2de3354b90b65ff8245099114c9 (patch) | |
tree | 8907ce57966ceca77a774965c78cc2df4fd9b7be /gcc/tree-vectorizer.h | |
parent | 02a015fa320229a057ef721eaf663f3eb22a8ace (diff) | |
download | gcc-d9f3ea61fe36e2de3354b90b65ff8245099114c9.zip gcc-d9f3ea61fe36e2de3354b90b65ff8245099114c9.tar.gz gcc-d9f3ea61fe36e2de3354b90b65ff8245099114c9.tar.bz2 |
tree-optimization/49955 - BB reduction with odd number of lanes
The following enhances BB reduction vectorization to support
vectorizing only a subset of the lanes, keeping the rest as
scalar ops. For now we try to make the number of lanes even
by leaving alone the "last" lane. That's because SLP discovery
with all lanes will fail too soon to get us any hint on which
lane to strip and likewise we don't know what vector modes the
target supports so restricting ourselves to power-of-two or
other cases isn't easy.
This is enough to get at the vectorization opportunity for the
testcase in the PR - albeit with the chosen lanes not optimal
but at least vectorizable.
PR tree-optimization/49955
* tree-vectorizer.h (_slp_instance::remain_stmts): New.
(SLP_INSTANCE_REMAIN_STMTS): Likewise.
* tree-vect-slp.cc (vect_free_slp_instance): Release
SLP_INSTANCE_REMAIN_STMTS.
(vect_build_slp_instance): Make the number of lanes of
a BB reduction even.
(vectorize_slp_instance_root_stmt): Handle unvectorized
defs of a BB reduction.
* gfortran.dg/vect/pr49955.f: New testcase.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index a651614..dea29a7 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -257,6 +257,10 @@ public: from, NULL otherwise. */ vec<stmt_vec_info> root_stmts; + /* For slp_inst_kind_bb_reduc the defs that were not vectorized, NULL + otherwise. */ + vec<stmt_vec_info> remain_stmts; + /* The unrolling factor required to vectorized this SLP instance. */ poly_uint64 unrolling_factor; @@ -285,6 +289,7 @@ public: #define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor #define SLP_INSTANCE_LOADS(S) (S)->loads #define SLP_INSTANCE_ROOT_STMTS(S) (S)->root_stmts +#define SLP_INSTANCE_REMAIN_STMTS(S) (S)->remain_stmts #define SLP_INSTANCE_KIND(S) (S)->kind #define SLP_TREE_CHILDREN(S) (S)->children |