[llvm] [SDag][ARM][RISCV] Allow lowering CTPOP into a libcall (PR #101786)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 09:54:33 PDT 2025
s-barannikov wrote:
> > @koachan you might be interested in this as well.
>
> Lowering CTTZ/CTLZ to libcalls is fine but lowering CTPOP to libcall makes Linux kernel fail to compile?
This is my understanding, yes.
However, we don't currently lower cttz/ctlz into libcalls and instead expand them, and *this* may also introduce a call to `__popcountXi2`. For instance, the generic expansion for `cttz(x)` is `popcount(~x & (x - 1))`.
Before this patch it was not possible to generate a libcall for popcount using the generic mechanism. Now it is possible, but apparently breaks the Linux kernel build because the call is generated when it is not expected (as a result of lowering `__builtin_clz`/`__builtin_ctz`).
https://github.com/llvm/llvm-project/pull/101786
More information about the llvm-commits
mailing list