https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113078
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:cac9d2d2346bf06b29b34e12cf0a005c37eacdc9 commit r14-7108-gcac9d2d2346bf06b29b34e12cf0a005c37eacdc9 Author: Richard Biener <rguent...@suse.de> Date: Wed Jan 10 14:13:25 2024 +0100 tree-optimization/113078 - conditional subtraction reduction vectorization When if-conversion was changed to use .COND_ADD/SUB for conditional reduction it was forgotten to update reduction path handling to canonicalize .COND_SUB to .COND_ADD for vectorizable_reduction similar to what we do for MINUS_EXPR. The following adds this and testcases exercising this at runtime and looking for the appropriate masked subtraction in the vectorized code on x86. PR tree-optimization/113078 * tree-vect-loop.cc (check_reduction_path): Canonicalize .COND_SUB to .COND_ADD. * gcc.dg/vect/vect-reduc-cond-sub.c: New testcase. * gcc.target/i386/vect-pr113078.c: Likewise.