[llvm] [AArch64][Win] Work around an MSVC arm64 compiler bug (PR #67865)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 16:56:45 PDT 2023


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 f88f090a2ef1eae500db9c398059a0eb4907ab4e e5f28f53c1e86bdc01c19f7aacb8444db4fbc4e3 -- llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
index 597abc5fd..03cbd2727 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
@@ -591,11 +591,12 @@ static inline uint64_t decodeAdvSIMDModImmType9(uint8_t Imm) {
 // aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg hhhhhhhh
 // cmode: 1110, op: 1
 static inline bool isAdvSIMDModImmType10(uint64_t Imm) {
-#if defined(_MSC_VER) && _MSC_VER == 1937 && !defined(__clang__) && defined(_M_ARM64)
-// The MSVC compiler 19.37 for ARM64 has an optimization bug that
-// causes an incorrect behavior with the orignal version. Work around
-// by using a slightly different variation.
-// https://developercommunity.visualstudio.com/t/C-ARM64-compiler-optimization-bug/10481261
+#if defined(_MSC_VER) && _MSC_VER == 1937 && !defined(__clang__) &&            \
+    defined(_M_ARM64)
+  // The MSVC compiler 19.37 for ARM64 has an optimization bug that
+  // causes an incorrect behavior with the orignal version. Work around
+  // by using a slightly different variation.
+  // https://developercommunity.visualstudio.com/t/C-ARM64-compiler-optimization-bug/10481261
   constexpr uint64_t Mask = 0xFFULL;
   uint64_t ByteA = (Imm >> 56) & Mask;
   uint64_t ByteB = (Imm >> 48) & Mask;
@@ -606,14 +607,10 @@ static inline bool isAdvSIMDModImmType10(uint64_t Imm) {
   uint64_t ByteG = (Imm >> 8) & Mask;
   uint64_t ByteH = Imm & Mask;
 
-  return (ByteA == 0ULL || ByteA == Mask) &&
-         (ByteB == 0ULL || ByteB == Mask) &&
-         (ByteC == 0ULL || ByteC == Mask) &&
-         (ByteD == 0ULL || ByteD == Mask) &&
-         (ByteE == 0ULL || ByteE == Mask) &&
-         (ByteF == 0ULL || ByteF == Mask) &&
-         (ByteG == 0ULL || ByteG == Mask) &&
-         (ByteH == 0ULL || ByteH == Mask);
+  return (ByteA == 0ULL || ByteA == Mask) && (ByteB == 0ULL || ByteB == Mask) &&
+         (ByteC == 0ULL || ByteC == Mask) && (ByteD == 0ULL || ByteD == Mask) &&
+         (ByteE == 0ULL || ByteE == Mask) && (ByteF == 0ULL || ByteF == Mask) &&
+         (ByteG == 0ULL || ByteG == Mask) && (ByteH == 0ULL || ByteH == Mask);
 #else
   uint64_t ByteA = Imm & 0xff00000000000000ULL;
   uint64_t ByteB = Imm & 0x00ff000000000000ULL;

``````````

</details>


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


More information about the llvm-commits mailing list