https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94801
Bug ID: 94801 Summary: Failure to optimize narrowed __builtin_clz Product: gcc Version: 10.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: --- int f(int a) { return __builtin_clz(a) >> 5; } Can be optimized to `return 0;`. This transformation is done by LLVM, but not by GCC. Comparison here : https://godbolt.org/z/jhqQ2u