https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114669
Bug ID: 114669 Summary: use >= comparison when testing high bits Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: goon.pri.low at gmail dot com Target Milestone: --- Example C functions #include <stdint.h> #include <stdbool.h> bool unopt(uint32_t x) { return (x & 0xfff00000) == 0xfff00000; } bool opt(uint32_t x) { return x >= 0xfff00000; } Generated assembly unopt: not edi and edi, -1048576 sete al ret opt: cmp edi, -1048577 seta al ret