[llvm] [RISCV] Lower (select c, (1 << X) + 1, 0) -> (shXadd c, c) (PR #158969)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 08:51:55 PDT 2025


preames wrote:

Nice one.  Thinking about this, we could potentially reuse many of our tricks from expandMul for this.  For instance, {3,5,9}*2*N is just a shNadd + slli.  I hadn't really thought of the select c, C1, 0 case as being a general c * C1, but it definitely is.  

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


More information about the llvm-commits mailing list