Commit dad55d70 by Richard Sandiford Committed by Richard Sandiford

poly_int: two-operation SLP

This patch makes two-operation SLP handle but reject variable-length
vectors.  Adding support for this is a post-GCC8 thing.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial
	numbers of units.
	(vect_schedule_slp_instance): Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r256141
parent a23644f2
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
* tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial
numbers of units.
(vect_schedule_slp_instance): Likewise.
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* tree-vect-slp.c (vect_get_and_check_slp_defs): Reject * tree-vect-slp.c (vect_get_and_check_slp_defs): Reject
constant and extern definitions for variable-length vectors. constant and extern definitions for variable-length vectors.
(vect_get_constant_vectors): Note that the number of units (vect_get_constant_vectors): Note that the number of units
...@@ -905,10 +905,19 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, ...@@ -905,10 +905,19 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
/* If we allowed a two-operation SLP node verify the target can cope /* If we allowed a two-operation SLP node verify the target can cope
with the permute we are going to use. */ with the permute we are going to use. */
poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
if (alt_stmt_code != ERROR_MARK if (alt_stmt_code != ERROR_MARK
&& TREE_CODE_CLASS (alt_stmt_code) != tcc_reference) && TREE_CODE_CLASS (alt_stmt_code) != tcc_reference)
{ {
unsigned int count = TYPE_VECTOR_SUBPARTS (vectype); unsigned HOST_WIDE_INT count;
if (!nunits.is_constant (&count))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: different operations "
"not allowed with variable-length SLP.\n");
return false;
}
vec_perm_builder sel (count, count, 1); vec_perm_builder sel (count, count, 1);
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
{ {
...@@ -3824,6 +3833,7 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance, ...@@ -3824,6 +3833,7 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
/* VECTYPE is the type of the destination. */ /* VECTYPE is the type of the destination. */
vectype = STMT_VINFO_VECTYPE (stmt_info); vectype = STMT_VINFO_VECTYPE (stmt_info);
poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
group_size = SLP_INSTANCE_GROUP_SIZE (instance); group_size = SLP_INSTANCE_GROUP_SIZE (instance);
if (!SLP_TREE_VEC_STMTS (node).exists ()) if (!SLP_TREE_VEC_STMTS (node).exists ())
...@@ -3886,13 +3896,16 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance, ...@@ -3886,13 +3896,16 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
unsigned k = 0, l; unsigned k = 0, l;
for (j = 0; j < v0.length (); ++j) for (j = 0; j < v0.length (); ++j)
{ {
unsigned int nunits = TYPE_VECTOR_SUBPARTS (vectype); /* Enforced by vect_build_slp_tree, which rejects variable-length
tree_vector_builder melts (mvectype, nunits, 1); vectors for SLP_TREE_TWO_OPERATORS. */
for (l = 0; l < nunits; ++l) unsigned int const_nunits = nunits.to_constant ();
tree_vector_builder melts (mvectype, const_nunits, 1);
for (l = 0; l < const_nunits; ++l)
{ {
if (k >= group_size) if (k >= group_size)
k = 0; k = 0;
tree t = build_int_cst (meltype, mask[k++] * nunits + l); tree t = build_int_cst (meltype,
mask[k++] * const_nunits + l);
melts.quick_push (t); melts.quick_push (t);
} }
tmask = melts.build (); tmask = melts.build ();
......
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