From 2635892a1c64fc7e5b8c1c13d53dd0468ffc757d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 15 Oct 2011 12:36:50 -0700 Subject: Use VEC_PERM_EXPR in the vectorizer. * tree-vect-slp.c: Include langhooks.h. (vect_create_mask_and_perm): Emit VEC_PERM_EXPR, not a builtin. (vect_transform_slp_perm_load): Use can_vec_perm_expr_p. Simplify mask creation for VEC_PERM_EXPR. * tree-vect-stmts.c (perm_mask_for_reverse): Return the mask, not the builtin. (reverse_vec_elements): Emit VEC_PERM_EXPR not a builtin. * Makefile.in (tree-vect-slp.o): Update dependency. * optabs.c (can_vec_perm_expr_p): Allow NULL as unknown constant. From-SVN: r180047 --- gcc/optabs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/optabs.c') diff --git a/gcc/optabs.c b/gcc/optabs.c index e9a23f4..a373d7a 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -6686,7 +6686,7 @@ vector_compare_rtx (tree cond, bool unsignedp, enum insn_code icode) } /* Return true if VEC_PERM_EXPR can be expanded using SIMD extensions - of the CPU. */ + of the CPU. SEL may be NULL, which stands for an unknown constant. */ bool can_vec_perm_expr_p (tree type, tree sel) @@ -6699,10 +6699,10 @@ can_vec_perm_expr_p (tree type, tree sel) if (!VECTOR_MODE_P (mode)) return false; - if (TREE_CODE (sel) == VECTOR_CST) + if (sel == NULL || TREE_CODE (sel) == VECTOR_CST) { if (direct_optab_handler (vec_perm_const_optab, mode) != CODE_FOR_nothing - && targetm.vectorize.builtin_vec_perm_ok (type, sel)) + && (sel == NULL || targetm.vectorize.builtin_vec_perm_ok (type, sel))) return true; } @@ -6722,7 +6722,7 @@ can_vec_perm_expr_p (tree type, tree sel) /* In order to support the lowering of non-constant permutations, we need to support shifts and adds. */ - if (TREE_CODE (sel) != VECTOR_CST) + if (sel != NULL && TREE_CODE (sel) != VECTOR_CST) { if (GET_MODE_UNIT_SIZE (mode) > 2 && optab_handler (ashl_optab, mode) == CODE_FOR_nothing -- cgit v1.1