[llvm] [RISCV] Strength reduce mul by 2^N - 2^M (PR #88983)

Brandon Wu via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 08:20:57 PDT 2024


================
@@ -13474,6 +13476,19 @@ static SDValue expandMul(SDNode *N, SelectionDAG &DAG,
     }
   }
 
+  // 2^N - 2^M -> (sub (shl X, C1), (shl X, C2))
----------------
4vtomat wrote:

One stupid question: Why does it can't be signed int 12 in this line?
https://github.com/llvm/llvm-project/blob/5d314353fbec1a15cd8900f466dcdcf2af40e8c9/llvm/lib/Target/RISCV/RISCVISelLowering.cpp#L20626

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


More information about the llvm-commits mailing list