Move EXTRACT_LAST_REDUCTION costing to vectorizable_condition
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 22 Nov 2019 09:58:08 +0000 (09:58 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 22 Nov 2019 09:58:08 +0000 (09:58 +0000)
commit27071013521b015d17a2666448f27a6ff0c55aca
tree0381a84acd6f11dbd5c16f42958d9abbe1b274ce
parentd9c50233e48becdf628babd0dc03d379b1dec970
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
gcc/ChangeLog
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c