From: Richard Sandiford Date: Wed, 3 Jan 2018 21:42:01 +0000 (+0000) Subject: poly_int: vect_permute_load/store_chain X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=edab8e10e3cc127335ae4fa7a5935a28acfae0a9;p=gcc.git 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 Alan Hayward David Sherwood 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 Co-Authored-By: David Sherwood From-SVN: r256196 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a96624c14d..f17884d3f97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-01-03 Richard Sandiford + Alan Hayward + David Sherwood + + * 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 Alan Hayward David Sherwood diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 4de0864774d..2fad8909810 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -4763,8 +4763,7 @@ vect_permute_store_chain (vec 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 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 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 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 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 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)