https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101116
Bug ID: 101116 Summary: missed peephole optimization not of bitwise and Product: gcc Version: 11.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: hiraditya at msn dot com Target Milestone: --- $ cat test.c bool foo(unsigned i) { return !(i & 1); } gcc -O2 test.c -S -o- foo(unsigned int): mov eax, edi not eax and eax, 1 ret clang -O2 test.c -S -o- foo(unsigned int): # @foo(unsigned int) testb $1, %dil sete %al retq Ref: https://godbolt.org/z/Tndb1dM8Y