https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109011
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 54584 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54584&action=edit gcc13-pr109011.patch Untested patch to just extend the popcount handling to clz, ctz and ffs, though for now only if they have corresponding optabs implemented. This improves the __builtin_clzll testcase above, but doesn't help with ctz or ffs. Those will need to be added incrementally.