tree-optimization/101756 - avoid vectorizing boolean MAX reductions
authorRichard Biener <rguenther@suse.de>
Wed, 4 Aug 2021 09:42:41 +0000 (11:42 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 4 Aug 2021 10:33:23 +0000 (12:33 +0200)
commit87a0b607e40f8122c7fc45d496ef48799fe11550
tree66796d9199b39764de9cdad7db7a7e80135b047f
parentaf31cab04770f7a1a1da069415ab62ca2ef54fc4
tree-optimization/101756 - avoid vectorizing boolean MAX reductions

The following avoids vectorizing MIN/MAX reductions on bools which,
when ending up as vector(2) <signed-boolean:64> would need to be
adjusted because of the sign change.  The fix instead avoids any
reduction vectorization where the result isn't compatible
to the original scalar type since we don't compensate for that
either.

2021-08-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/101756
* tree-vect-slp.c (vectorizable_bb_reduc_epilogue): Make sure
the result of the reduction epilogue is compatible to the original
scalar result.

* gcc.dg/vect/bb-slp-pr101756.c: New testcase.
gcc/testsuite/gcc.dg/vect/bb-slp-pr101756.c [new file with mode: 0644]
gcc/tree-vect-slp.c