]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/122723 - masking of .COND_ADD reductions
authorRichard Biener <rguenther@suse.de>
Tue, 18 Nov 2025 08:59:54 +0000 (09:59 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 18 Nov 2025 11:40:54 +0000 (12:40 +0100)
commitfacb92812a4ec5c60ef783db6d02c35fa6a21e16
tree3ab5b52a26267a67a831263979f30df03fd382e0
parent596b4fde343b4e89ba627b3c1f02c09b50307e57
tree-optimization/122723 - masking of .COND_ADD reductions

The following fixes loop masking of .COND_ADD reductions when
we decide to reduce multiple lanes to one, thus go through
vect_transform_reduction.  The first issue is in
vect_reduction_update_partial_vector_usage which does not handle
incoming .COND_ADD well and fails to compute 'cond_fn' in this
case, disabling masking.  The second issue is that
vect_transform_reduction does not implement the masked but
not mask-by-cond case for any .COND_* operation.  The following
should fix both.

The testcases verify runtime in vect.exp and vectorization support
in the i386 target section for the combinations of -O3, -Ofast
plus masked vs. non-masked epilogues.

PR tree-optimization/122723
* tree-vect-loop.cc (vect_reduction_update_partial_vector_usage):
Handle incoming .COND_* operation.
(vect_transform_reduction): Likewise.  Handle .COND_*
operation when not using COND_EXPR masking in a masked loop.

* gcc.dg/vect/vect-reduc-cond-add-1.c: New generic functional
testcase.
* gcc.target/i386/vect-epilogues-6.c: New testcase.
* gcc.target/i386/vect-epilogues-7.c: Likewise.
* gcc.target/i386/vect-epilogues-8.c: Likewise.
* gcc.target/i386/vect-epilogues-9.c: Likewise.
gcc/testsuite/gcc.dg/vect/vect-reduc-cond-add-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/vect-epilogues-6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/vect-epilogues-7.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/vect-epilogues-8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/vect-epilogues-9.c [new file with mode: 0644]
gcc/tree-vect-loop.cc