https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98954
Bug ID: 98954 Summary: Failure to optimize left shift+and pattern Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- bool f(uint8_t m) { return !((m << 1) & 0xFF); } This can be optimized to `return !(m & 0x7F);`. This transformation is done by LLVM, but not by GCC.