summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-02 13:43:09 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-02 13:43:09 +0000
commit0ff8139c73436ea72ae8cf248828666b2afe8a82 (patch)
tree3adb3336c25f30bb07febeff1971bf93fbfcc921 /gcc/tree-vect-slp.c
parent86385074e4594ff49e2add5e4a2bbf5457dde683 (diff)
downloadgcc-0ff8139c73436ea72ae8cf248828666b2afe8a82.tar.gz
PR tree-optimization/54713
* expr.c (categorize_ctor_elements_1): Don't assume purpose is non-NULL. * tree-cfg.c (verify_gimple_assign_single): Add verification of vector CONSTRUCTORs. * tree-ssa-sccvn.c (vn_reference_lookup_3): For VECTOR_TYPE CONSTRUCTORs, don't do anything if element type is VECTOR_TYPE, and don't check index. * tree-vect-slp.c (vect_get_constant_vectors): VIEW_CONVERT_EXPR ctor elements first if their type isn't compatible with vector element type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191983 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 1c4f2762fd8..c2429b28693 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2345,6 +2345,7 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
enum tree_code code = gimple_expr_code (stmt);
gimple def_stmt;
struct loop *loop;
+ gimple_seq ctor_seq = NULL;
if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def
&& reduc_index != -1)
@@ -2503,11 +2504,27 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
/* Create 'vect_ = {op0,op1,...,opn}'. */
number_of_places_left_in_vector--;
- if (constant_p
- && !types_compatible_p (TREE_TYPE (vector_type), TREE_TYPE (op)))
+ if (!types_compatible_p (TREE_TYPE (vector_type), TREE_TYPE (op)))
{
- op = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (vector_type), op);
- gcc_assert (op && CONSTANT_CLASS_P (op));
+ if (constant_p)
+ {
+ op = fold_unary (VIEW_CONVERT_EXPR,
+ TREE_TYPE (vector_type), op);
+ gcc_assert (op && CONSTANT_CLASS_P (op));
+ }
+ else
+ {
+ tree new_temp
+ = make_ssa_name (TREE_TYPE (vector_type), NULL);
+ gimple init_stmt;
+ op = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (vector_type),
+ op);
+ init_stmt
+ = gimple_build_assign_with_ops (VIEW_CONVERT_EXPR,
+ new_temp, op, NULL_TREE);
+ gimple_seq_add_stmt (&ctor_seq, init_stmt);
+ op = new_temp;
+ }
}
elts[number_of_places_left_in_vector] = op;
@@ -2529,6 +2546,15 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
VEC_quick_push (tree, voprnds,
vect_init_vector (stmt, vec_cst,
vector_type, NULL));
+ if (ctor_seq != NULL)
+ {
+ gimple init_stmt
+ = SSA_NAME_DEF_STMT (VEC_last (tree, voprnds));
+ gimple_stmt_iterator gsi = gsi_for_stmt (init_stmt);
+ gsi_insert_seq_before_without_update (&gsi, ctor_seq,
+ GSI_SAME_STMT);
+ ctor_seq = NULL;
+ }
}
}
}