diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-27 13:23:45 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-27 13:23:45 +0000 |
commit | 99f61dd05a51a11d57d0ea0a4c4461b9f8854afd (patch) | |
tree | c7af50810d78cf10cd129e4f8a04c3346b66466e /gcc/tree-vect-stmts.c | |
parent | 6c1af759b694a9119323024d188f7e430b1f9334 (diff) | |
download | gcc-99f61dd05a51a11d57d0ea0a4c4461b9f8854afd.tar.gz |
2010-05-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44284
* tree-vect-stmts.c (vectorizable_assignment): Handle
sign-changing conversions as simple copy.
* gcc.dg/vect/vect-118.c: New testcase.
* gcc.dg/vect/bb-slp-20.c: Adjust.
* gcc.dg/vect/no-section-anchors-vect-36.c: Likewise.
* gcc.dg/vect/slp-9.c: Likewise.
* gcc.dg/vect/slp-reduc-4.c: Likewise.
* gcc.dg/vect/vect-10.c: Likewise.
* gcc.dg/vect/vect-109.c: Likewise.
* gcc.dg/vect/vect-12.c: Likewise.
* gcc.dg/vect/vect-36.c: Likewise.
* gcc.dg/vect/vect-7.c: Likewise.
* gcc.dg/vect/vect-iv-8.c: Likewise.
* gcc.dg/vect/vect-multitypes-10.c: Likewise.
* gcc.dg/vect/vect-multitypes-13.c: Likewise.
* gcc.dg/vect/vect-multitypes-14.c: Likewise.
* gcc.dg/vect/vect-multitypes-15.c: Likewise.
* gcc.dg/vect/vect-multitypes-7.c: Likewise.
* gcc.dg/vect/vect-multitypes-8.c: Likewise.
* gcc.dg/vect/vect-multitypes-9.c: Likewise.
* gcc.dg/vect/vect-reduc-dot-s16b.c: Likewise.
* gcc.dg/vect/vect-reduc-dot-s8a.c: Likewise.
* gcc.dg/vect/vect-reduc-dot-s8b.c: Likewise.
* gcc.dg/vect/vect-reduc-dot-u16b.c: Likewise.
* gcc.dg/vect/vect-strided-a-u32-mult.c: Likewise.
* gcc.dg/vect/vect-strided-u32-mult.c: Likewise.
* gcc.dg/vect/vect-widen-mult-s16.c: Likewise.
* gcc.dg/vect/vect-widen-mult-s8.c: Likewise.
* gcc.dg/vect/vect-widen-mult-sum.c: Likewise.
* gcc.dg/vect/vect-widen-mult-u16.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159920 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r-- | gcc/tree-vect-stmts.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index a70ebfe011b..8f564104379 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1829,7 +1829,7 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi, tree def; gimple def_stmt; enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type}; - int nunits = TYPE_VECTOR_SUBPARTS (vectype); + unsigned int nunits = TYPE_VECTOR_SUBPARTS (vectype); int ncopies; int i, j; VEC(tree,heap) *vec_oprnds = NULL; @@ -1837,6 +1837,8 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi, bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info); gimple new_stmt = NULL; stmt_vec_info prev_stmt_info = NULL; + enum tree_code code; + tree vectype_in; /* Multiple types in SLP are handled by creating the appropriate number of vectorized stmts for each SLP node. Hence, NCOPIES is always 1 in @@ -1862,19 +1864,31 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi, if (TREE_CODE (scalar_dest) != SSA_NAME) return false; + code = gimple_assign_rhs_code (stmt); if (gimple_assign_single_p (stmt) - || gimple_assign_rhs_code (stmt) == PAREN_EXPR) + || code == PAREN_EXPR + || CONVERT_EXPR_CODE_P (code)) op = gimple_assign_rhs1 (stmt); else return false; - if (!vect_is_simple_use (op, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[0])) + if (!vect_is_simple_use_1 (op, loop_vinfo, bb_vinfo, + &def_stmt, &def, &dt[0], &vectype_in)) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "use not simple."); return false; } + /* We can handle NOP_EXPR conversions that do not change the number + of elements or the vector size. */ + if (CONVERT_EXPR_CODE_P (code) + && (!vectype_in + || TYPE_VECTOR_SUBPARTS (vectype_in) != nunits + || (GET_MODE_SIZE (TYPE_MODE (vectype)) + != GET_MODE_SIZE (TYPE_MODE (vectype_in))))) + return false; + if (!vec_stmt) /* transformation not required. */ { STMT_VINFO_TYPE (stmt_info) = assignment_vec_info_type; @@ -1903,6 +1917,8 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi, /* Arguments are ready. create the new vector stmt. */ for (i = 0; VEC_iterate (tree, vec_oprnds, i, vop); i++) { + if (CONVERT_EXPR_CODE_P (code)) + vop = build1_stat (VIEW_CONVERT_EXPR, vectype, vop); new_stmt = gimple_build_assign (vec_dest, vop); new_temp = make_ssa_name (vec_dest, new_stmt); gimple_assign_set_lhs (new_stmt, new_temp); |