https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102486
Bug ID: 102486 Summary: __builtin_popcount(y&-y) is not optimized to 1 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: int f(unsigned y) { return __builtin_popcount(y&-y); } This should be optimized to just 1.