https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118602
Bug ID: 118602 Summary: Missed optimization for (0xc0 & c) == 0x80 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: peter0x44 at disroot dot org Target Milestone: --- For the following function: bool test(char c) { return ((0xc0 & c) == 0x80); } gcc generates: test(char): and edi, -64 cmp dil, -128 sete al ret But clang emits the smaller: test(char): cmp dil, -64 setl al ret https://gcc.godbolt.org/z/jE7dvKEn7