diff options
author | Richard Guenther <rguenther@suse.de> | 2012-03-16 13:20:55 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-03-16 13:20:55 +0000 |
commit | b758f602501612172068807bbc79e65c0827ab57 (patch) | |
tree | 42d98432fb00efdabe0ccbb26862361ee4e28f6a /gcc/tree-vect-stmts.c | |
parent | cf1867a027259b46b63abed5f6e34b479d52f186 (diff) | |
download | gcc-b758f602501612172068807bbc79e65c0827ab57.zip gcc-b758f602501612172068807bbc79e65c0827ab57.tar.gz gcc-b758f602501612172068807bbc79e65c0827ab57.tar.bz2 |
tree-vect-stmts.c (vect_get_vec_def_for_operand): Use VIEW_CONVERT_EXPR to convert constants.
2012-03-16 Richard Guenther <rguenther@suse.de>
* tree-vect-stmts.c (vect_get_vec_def_for_operand): Use
VIEW_CONVERT_EXPR to convert constants.
(vect_is_simple_use): Treat all constants as vec_constant_def.
From-SVN: r185466
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r-- | gcc/tree-vect-stmts.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 8a1c678..c941e15 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1271,9 +1271,13 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def) if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "Create vector_cst. nunits = %d", nunits); - vec_cst = build_vector_from_val (vector_type, - fold_convert (TREE_TYPE (vector_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)); + } + + vec_cst = build_vector_from_val (vector_type, op); return vect_init_vector (stmt, vec_cst, vector_type, NULL); } @@ -5909,7 +5913,7 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo, print_generic_expr (vect_dump, operand, TDF_SLIM); } - if (TREE_CODE (operand) == INTEGER_CST || TREE_CODE (operand) == REAL_CST) + if (CONSTANT_CLASS_P (operand)) { *dt = vect_constant_def; return true; |