[llvm] [RISCV] Add 2^N + 2^M expanding pattern for mul (PR #137954)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 10:56:02 PDT 2025


================
@@ -15520,6 +15520,28 @@ static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG,
   return combineSelectAndUseCommutative(N, DAG, /*AllOnes*/ false, Subtarget);
 }
 
+// 2^N +/- 2^M -> (add/sub (shl X, C1), (shl X, C2))
----------------
mshockwave wrote:

I know this comment was copied from the original code, but could we clarify it as:
```
X * (2^C1 +/- 2^C2) -> (add/sub (shl X, C1), (shl X, C2))
```

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


More information about the llvm-commits mailing list