https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115659
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Kewen Lin <li...@gcc.gnu.org>: https://gcc.gnu.org/g:56670281c6db19d75c7b63e38971ab84681b245c commit r15-1763-g56670281c6db19d75c7b63e38971ab84681b245c Author: Kewen Lin <li...@linux.ibm.com> Date: Tue Jul 2 02:13:35 2024 -0500 isel: Fold more in gimple_expand_vec_cond_expr [PR115659] As PR115659 shows, assuming c = x CMP y, there are some folding chances for patterns r = c ? -1/z : z/0. For r = c ? -1 : z, it can be folded into: - r = c | z (with ior_optab supported) - or r = c ? c : z while for r = c ? z : 0, it can be foled into: - r = c & z (with and_optab supported) - or r = c ? z : c This patch is to teach ISEL to take care of them and also remove the redundant gsi_replace as the caller of function gimple_expand_vec_cond_expr will handle it. PR tree-optimization/115659 gcc/ChangeLog: * gimple-isel.cc (gimple_expand_vec_cond_expr): Add more foldings for patterns x CMP y ? -1 : z and x CMP y ? z : 0.