summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-generic.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-25 21:29:48 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-25 21:29:48 +0000
commite21c468f20819a1d6545741af280a77e4f89c8e0 (patch)
tree646bec23201b08685d3560602023733c6d9f7259 /gcc/tree-vect-generic.c
parent4b50824be623275a757eacd82ef171fd69cf455f (diff)
downloadgcc-e21c468f20819a1d6545741af280a77e4f89c8e0.tar.gz
Change vec_perm checking and expansion level.
The can_vec_perm_p interface changed to use a C integer array. This allows easy re-use from the rtl level and the gimple level within the vectorizer. It allows both to determine if a given permutation is (un-)supported without having to create tree/rtl garbage. The expand_vec_perm interface changed to use rtl. This allows easy re-use from the rtl level, so that expand_vec_perm can be used in the fallback implementation of other optabs. * target.def (vec_perm_const_ok): Change parameters to mode and array of indicies. * doc/tm.texi: Rebuild. * config/i386/i386.c (ix86_vectorize_vec_perm_const_ok): Change parameters to mode and array of indicies. * expr.c (expand_expr_real_2) [VEC_PERM_EXPR]: Expand operands here. * optabs.c (can_vec_perm_p): Rename from can_vec_perm_expr_p. Change parameters to mode and array of indicies. (expand_vec_perm_1): Rename from expand_vec_perm_expr_1. (expand_vec_perm): Rename from expand_vec_perm_expr. Change parameters to mode and rtx inputs. Try lowering to QImode vec_perm_const before trying fully variable permutation. * optabs.h: Update decls. * tree-vect-generic.c (lower_vec_perm): Extract array of indices from VECTOR_CST to pass to can_vec_perm_p. * tree-vect-slp.c (vect_get_mask_element): Change mask parameter type from int pointer to unsigned char pointer. (vect_transform_slp_perm_load): Update for change to can_vec_perm_p. * tree-vect-stmts.c (perm_mask_for_reverse): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180449 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-generic.c')
-rw-r--r--gcc/tree-vect-generic.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 37ff807b1b5..42ce2e3d729 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -641,13 +641,23 @@ lower_vec_perm (gimple_stmt_iterator *gsi)
location_t loc = gimple_location (gsi_stmt (*gsi));
unsigned i;
- if (can_vec_perm_expr_p (vect_type, mask))
+ if (TREE_CODE (mask) == VECTOR_CST)
+ {
+ unsigned char *sel_int = XALLOCAVEC (unsigned char, elements);
+ tree vals = TREE_VECTOR_CST_ELTS (mask);
+
+ for (i = 0; i < elements; ++i, vals = TREE_CHAIN (vals))
+ sel_int[i] = TREE_INT_CST_LOW (TREE_VALUE (vals));
+
+ if (can_vec_perm_p (TYPE_MODE (vect_type), false, sel_int))
+ return;
+ }
+ else if (can_vec_perm_p (TYPE_MODE (vect_type), true, NULL))
return;
warning_at (loc, OPT_Wvector_operation_performance,
"vector shuffling operation will be expanded piecewise");
-
v = VEC_alloc (constructor_elt, gc, elements);
for (i = 0; i < elements; i++)
{