https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96930
Bug ID: 96930 Summary: Failure to optimize out 64-bit arithmetic when it can't happen with division transformed into right shift 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: --- unsigned f(unsigned a, unsigned b) { return a / (unsigned long long)(1U << b); } This can be optimized to `return a >> b;`. This transformation is done by LLVM, but not by GCC.