Hi All,
This patch stores the SLP instance kind in the SLP instance so that we can use
it later when detecting load/store lanes support.
This also changes the load/store lane support check to only check if the SLP
kind is a store. This means that in order for the load/lanes to work all
instances must be of kind store.
Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
Ok for master?
Thanks,
Tamar
gcc/ChangeLog:
* tree-vect-loop.c (vect_analyze_loop_2): Check kind.
* tree-vect-slp.c (vect_build_slp_instance): New.
(enum slp_instance_kind): Move to...
* tree-vectorizer.h (enum slp_instance_kind): .. Here
(SLP_INSTANCE_KIND): New.
--
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index c9de82b35bee123a93847dc1e79280ebc3d81893..1a6f52e6a261ebbfae6c2d7760232e341389ab4d 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2394,6 +2394,7 @@ start_over:
/* If the loads and stores can be handled with load/store-lane
instructions record it and move on to the next instance. */
if (loads_permuted
+ && SLP_INSTANCE_KIND (instance) == slp_inst_kind_store
&& vect_store_lanes_supported (vectype, group_size, false))
{
FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), i, load_node)
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index d498cd466eb7e8d98230f6b662437cf4fa312f27..420c3c93374b788d96779bf0b730d1bc47a98f58 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2171,13 +2171,6 @@ calculate_unrolling_factor (poly_uint64 nunits, unsigned int group_size)
return exact_div (common_multiple (nunits, group_size), group_size);
}
-enum slp_instance_kind {
- slp_inst_kind_store,
- slp_inst_kind_reduc_group,
- slp_inst_kind_reduc_chain,
- slp_inst_kind_ctor
-};
-
static bool
vect_analyze_slp_instance (vec_info *vinfo,
scalar_stmts_to_slp_tree_map_t *bst_map,
@@ -2253,6 +2246,7 @@ vect_build_slp_instance (vec_info *vinfo,
SLP_INSTANCE_UNROLLING_FACTOR (new_instance) = unrolling_factor;
SLP_INSTANCE_LOADS (new_instance) = vNULL;
SLP_INSTANCE_ROOT_STMT (new_instance) = root_stmt_info;
+ SLP_INSTANCE_KIND (new_instance) = kind;
new_instance->reduc_phis = NULL;
new_instance->cost_vec = vNULL;
new_instance->subgraph_entries = vNULL;
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index fbf5291cf065f3944040937db92d3997acd45f23..26988f78143621dc9f21698b105127c88f9b0212 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -174,6 +174,15 @@ struct _slp_tree {
static void operator delete (void *, size_t);
};
+/* The enum describes the type of operations that an SLP instance
+ can perform. */
+
+enum slp_instance_kind {
+ slp_inst_kind_store,
+ slp_inst_kind_reduc_group,
+ slp_inst_kind_reduc_chain,
+ slp_inst_kind_ctor
+};
/* SLP instance is a sequence of stmts in a loop that can be packed into
SIMD stmts. */
@@ -202,6 +211,9 @@ public:
entries into the same subgraph, including itself. */
vec<_slp_instance *> subgraph_entries;
+ /* The type of operation the SLP instance is performing. */
+ slp_instance_kind kind;
+
dump_user_location_t location () const;
} *slp_instance;
@@ -211,6 +223,7 @@ public:
#define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
#define SLP_INSTANCE_LOADS(S) (S)->loads
#define SLP_INSTANCE_ROOT_STMT(S) (S)->root_stmt
+#define SLP_INSTANCE_KIND(S) (S)->kind
#define SLP_TREE_CHILDREN(S) (S)->children
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts