From 9b999e8c82296dc7acee8e74b49cab47004c47a5 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 8 Jun 2015 12:40:20 +0000 Subject: tree-vect-stmts.c (vectorizable_load): Compute the pointer adjustment for gaps at the end of a SLP load group properly. 2015-06-08 Richard Biener * tree-vect-stmts.c (vectorizable_load): Compute the pointer adjustment for gaps at the end of a SLP load group properly. * tree-vect-slp.c (vect_supported_load_permutation_p): Allow all permutations we can generate. (vect_transform_slp_perm_load): Use the correct group-size. * gcc.dg/vect/slp-perm-10.c: New testcase. * gcc.dg/vect/slp-23.c: Adjust. * gcc.dg/torture/pr53366-2.c: Also verify cross-iteration vector pointer update. From-SVN: r224221 --- gcc/tree-vect-slp.c | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'gcc/tree-vect-slp.c') diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b09c2c3..6120998 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1497,47 +1497,14 @@ vect_supported_load_permutation_p (slp_instance slp_instn) return true; } - /* FORNOW: the only supported permutation is 0..01..1.. of length equal to - GROUP_SIZE and where each sequence of same drs is of GROUP_SIZE length as - well (unless it's reduction). */ - if (SLP_INSTANCE_LOADS (slp_instn).length () != group_size) - return false; - FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node) - if (!node->load_permutation.exists ()) - return false; - - load_index = sbitmap_alloc (group_size); - bitmap_clear (load_index); - FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node) - { - unsigned int lidx = node->load_permutation[0]; - if (bitmap_bit_p (load_index, lidx)) - { - sbitmap_free (load_index); - return false; - } - bitmap_set_bit (load_index, lidx); - FOR_EACH_VEC_ELT (node->load_permutation, j, k) - if (k != lidx) - { - sbitmap_free (load_index); - return false; - } - } - for (i = 0; i < group_size; i++) - if (!bitmap_bit_p (load_index, i)) - { - sbitmap_free (load_index); - return false; - } - sbitmap_free (load_index); - + /* For loop vectorization verify we can generate the permutation. */ FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node) if (node->load_permutation.exists () && !vect_transform_slp_perm_load (node, vNULL, NULL, SLP_INSTANCE_UNROLLING_FACTOR (slp_instn), slp_instn, true)) return false; + return true; } @@ -3282,6 +3249,8 @@ vect_transform_slp_perm_load (slp_tree node, vec dr_chain, if (!STMT_VINFO_GROUPED_ACCESS (stmt_info)) return false; + stmt_info = vinfo_for_stmt (GROUP_FIRST_ELEMENT (stmt_info)); + /* Generate permutation masks for every NODE. Number of masks for each NODE is equal to GROUP_SIZE. E.g., we have a group of three nodes with three loads from the same @@ -3316,7 +3285,7 @@ vect_transform_slp_perm_load (slp_tree node, vec dr_chain, for (k = 0; k < group_size; k++) { i = SLP_TREE_LOAD_PERMUTATION (node)[k]; - first_mask_element = i + j * group_size; + first_mask_element = i + j * STMT_VINFO_GROUP_SIZE (stmt_info); if (!vect_get_mask_element (stmt, first_mask_element, 0, nunits, only_one_vec, index, mask, ¤t_mask_element, -- cgit v1.1