https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125588
--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #4)
> Applying pattern match.pd:2390, generic-match-10.cc:238
> Applying pattern match.pd:249, generic-match-8.cc:3620
> Applying pattern match.pd:511, generic-match-2.cc:917
> Matching expression match.pd:183, generic-match-7.cc:38
> Matching expression match.pd:201, generic-match-6.cc:55
> Matching expression match.pd:2436, generic-match-3.cc:100
> Matching expression match.pd:199, generic-match-6.cc:23
> Matching expression match.pd:199, generic-match-6.cc:23
> Applying pattern match.pd:2390, generic-match-10.cc:238
> Applying pattern match.pd:249, generic-match-8.cc:3620
> Applying pattern match.pd:511, generic-match-2.cc:917
2390:
/* (~x | y) & x -> x & y
(~x & y) | x -> x | y
(~x & y) ^ x -> x | y */
(for bitop (bit_and bit_ior bit_xor)
rbitop (bit_ior bit_and bit_and)
resbitop (bit_and bit_ior bit_ior)
(simplify
(bitop:c (rbitop:c @2 @1) @0)
(with { bool wascmp; }
(if (bitwise_inverted_equal_p (@0, @2, wascmp)
&& (!wascmp || element_precision (type) == 1))
(resbitop @0 @1)))))
And then that recusives with fold_binary_op_with_conditional_arg somehow.