https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111282
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > Note we will need to detect both `a & (b ^ ~a)` and `a & ~(a ^ b)` since a > might be comparison too. Well and that will handle: ``` int f0(int a, int b) { return (~a) & (b ^ a); // ~a & b } ``` Which we don't currently. on the RTL level, we currently simplify that to: (a | b) ^ a The interesting thing is we do simplify the above in tree via the following pattern: /* (X | Y) ^ X -> Y & ~ X */