https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115659
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- c = x CMP y r = c ? -1 : z => r = c ? c : z r = c ? z : 0 => r = c ? z : c this is probably best left for ISEL. I agree the transforms eliminating the COND are useful in general and suitable also for match.pd. Watch out for vectorizer patterns though which creates scalar COND_EXPRs for bool mask <-> bool value transforms. Note the transforms need guarding with the mode check since for targets with compares producing mask modes it doesn't work (x86, for smaller vectors could resort to AVX compares, but the way the mask mode target hook operates this doesn't look easy).