https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114224
Bug ID: 114224 Summary: popcount RTL cost seems wrong with cssc Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: aarch64 I noticed this with: ``` #include <stdint.h> bool is_power_of_2_1(uint64_t value) { return __builtin_popcountg(value) == 1; } ``` Which I had expected to produce: ``` cnt x0, x0 cmp x0, 1 cset w0, eq ``` But instead we get: ``` sub x1, x0, #1 eor x0, x0, x1 cmp x0, x1 cset w0, hi ret ```