aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/tree-vect-stmts.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-04-22 13:33:12 -0700
committerBen Cheng <bccheng@google.com>2014-04-22 13:33:12 -0700
commite3cc64dec20832769406aa38cde83c7dd4194bf4 (patch)
treeef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/gcc/tree-vect-stmts.c
parentf33c7b3122b1d7950efa88067c9a156229ba647b (diff)
downloadtoolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip
[4.9] GCC 4.9.0 official release refresh
Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767
Diffstat (limited to 'gcc-4.9/gcc/tree-vect-stmts.c')
-rw-r--r--gcc-4.9/gcc/tree-vect-stmts.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc-4.9/gcc/tree-vect-stmts.c b/gcc-4.9/gcc/tree-vect-stmts.c
index 884e769c8..1a51d6d7b 100644
--- a/gcc-4.9/gcc/tree-vect-stmts.c
+++ b/gcc-4.9/gcc/tree-vect-stmts.c
@@ -7848,7 +7848,21 @@ supportable_widening_operation (enum tree_code code, gimple stmt,
stmt, vectype_out, vectype_in,
code1, code2, multi_step_cvt,
interm_types))
- return true;
+ {
+ /* Elements in a vector with vect_used_by_reduction property cannot
+ be reordered if the use chain with this property does not have the
+ same operation. One such an example is s += a * b, where elements
+ in a and b cannot be reordered. Here we check if the vector defined
+ by STMT is only directly used in the reduction statement. */
+ tree lhs = gimple_assign_lhs (stmt);
+ use_operand_p dummy;
+ gimple use_stmt;
+ stmt_vec_info use_stmt_info = NULL;
+ if (single_imm_use (lhs, &dummy, &use_stmt)
+ && (use_stmt_info = vinfo_for_stmt (use_stmt))
+ && STMT_VINFO_DEF_TYPE (use_stmt_info) == vect_reduction_def)
+ return true;
+ }
c1 = VEC_WIDEN_MULT_LO_EXPR;
c2 = VEC_WIDEN_MULT_HI_EXPR;
break;