[llvm] [RISCV][POC] Recursive search for mul expansion (PR #96327)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 10:13:20 PDT 2024


================
@@ -13689,6 +13695,221 @@ static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG,
   return combineSelectAndUseCommutative(N, DAG, /*AllOnes*/ false, Subtarget);
 }
 
+struct Step {
+  unsigned Opcode;
+  uint64_t A;
+  uint64_t B;
+  unsigned Shift = 0;
+};
+
+static bool findMulExpansionRecursive(uint64_t MulAmt, bool HasShlAdd,
+                                      SmallVector<Step> &Path) {
----------------
dtcxzyw wrote:

Can we do decision tree pruning here?
```suggestion
                                      SmallVector<Step> &Path, uint32_t BestPathSize) {
      if (Path.size() + 1 >= BestPathSize)
          return false;
```


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


More information about the llvm-commits mailing list