[llvm] [RISCV] Expand mul X, C where C=2^N*(3, 5, 9)*(3, 5, 9) (PR #108100)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 17:54:00 PDT 2024
- Previous message: [llvm] [RISCV] Expand mul X, C where C=2^N*(3, 5, 9)*(3, 5, 9) (PR #108100)
- Next message: [llvm] [RISCV] Expand mul X, C where C=2^N*(3, 5, 9)*(3, 5, 9) (PR #108100)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
================
@@ -14131,6 +14131,32 @@ static SDValue expandMul(SDNode *N, SelectionDAG &DAG,
return DAG.getNode(ISD::SUB, DL, VT, Shift1, Shift2);
}
+ if (HasShlAdd) {
+ for (uint64_t Divisor : {3, 5, 9}) {
+ if (MulAmt % Divisor != 0)
+ continue;
+ uint64_t MulAmt2 = MulAmt / Divisor;
+ // 3/5/9 * 3/5/9 * 2^N - In particular, this covers multiples
+ // of 25 which happen to be quite common.
+ for (uint64_t Divisor2 : {3, 5, 9}) {
+ if (MulAmt2 % Divisor2 != 0)
+ continue;
+ uint64_t MulAmt3 = MulAmt2 / Divisor;
----------------
dtcxzyw wrote:
```suggestion
uint64_t MulAmt3 = MulAmt2 / Divisor2;
```
https://github.com/llvm/llvm-project/pull/108100
- Previous message: [llvm] [RISCV] Expand mul X, C where C=2^N*(3, 5, 9)*(3, 5, 9) (PR #108100)
- Next message: [llvm] [RISCV] Expand mul X, C where C=2^N*(3, 5, 9)*(3, 5, 9) (PR #108100)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the llvm-commits
mailing list