Commit 1c5d68a6 by Richard Sandiford Committed by Richard Sandiford

Make vect_get_mask_type_for_stmt take a group size

This patch makes vect_get_mask_type_for_stmt and
get_mask_type_for_scalar_type take a group size instead of
the SLP node, so that later patches can call it before an
SLP node has been built.

2019-11-29  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.h (get_mask_type_for_scalar_type): Replace
	the slp_tree parameter with a group size parameter.
	(vect_get_mask_type_for_stmt): Likewise.
	* tree-vect-stmts.c (get_mask_type_for_scalar_type): Likewise.
	(vect_get_mask_type_for_stmt): Likewise.
	* tree-vect-slp.c (vect_slp_analyze_node_operations_1): Update
	call accordingly.

From-SVN: r278849
parent 4177e933
2019-11-29 Richard Sandiford <richard.sandiford@arm.com> 2019-11-29 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (get_mask_type_for_scalar_type): Replace
the slp_tree parameter with a group size parameter.
(vect_get_mask_type_for_stmt): Likewise.
* tree-vect-stmts.c (get_mask_type_for_scalar_type): Likewise.
(vect_get_mask_type_for_stmt): Likewise.
* tree-vect-slp.c (vect_slp_analyze_node_operations_1): Update
call accordingly.
2019-11-29 Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-stmts.c (vectorizable_operation): Punt early * tree-vect-stmts.c (vectorizable_operation): Punt early
on codes that are handled elsewhere. on codes that are handled elsewhere.
...@@ -2757,7 +2757,8 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node, ...@@ -2757,7 +2757,8 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info); bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
if (bb_vinfo && STMT_VINFO_VECTYPE (stmt_info) == boolean_type_node) if (bb_vinfo && STMT_VINFO_VECTYPE (stmt_info) == boolean_type_node)
{ {
tree vectype = vect_get_mask_type_for_stmt (stmt_info, node); unsigned int group_size = SLP_TREE_SCALAR_STMTS (node).length ();
tree vectype = vect_get_mask_type_for_stmt (stmt_info, group_size);
if (!vectype) if (!vectype)
/* vect_get_mask_type_for_stmt has already explained the /* vect_get_mask_type_for_stmt has already explained the
failure. */ failure. */
......
...@@ -11323,14 +11323,15 @@ get_vectype_for_scalar_type (vec_info *vinfo, tree scalar_type, slp_tree node) ...@@ -11323,14 +11323,15 @@ get_vectype_for_scalar_type (vec_info *vinfo, tree scalar_type, slp_tree node)
Returns the mask type corresponding to a result of comparison Returns the mask type corresponding to a result of comparison
of vectors of specified SCALAR_TYPE as supported by target. of vectors of specified SCALAR_TYPE as supported by target.
NODE, if nonnull, is the SLP tree node that will use the returned If GROUP_SIZE is nonzero and we're performing BB vectorization,
vector type. */ make sure that the number of elements in the vector is no bigger
than GROUP_SIZE. */
tree tree
get_mask_type_for_scalar_type (vec_info *vinfo, tree scalar_type, get_mask_type_for_scalar_type (vec_info *vinfo, tree scalar_type,
slp_tree node) unsigned int group_size)
{ {
tree vectype = get_vectype_for_scalar_type (vinfo, scalar_type, node); tree vectype = get_vectype_for_scalar_type (vinfo, scalar_type, group_size);
if (!vectype) if (!vectype)
return NULL; return NULL;
...@@ -12190,11 +12191,12 @@ vect_get_vector_types_for_stmt (stmt_vec_info stmt_info, ...@@ -12190,11 +12191,12 @@ vect_get_vector_types_for_stmt (stmt_vec_info stmt_info,
/* Try to determine the correct vector type for STMT_INFO, which is a /* Try to determine the correct vector type for STMT_INFO, which is a
statement that produces a scalar boolean result. Return the vector statement that produces a scalar boolean result. Return the vector
type on success, otherwise return NULL_TREE. NODE, if nonnull, type on success, otherwise return NULL_TREE. If GROUP_SIZE is nonzero
is the SLP tree node that will use the returned vector type. */ and we're performing BB vectorization, make sure that the number of
elements in the vector is no bigger than GROUP_SIZE. */
opt_tree opt_tree
vect_get_mask_type_for_stmt (stmt_vec_info stmt_info, slp_tree node) vect_get_mask_type_for_stmt (stmt_vec_info stmt_info, unsigned int group_size)
{ {
vec_info *vinfo = stmt_info->vinfo; vec_info *vinfo = stmt_info->vinfo;
gimple *stmt = stmt_info->stmt; gimple *stmt = stmt_info->stmt;
...@@ -12206,7 +12208,8 @@ vect_get_mask_type_for_stmt (stmt_vec_info stmt_info, slp_tree node) ...@@ -12206,7 +12208,8 @@ vect_get_mask_type_for_stmt (stmt_vec_info stmt_info, slp_tree node)
&& !VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt)))) && !VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt))))
{ {
scalar_type = TREE_TYPE (gimple_assign_rhs1 (stmt)); scalar_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
mask_type = get_mask_type_for_scalar_type (vinfo, scalar_type, node); mask_type = get_mask_type_for_scalar_type (vinfo, scalar_type,
group_size);
if (!mask_type) if (!mask_type)
return opt_tree::failure_at (stmt, return opt_tree::failure_at (stmt,
......
...@@ -1640,7 +1640,7 @@ extern tree get_related_vectype_for_scalar_type (machine_mode, tree, ...@@ -1640,7 +1640,7 @@ extern tree get_related_vectype_for_scalar_type (machine_mode, tree,
poly_uint64 = 0); poly_uint64 = 0);
extern tree get_vectype_for_scalar_type (vec_info *, tree, unsigned int = 0); extern tree get_vectype_for_scalar_type (vec_info *, tree, unsigned int = 0);
extern tree get_vectype_for_scalar_type (vec_info *, tree, slp_tree); extern tree get_vectype_for_scalar_type (vec_info *, tree, slp_tree);
extern tree get_mask_type_for_scalar_type (vec_info *, tree, slp_tree = 0); extern tree get_mask_type_for_scalar_type (vec_info *, tree, unsigned int = 0);
extern tree get_same_sized_vectype (tree, tree); extern tree get_same_sized_vectype (tree, tree);
extern bool vect_chooses_same_modes_p (vec_info *, machine_mode); extern bool vect_chooses_same_modes_p (vec_info *, machine_mode);
extern bool vect_get_loop_mask_type (loop_vec_info); extern bool vect_get_loop_mask_type (loop_vec_info);
...@@ -1693,7 +1693,7 @@ extern gcall *vect_gen_while (tree, tree, tree); ...@@ -1693,7 +1693,7 @@ extern gcall *vect_gen_while (tree, tree, tree);
extern tree vect_gen_while_not (gimple_seq *, tree, tree, tree); extern tree vect_gen_while_not (gimple_seq *, tree, tree, tree);
extern opt_result vect_get_vector_types_for_stmt (stmt_vec_info, tree *, extern opt_result vect_get_vector_types_for_stmt (stmt_vec_info, tree *,
tree *, unsigned int = 0); tree *, unsigned int = 0);
extern opt_tree vect_get_mask_type_for_stmt (stmt_vec_info, slp_tree = 0); extern opt_tree vect_get_mask_type_for_stmt (stmt_vec_info, unsigned int = 0);
/* In tree-vect-data-refs.c. */ /* In tree-vect-data-refs.c. */
extern bool vect_can_force_dr_alignment_p (const_tree, poly_uint64); extern bool vect_can_force_dr_alignment_p (const_tree, poly_uint64);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment