tree-optimization/110979 - fold-left reduction and partial vectors
commit798a880a0b1fed8a9e3b3e026dd8bd09314b7c38
authorRichard Biener <rguenther@suse.de>
Fri, 11 Aug 2023 11:00:17 +0000 (11 13:00 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 11 Aug 2023 13:03:31 +0000 (11 15:03 +0200)
tree8c8d7d66c52c6d3ff3dfd39f05ab1dac9eb22cc1
parent3a13884b23ae32b43d56d68a9c6bd4ce53d60017
tree-optimization/110979 - fold-left reduction and partial vectors

When we vectorize fold-left reductions with partial vectors but
no target operation available we use a vector conditional to force
excess elements to zero.  But that doesn't correctly preserve
the sign of zero.  The following patch disables partial vector
support when we have to do that and also need to honor rounding
modes other than round-to-nearest.  When round-to-nearest is in
effect and we have to preserve the sign of zero instead use
negative zero for the excess elements.

PR tree-optimization/110979
* tree-vect-loop.cc (vectorizable_reduction): For
FOLD_LEFT_REDUCTION without target support make sure
we don't need to honor signed zeros and sign dependent rounding.

* gcc.dg/torture/pr110979.c: New testcase.
gcc/testsuite/gcc.dg/torture/pr110979.c [new file with mode: 0644]
gcc/tree-vect-loop.cc