https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122723
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:facb92812a4ec5c60ef783db6d02c35fa6a21e16 commit r16-5372-gfacb92812a4ec5c60ef783db6d02c35fa6a21e16 Author: Richard Biener <[email protected]> Date: Tue Nov 18 09:59:54 2025 +0100 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.
