https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96691
--- Comment #1 from Gabriel Ravier <gabravier at gmail dot com> --- int f(int x) { return (~x & 123) ^ 321; } A very similar transformation can be done with this code, transforming it to `return (x & 123) ^ 314;` (according to LLVM), and a similar transformation should be possible with other constants, though I can't identify myself the exact transformation you'd need to generalise this to all constants.