]> git.ipfire.org Git - thirdparty/gcc.git/commit
Enforce correct COND_EXPR order for EXTRACT_LAST_REDUCTION
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Sep 2019 13:33:55 +0000 (13:33 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Sep 2019 13:33:55 +0000 (13:33 +0000)
commit48e1ffaff9b709503b1eb7e15a46564a86d303dd
tree12ab56e51ea7fe069d7e8ffa1c0b6e41ea5252ba
parentdc8a0f75268915ec7a1bf9f544b0d1f0e1ba3956
Enforce correct COND_EXPR order for EXTRACT_LAST_REDUCTION

For conditional reductions, the "then" value needs to be the candidate
value calculated by this iteration while the "else" value needs to be
the result carried over from previous iterations.  If the COND_EXPR
is the other way around, we need to swap it.

2019-09-19  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vectorizer.h (vectorizable_condition): Take an int
reduction index instead of a boolean flag.
* tree-vect-stmts.c (vectorizable_condition): Likewise.
Swap the "then" and "else" values for EXTRACT_LAST_REDUCTION
reductions if the reduction accumulator is the "then" rather
than the "else" value.
(vect_analyze_stmt): Update call accordingly.
(vect_transform_stmt): Likewise.
* tree-vect-loop.c (vectorizable_reduction): Likewise,
asserting that the index is > 0.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@275962 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h