aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-patterns.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-10-17 11:48:45 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-10-17 11:48:45 +0000
commitaa9dffac731d0359a0e7a925ff8f4a1bef182eac (patch)
tree63f122fab3cd3141e4f8ebbfc2cd06115b7ee28b /gcc/tree-vect-patterns.c
parent728ece16a633863c0a2f78239dc2679167b099dc (diff)
downloadgcc-aa9dffac731d0359a0e7a925ff8f4a1bef182eac.zip
gcc-aa9dffac731d0359a0e7a925ff8f4a1bef182eac.tar.gz
gcc-aa9dffac731d0359a0e7a925ff8f4a1bef182eac.tar.bz2
tree-vect-loop.c (needs_fold_left_reduction_p): Export.
2019-10-17 Richard Biener <rguenther@suse.de> * tree-vect-loop.c (needs_fold_left_reduction_p): Export. (vect_is_simple_reduction): Move all validity checks ... (vectorizable_reduction): ... here. Compute whether we need a fold-left reduction here. * tree-vect-patterns.c (vect_reassociating_reduction_p): Merge both overloads, check needs_fold_left_reduction_p directly. * tree-vectorizer.h (needs_fold_left_reduction_p): Declare. From-SVN: r277100
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r--gcc/tree-vect-patterns.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 385482f..5387563 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -833,19 +833,8 @@ vect_convert_output (stmt_vec_info stmt_info, tree type, gimple *pattern_stmt,
/* Return true if STMT_VINFO describes a reduction for which reassociation
is allowed. If STMT_INFO is part of a group, assume that it's part of
a reduction chain and optimistically assume that all statements
- except the last allow reassociation. */
-
-static bool
-vect_reassociating_reduction_p (stmt_vec_info stmt_vinfo)
-{
- if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)
- return (STMT_VINFO_REDUC_TYPE (STMT_VINFO_REDUC_DEF (stmt_vinfo))
- != FOLD_LEFT_REDUCTION);
- else
- return REDUC_GROUP_FIRST_ELEMENT (stmt_vinfo) != NULL;
-}
-
-/* As above, but also require it to have code CODE and to be a reduction
+ except the last allow reassociation.
+ Also require it to have code CODE and to be a reduction
in the outermost loop. When returning true, store the operands in
*OP0_OUT and *OP1_OUT. */
@@ -867,7 +856,13 @@ vect_reassociating_reduction_p (stmt_vec_info stmt_info, tree_code code,
if (loop && nested_in_vect_loop_p (loop, stmt_info))
return false;
- if (!vect_reassociating_reduction_p (stmt_info))
+ if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
+ {
+ if (needs_fold_left_reduction_p (TREE_TYPE (gimple_assign_lhs (assign)),
+ code))
+ return false;
+ }
+ else if (REDUC_GROUP_FIRST_ELEMENT (stmt_info) == NULL)
return false;
*op0_out = gimple_assign_rhs1 (assign);