https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95906
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #5) > Created attachment 55295 [details] > Patch to handle the scalar version I should we already handle: ``` int f3(int a, int b) { int cmp = -(a > b); int cmp1 = -(a <= b); return (cmp & a) | (cmp1 & b); } ``` via the `(a < b ? c : 0) | (a >= b ? d : 0) into a < b ? c : d` pattern in match.pd already. Adding the `(a?b:0)|(a?0:c) -> (a?b:c)` pattern is needed for f2 in comment #1 though.