[llvm] [RISCV] Expand constant multiplication for targets without M extension (PR #137195)
Iris Shi via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 26 09:13:33 PDT 2025
================
@@ -15436,6 +15439,134 @@ static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG,
return combineSelectAndUseCommutative(N, DAG, /*AllOnes*/ false, Subtarget);
}
+static SDValue expandMulToNAFSequence(SDNode *N, SelectionDAG &DAG,
+ const SDLoc &DL, uint64_t MulAmt) {
+ EVT VT = N->getValueType(0);
+ const uint64_t BitWidth = VT.getFixedSizeInBits();
+
+ // Find the Non-adjacent form of the multiplier.
+ llvm::SmallVector<std::pair<bool, uint64_t>> Sequence; // {isAdd, shamt}
+ for (auto E = MulAmt, I = 0; E && I < BitWidth; ++I, E >>= 1) {
----------------
el-ev wrote:
```suggestion
for (uint64_t E = MulAmt, I = 0; E && I < BitWidth; ++I, E >>= 1) {
```
https://github.com/llvm/llvm-project/pull/137195
More information about the llvm-commits
mailing list