https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95863
Bug ID: 95863 Summary: Failure to detect table-based ctz implementation 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: --- int f(unsigned x) { static const char table[32] = {0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; return table[((unsigned)((x & -x) * 0x077CB531U)) >> 27]; } https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90838 claims to optimize this code to `return __builtin_ctz(x)`, but this does not occur.