[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)
----------------
mshockwave wrote:

nit:
```suggestion
  // 2^(1,2,3) * 3,5,9 + 1 -> (shXadd (shYadd x, x), x)
```
or 
```suggestion
  // (2^(1,2,3) * 3,5,9 + 1 -> (shXadd (shYadd x, x), x))
```

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


More information about the llvm-commits mailing list