[llvm] [SDAG] Use shifts if ISD::MUL is illegal when lowering ISD::CTPOP (PR #86505)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 11:41:13 PDT 2024
topperc wrote:
> You can do this with fewer iterations by doubling the shift amount each time, e.g. for 64 bits:
>
> ```
> v += v << 8;
> v += v << 16;
> v += v << 32;
> return v >> 56;
> ```
Or
```
v += v << 32
v += v << 16
v += v << 8
return v >> 56
```
But I think either would work.
https://github.com/llvm/llvm-project/pull/86505
More information about the llvm-commits
mailing list