From f6163dc85691bbccccd029c607d1d5f0b2944fd9 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 25 Aug 2009 00:16:14 +0000 Subject: [PATCH] Fix PR 4751, another difficulty with %a modifier on x86. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79961 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../X86/AsmPrinter/X86ATTAsmPrinter.cpp | 4 ++++ test/CodeGen/X86/asm-modifier.ll | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index a2abbc20312..e1b6263a7ad 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -625,6 +625,10 @@ bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, O << MO.getImm(); return false; } + if (MO.isGlobal() || MO.isCPI() || MO.isJTI() || MO.isSymbol()) { + printSymbolOperand(MO); + return false; + } if (MO.isReg()) { O << '('; printOperand(MI, OpNo); diff --git a/test/CodeGen/X86/asm-modifier.ll b/test/CodeGen/X86/asm-modifier.ll index 8bd5509e969..10a362f369a 100644 --- a/test/CodeGen/X86/asm-modifier.ll +++ b/test/CodeGen/X86/asm-modifier.ll @@ -19,3 +19,23 @@ entry: %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; [#uses=1] ret i16 %asmtmp } + +@n = global i32 42 ; [#uses=3] +@y = common global i32 0 ; [#uses=3] + +define void @test3() nounwind { +entry: +; CHECK: test3: +; CHECK: movl _n, %eax + call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(i32* @n) nounwind + ret void +} + +define void @test4() nounwind { +entry: +; CHECK: test4: +; CHECK: movl L_y$non_lazy_ptr, %ecx +; CHECK: movl (%ecx), %eax + call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(i32* @y) nounwind + ret void +}