[llvm] [GISel] Add support for scalable vectors in getGCDType (PR #80307)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 1 08:33:35 PST 2024
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 0d965080b48c5661d7cc5d043be19a6a72165001 c8b5b524aafe7ea87da29baf71734b0d717a992a -- llvm/include/llvm/CodeGen/GlobalISel/Utils.h llvm/lib/CodeGen/GlobalISel/Utils.cpp llvm/unittests/CodeGen/GlobalISel/GISelUtilsTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp
index 0f2def47ec..8fa3e47c74 100644
--- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp
@@ -1150,23 +1150,23 @@ LLT llvm::getGCDType(LLT OrigTy, LLT TargetTy) {
llvm_unreachable(
"getGCDType not implemented between fixed and scalable vectors.");
- unsigned GCD = std::gcd(OrigTy.getElementCount().getKnownMinValue() *
- OrigElt.getSizeInBits().getFixedValue(),
- TargetTy.getElementCount().getKnownMinValue() *
- TargetElt.getSizeInBits().getFixedValue());
- if (GCD == OrigElt.getSizeInBits())
- return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()),
- OrigElt);
-
- // Cannot produce original element type, but both have vscale in common.
- if (GCD < OrigElt.getSizeInBits())
- return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()),
- GCD);
-
- return LLT::vector(
- ElementCount::get(GCD / OrigElt.getSizeInBits().getFixedValue(),
- OrigTy.isScalable()),
- OrigElt);
+ unsigned GCD = std::gcd(OrigTy.getElementCount().getKnownMinValue() *
+ OrigElt.getSizeInBits().getFixedValue(),
+ TargetTy.getElementCount().getKnownMinValue() *
+ TargetElt.getSizeInBits().getFixedValue());
+ if (GCD == OrigElt.getSizeInBits())
+ return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()),
+ OrigElt);
+
+ // Cannot produce original element type, but both have vscale in common.
+ if (GCD < OrigElt.getSizeInBits())
+ return LLT::scalarOrVector(ElementCount::get(1, OrigTy.isScalable()),
+ GCD);
+
+ return LLT::vector(
+ ElementCount::get(GCD / OrigElt.getSizeInBits().getFixedValue(),
+ OrigTy.isScalable()),
+ OrigElt);
}
// If one type is vector and the element size matches the scalar size, then
``````````
</details>
https://github.com/llvm/llvm-project/pull/80307
More information about the llvm-commits
mailing list