https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114277
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- > But reviewing that hunk made me realize that we did have the right bits in > place to test for 0/1 values during expansion. So instead of recognizing the > multiplication as a conditional move, we could just recognize the > multiplication pattern during expansion and potentially generate a > conditional move. That was my plan to handle this. My other plan was to add something like his match pattern but only for comparisons. That is: ``` #if GIMPLE /* (cmp) * a -> cmp ? b : 0 */ (simplify (mult:c (maybe_cmp @0) @1) (cond (convert:boolean_type_node @0) @1 { build_zero_cst (type); })) #endif ``` Note you need boolean_type_node there because maybe_cmp can match `a ^ b` even if the type is a signed one bit integral type.