aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-22 09:58:08 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-22 09:58:08 +0000
commit27071013521b015d17a2666448f27a6ff0c55aca (patch)
tree0381a84acd6f11dbd5c16f42958d9abbe1b274ce /gcc/tree-vect-loop.c
parentd9c50233e48becdf628babd0dc03d379b1dec970 (diff)
downloadgcc-27071013521b015d17a2666448f27a6ff0c55aca.zip
gcc-27071013521b015d17a2666448f27a6ff0c55aca.tar.gz
gcc-27071013521b015d17a2666448f27a6ff0c55aca.tar.bz2
Move EXTRACT_LAST_REDUCTION costing to vectorizable_condition
gcc.target/aarch64/sve/clastb_[57].c started failing after the increase in the cost of vec_to_scalar (r278452). The problem is that we were double-counting the cost of the CLASTB: once in vect_model_reduction_cost as a vec_to_scalar and once in vectorizable_condition as a plain vector_stmt. Based on the TODO above vect_model_reduction_cost, I think the preferred long-term direction is for vectorizable_* to cost these things itself, so that's what the patch does (for this one case only). 2019-11-22 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vect-stmts.c (vect_model_simple_cost): Take an optional vect_cost_for_stmt. (vectorizable_condition): Calculate the cost of EXTRACT_LAST_REDUCTION here rather than... * tree-vect-loop.c (vect_model_reduction_cost): ...here. From-SVN: r278611
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index e4a87e7..ca8c818 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3924,8 +3924,11 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, internal_fn reduc_fn,
code = gimple_assign_rhs_code (orig_stmt_info->stmt);
- if (reduction_type == EXTRACT_LAST_REDUCTION
- || reduction_type == FOLD_LEFT_REDUCTION)
+ if (reduction_type == EXTRACT_LAST_REDUCTION)
+ /* No extra instructions are needed in the prologue. The loop body
+ operations are costed in vectorizable_condition. */
+ inside_cost = 0;
+ else if (reduction_type == FOLD_LEFT_REDUCTION)
{
/* No extra instructions needed in the prologue. */
prologue_cost = 0;