https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63568
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- FWIW, I used this to check the whether the transformation is correct: int main () { for (int i = -1000; i < 1000; ++i) for (int a = -1000; a < 1000; ++a) for (int b = -1000; b < 1000; ++b) { int x = (a & ~i) | (b & i); int y = a ^ ((a ^ b) & i); //__builtin_printf ("%d %d\n", x, y); if (x != y) __builtin_abort (); } }