[llvm] [SDAG] Use shifts if ISD::MUL is illegal when lowering ISD::CTPOP (PR #86505)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 07:28:44 PDT 2024


jayfoad 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;
```

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


More information about the llvm-commits mailing list