poly_int: vect_permute_load/store_chain

The GET_MODE_NUNITS patch made vect_grouped_store_supported and
vect_grouped_load_supported check for a constant number of elements,
so vect_permute_store_chain and vect_permute_load_chain can assert
for that.  This patch adds commentary to that effect; the actual
asserts will be added by a later, more mechanical, patch.

The patch also reorganises the function so that the asserts
are linked specifically to code that builds permute vectors
element-by-element.  This allows a later patch to add support
for some variable-length permutes.

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

gcc/
	* tree-vect-data-refs.c (vect_permute_store_chain): Reorganize
	so that both the length == 3 and length != 3 cases set up their
	own permute vectors.  Add comments explaining why we know the
	number of elements is constant.
	(vect_permute_load_chain): Likewise.

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

From-SVN: r256196
This commit is contained in:
Richard Sandiford 2018-01-03 21:42:01 +00:00 committed by Richard Sandiford
parent 7b777afa95
commit edab8e10e3
2 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* tree-vect-data-refs.c (vect_permute_store_chain): Reorganize
so that both the length == 3 and length != 3 cases set up their
own permute vectors. Add comments explaining why we know the
number of elements is constant.
(vect_permute_load_chain): Likewise.
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>

View File

@ -4763,8 +4763,7 @@ vect_permute_store_chain (vec<tree> dr_chain,
tree perm_mask_low, perm_mask_high;
tree data_ref;
tree perm3_mask_low, perm3_mask_high;
unsigned int i, n, log_length = exact_log2 (length);
unsigned int j, nelt = TYPE_VECTOR_SUBPARTS (vectype);
unsigned int i, j, n, log_length = exact_log2 (length);
result_chain->quick_grow (length);
memcpy (result_chain->address (), dr_chain.address (),
@ -4772,6 +4771,8 @@ vect_permute_store_chain (vec<tree> dr_chain,
if (length == 3)
{
/* vect_grouped_store_supported ensures that this is constant. */
unsigned int nelt = TYPE_VECTOR_SUBPARTS (vectype);
unsigned int j0 = 0, j1 = 0, j2 = 0;
vec_perm_builder sel (nelt, nelt, 1);
@ -4838,6 +4839,7 @@ vect_permute_store_chain (vec<tree> dr_chain,
gcc_assert (pow2p_hwi (length));
/* The encoding has 2 interleaved stepped patterns. */
unsigned int nelt = TYPE_VECTOR_SUBPARTS (vectype);
vec_perm_builder sel (nelt, 2, 3);
sel.quick_grow (6);
for (i = 0; i < 3; i++)
@ -5375,7 +5377,6 @@ vect_permute_load_chain (vec<tree> dr_chain,
gimple *perm_stmt;
tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
unsigned int i, j, log_length = exact_log2 (length);
unsigned nelt = TYPE_VECTOR_SUBPARTS (vectype);
result_chain->quick_grow (length);
memcpy (result_chain->address (), dr_chain.address (),
@ -5383,6 +5384,8 @@ vect_permute_load_chain (vec<tree> dr_chain,
if (length == 3)
{
/* vect_grouped_load_supported ensures that this is constant. */
unsigned nelt = TYPE_VECTOR_SUBPARTS (vectype);
unsigned int k;
vec_perm_builder sel (nelt, nelt, 1);
@ -5435,6 +5438,7 @@ vect_permute_load_chain (vec<tree> dr_chain,
gcc_assert (pow2p_hwi (length));
/* The encoding has a single stepped pattern. */
unsigned int nelt = TYPE_VECTOR_SUBPARTS (vectype);
vec_perm_builder sel (nelt, 1, 3);
sel.quick_grow (3);
for (i = 0; i < 3; ++i)