[llvm] [CodeGen] Use 128bits for LaneBitmask. (PR #111157)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 06:56:04 PDT 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 206408732bca2ef464732a39c8319d47c8a1dbea a782fcf51af8d832c372396ad52c24029723028a --extensions cpp,inc,h -- llvm/unittests/MC/LaneBitmaskTest.cpp llvm/include/llvm/CodeGen/RDFLiveness.h llvm/include/llvm/CodeGen/RDFRegisters.h llvm/include/llvm/MC/LaneBitmask.h llvm/lib/CodeGen/MIRParser/MIParser.cpp llvm/lib/CodeGen/MIRPrinter.cpp llvm/lib/CodeGen/RDFRegisters.cpp llvm/lib/Target/AMDGPU/SIRegisterInfo.h llvm/unittests/CodeGen/MFCommon.inc llvm/utils/TableGen/RegisterInfoEmitter.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/MC/LaneBitmask.h b/llvm/include/llvm/MC/LaneBitmask.h
index ba22257c65..a985747738 100644
--- a/llvm/include/llvm/MC/LaneBitmask.h
+++ b/llvm/include/llvm/MC/LaneBitmask.h
@@ -53,7 +53,8 @@ struct LaneBitmask {
       llvm_unreachable("Unsupported bitwidth");
     }
   }
-  constexpr explicit LaneBitmask(uint64_t Lo = 0, uint64_t Hi = 0) : Mask{Lo, Hi} {}
+  constexpr explicit LaneBitmask(uint64_t Lo = 0, uint64_t Hi = 0)
+      : Mask{Lo, Hi} {}
 
   constexpr bool operator==(LaneBitmask M) const {
     return Mask[0] == M.Mask[0] && Mask[1] == M.Mask[1];
@@ -68,7 +69,9 @@ struct LaneBitmask {
   constexpr bool any() const { return Mask[0] != 0 || Mask[1] != 0; }
   constexpr bool all() const { return ~Mask[0] == 0 && ~Mask[1] == 0; }
 
-  constexpr LaneBitmask operator~() const { return LaneBitmask(~Mask[0], ~Mask[1]); }
+  constexpr LaneBitmask operator~() const {
+    return LaneBitmask(~Mask[0], ~Mask[1]);
+  }
   constexpr LaneBitmask operator|(LaneBitmask M) const {
     return LaneBitmask(Mask[0] | M.Mask[0], Mask[1] | M.Mask[1]);
   }
@@ -87,7 +90,9 @@ struct LaneBitmask {
   }
 
   APInt getAsAPInt() const { return APInt(BitWidth, {Mask[0], Mask[1]}); }
-  constexpr std::pair<uint64_t, uint64_t> getAsPair() const { return {Mask[0], Mask[1]}; }
+  constexpr std::pair<uint64_t, uint64_t> getAsPair() const {
+    return {Mask[0], Mask[1]};
+  }
 
   unsigned getNumLanes() const {
     return Mask[1] ? llvm::popcount(Mask[1]) + llvm::popcount(Mask[0])
diff --git a/llvm/unittests/CodeGen/MFCommon.inc b/llvm/unittests/CodeGen/MFCommon.inc
index 720c5e4358..583c0281b7 100644
--- a/llvm/unittests/CodeGen/MFCommon.inc
+++ b/llvm/unittests/CodeGen/MFCommon.inc
@@ -23,8 +23,8 @@ class BogusRegisterInfo : public TargetRegisterInfo {
 public:
   BogusRegisterInfo()
       : TargetRegisterInfo(nullptr, BogusRegisterClasses, BogusRegisterClasses,
-                           nullptr, nullptr, nullptr, LaneBitmask::getAll(), nullptr,
-                           nullptr) {
+                           nullptr, nullptr, nullptr, LaneBitmask::getAll(),
+                           nullptr, nullptr) {
     InitMCRegisterInfo(nullptr, 0, 0, 0, nullptr, 0, nullptr, 0, nullptr,
                        nullptr, nullptr, nullptr, nullptr, 0, nullptr);
   }
diff --git a/llvm/unittests/MC/LaneBitmaskTest.cpp b/llvm/unittests/MC/LaneBitmaskTest.cpp
index d7762122e0..d29bdfa520 100644
--- a/llvm/unittests/MC/LaneBitmaskTest.cpp
+++ b/llvm/unittests/MC/LaneBitmaskTest.cpp
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "gtest/gtest.h"
 #include "llvm/MC/LaneBitmask.h"
 #include "llvm/Support/raw_ostream.h"
+#include "gtest/gtest.h"
 #include <string>
 
 using namespace llvm;
diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index bf8aea096c..4a5b05b381 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -653,8 +653,7 @@ static DiffVec &diffEncode(DiffVec &V, unsigned InitVal, Iter Begin, Iter End) {
 static void printDiff16(raw_ostream &OS, int16_t Val) { OS << Val; }
 
 static void printMask(raw_ostream &OS, LaneBitmask Val) {
-  OS << "LaneBitmask("
-     << PrintLaneMask(Val, /*FormatAsCLiteral=*/true) << ")";
+  OS << "LaneBitmask(" << PrintLaneMask(Val, /*FormatAsCLiteral=*/true) << ")";
 }
 
 // Try to combine Idx's compose map into Vec if it is compatible.

``````````

</details>


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


More information about the llvm-commits mailing list