[llvm] [RISCV] Strength reduce mul by 2^n + 2/4/8 + 1 (PR #88911)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 09:41:38 PDT 2024


================
@@ -13431,6 +13431,34 @@ static SDValue expandMul(SDNode *N, SelectionDAG &DAG,
       return DAG.getNode(ISD::ADD, DL, VT, Shift1, Shift2);
     }
   }
+
+  // (2^(1,2,3) * 3,5,9 + 1 -> (shXadd (shYadd x, x), x)
+  // Matched in tablegen, avoid perturbing patterns.
+  switch (MulAmt) {
+  case 11: case 13: case 19: case 21: case 25: case 27: case 29:
----------------
mshockwave wrote:

I guess clang-format did this, is this your desired formatting as well?

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


More information about the llvm-commits mailing list