[PATCH] D144183: [X86][MC] Fix the bug of -output-asm-variant=1 for intel syntax

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 17:54:12 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf277ec67efd: [X86][MC] Fix the bug of -output-asm-variant=1 for intel syntax (authored by skan).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144183/new/

https://reviews.llvm.org/D144183

Files:
  llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp
  llvm/test/MC/Disassembler/X86/intel-syntax.txt


Index: llvm/test/MC/Disassembler/X86/intel-syntax.txt
===================================================================
--- llvm/test/MC/Disassembler/X86/intel-syntax.txt
+++ llvm/test/MC/Disassembler/X86/intel-syntax.txt
@@ -171,4 +171,11 @@
 # CHECK: lea	rcx, [rsp + 4]
 0x48 0x8d 0x4c 0x24 0x04 
 
+# CHECK: lea	rcx, [1*rax]
+0x48 0x8d 0x0c 0x05 0x00 0x00 0x00 0x00
 
+# CHECK: lea	rcx, [1*rax + 4]
+0x48 0x8d 0x0c 0x05 0x04 0x00 0x00 0x00
+
+# CHECK: lea	rcx, [2*rax]
+0x48 0x8d 0x0c 0x45 0x00 0x00 0x00 0x00
Index: llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp
@@ -398,7 +398,7 @@
 
   if (IndexReg.getReg()) {
     if (NeedPlus) O << " + ";
-    if (ScaleVal != 1)
+    if (ScaleVal != 1 || !BaseReg.getReg())
       O << ScaleVal << '*';
     printOperand(MI, Op+X86::AddrIndexReg, O);
     NeedPlus = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144183.498212.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230217/fb07a490/attachment.bin>


More information about the llvm-commits mailing list