[llvm] [RISCV] Expand mul to shNadd x, (slli x, c) in DAGCombine (PR #88524)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 10:38:25 PDT 2024


================
@@ -13356,10 +13356,56 @@ static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG,
   return combineSelectAndUseCommutative(N, DAG, /*AllOnes*/ false, Subtarget);
 }
 
-static SDValue performMULCombine(SDNode *N, SelectionDAG &DAG) {
+// Try to expand a scalar multiply to a faster sequence.
+static SDValue expandMul(SDNode *N, SelectionDAG &DAG,
+                         TargetLowering::DAGCombinerInfo &DCI,
+                         const RISCVSubtarget &Subtarget) {
+
   EVT VT = N->getValueType(0);
-  if (!VT.isVector())
+
+  // An imul is usually smaller than the alternative sequence.
----------------
topperc wrote:

imul is an X86 instruction name

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


More information about the llvm-commits mailing list