[llvm] [RISCV] Expand constant multiplication for targets without M extension (PR #137195)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 05:22:53 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 3a2b633e8..0206838be 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -15503,28 +15503,28 @@ static SDValue expandMulToBasicOps(SDNode *N, SelectionDAG &DAG,
}
llvm::SmallVector<std::pair<bool, uint64_t>> Factors; // {is_2^M+1, M}
-
- while (E > 1) {
- bool Found = false;
- for (int64_t I = BitWidth - 1; I >= 2; --I) {
- uint64_t Factor = 1ULL << I;
-
- if (E % (Factor - 1) == 0) {
- Factors.push_back({false, I});
- E /= Factor - 1;
- Found = true;
- break;
- }
- if (E % (Factor + 1) == 0) {
- Factors.push_back({true, I});
- E /= Factor + 1;
- Found = true;
- break;
- }
+ while (E > 1) {
+ bool Found = false;
+ for (int64_t I = BitWidth - 1; I >= 2; --I) {
+ uint64_t Factor = 1ULL << I;
+
+ if (E % (Factor - 1) == 0) {
+ Factors.push_back({false, I});
+ E /= Factor - 1;
+ Found = true;
+ break;
}
- if (!Found)
+
+ if (E % (Factor + 1) == 0) {
+ Factors.push_back({true, I});
+ E /= Factor + 1;
+ Found = true;
break;
+ }
+ }
+ if (!Found)
+ break;
}
SDValue Result;
``````````
</details>
https://github.com/llvm/llvm-project/pull/137195
More information about the llvm-commits
mailing list