https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95185
Arjun Shankar <arjun.is at lostca dot se> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arjun.is at lostca dot se --- Comment #3 from Arjun Shankar <arjun.is at lostca dot se> --- If the code is compiled as C, gcc produces essentially the same code as clang with some differences in the schedule of instructions: https://godbolt.org/z/8nsq16Pen It's when the code is compiled as C++ that gcc does worse: https://godbolt.org/z/dK8hTEhjr The difference lies in the front-ends. The C front-end already appears to know that this is a XOR. testcase.c.004t.original looks like: return (int) (x < 0 ^ y <= 0); On the other hand, g++ outputs: return <retval> = x >= 0 == y <= 0;