https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101650

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the pattern which we have currently matching (X | Y) == Y does this:
 /* (X | Y) == Y becomes (X & ~Y) == 0.  */
 (simplify
  (cmp:c (bit_ior:c @0 @1) @1)
  (cmp (bit_and @0 (bit_not! @1)) { build_zero_cst (TREE_TYPE (@0)); }))

So adding:
 /* (Y | CST) == Y becomes (Y & CST) != 0.  */
 (simplify
  (cmp:c (bit_ior @1 INTEGER_CST@0) @1)
  (icmp (bit_and @1 @0) { build_zero_cst (TREE_TYPE (@0)); }))

Is needed.

Reply via email to