[llvm] X86 data v2 (PR #156287)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 02:46:26 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 origin/main HEAD --extensions cpp -- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 211aa47e4..73487af52 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -3525,7 +3525,7 @@ bool X86AsmParser::parseInstruction(ParseInstructionInfo &Info, StringRef Name,
   // Hacks to handle 'data16' and 'data32'
   if (PatchedName == "data16") {
     if (is16BitMode())
-        return Error(NameLoc, "redundant data16 prefix");
+      return Error(NameLoc, "redundant data16 prefix");
     if (is64BitMode())
       return Error(NameLoc, "'data16' is not supported in 64-bit mode");
     if (getLexer().isNot(AsmToken::EndOfStatement)) {
@@ -4559,19 +4559,23 @@ bool X86AsmParser::matchAndEmitIntelInstruction(
       // Determine the size. Prioritize the ForcedDataPrefix flag if it was set
       // by a 'data32' prefix. Otherwise, fall back to the pointer width of the
       // current mode.
-      unsigned Size = (ForcedDataPrefix == X86::Is32Bit) ? 32
-                    : (ForcedDataPrefix == X86::Is16Bit) ? 16
-                    : getPointerWidth();
+      unsigned Size = (ForcedDataPrefix == X86::Is32Bit)   ? 32
+                      : (ForcedDataPrefix == X86::Is16Bit) ? 16
+                                                           : getPointerWidth();
       ForcedDataPrefix = 0;
       if (CE &&
           (isIntN(Size, CE->getValue()) || isUIntN(Size, CE->getValue()))) {
         SmallString<16> Tmp;
         Tmp += Base;
         // Append the suffix corresponding to the determined size.
-        if (Size == 64) Tmp += "q";
-        else if (Size == 32) Tmp += "l";
-        else if (Size == 16) Tmp += "w";
-        else Tmp += " ";
+        if (Size == 64)
+          Tmp += "q";
+        else if (Size == 32)
+          Tmp += "l";
+        else if (Size == 16)
+          Tmp += "w";
+        else
+          Tmp += " ";
         Op.setTokenValue(Tmp);
         // Do match in ATT mode to allow explicit suffix usage.
         Match.push_back(MatchInstruction(Operands, Inst, ErrorInfo,

``````````

</details>


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


More information about the llvm-commits mailing list