[llvm] [SDag][ARM][RISCV] Allow lowering CTPOP into a libcall (PR #101786)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 21:50:36 PDT 2025


s-barannikov wrote:

> does linux kernel provide `__ctzdi2` / `__clzdi2`?

Looks like it does: https://github.com/torvalds/linux/blob/master/lib/clz_ctz.c
I guess it would be much easier if `__popcountsi2`/`__popcountdi2` were also defined.
It is easy to make clang generate `__clz` call instead of expanding to math + `__popcount` (a little more difficult with `__ctz`), but I'm not sure that "this is necessary to build the Linux kernel" would be enough justification for the change.


https://github.com/llvm/llvm-project/pull/101786


More information about the llvm-commits mailing list