https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95235
Bug ID: 95235 Summary: Failure to properly optimize out register use in bit-twiddling code Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- int f(int a, int b) { return ((a & 1) != 0) != (b != 0); } With -O3, GCC outputs this : f(int, int): test esi, esi setne al xor edi, eax mov eax, edi and eax, 1 ret GCC should be able of outputting this instead : f(int, int): test esi, esi setne al xor eax, edi and eax, 1 ret But it does not do so.