From 03277e7fb4d12f0d15dc2c97787fc89ecdaecf94 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 1 Jan 2011 20:58:46 +0000 Subject: [PATCH] Add support for the 'H' modifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122667 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86AsmPrinter.cpp | 6 ++++++ test/CodeGen/X86/inline-asm-h.ll | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/CodeGen/X86/inline-asm-h.ll diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index d0aa2900c05..5c5f99903fe 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -302,6 +302,9 @@ void X86AsmPrinter::printLeaMemReference(const MachineInstr *MI, unsigned Op, printSymbolOperand(MI->getOperand(Op+3), O); } + if (Modifier && strcmp(Modifier, "H") == 0) + O << "+8"; + if (HasParenPart) { assert(IndexReg.getReg() != X86::ESP && "X86 doesn't allow scaling by ESP"); @@ -458,6 +461,9 @@ bool X86AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, case 'q': // Print SImode register // These only apply to registers, ignore on mem. break; + case 'H': + printMemReference(MI, OpNo, O, "H"); + return false; case 'P': // Don't print @PLT, but do print as memory. printMemReference(MI, OpNo, O, "no-rip"); return false; diff --git a/test/CodeGen/X86/inline-asm-h.ll b/test/CodeGen/X86/inline-asm-h.ll new file mode 100644 index 00000000000..7f83c3ad708 --- /dev/null +++ b/test/CodeGen/X86/inline-asm-h.ll @@ -0,0 +1,12 @@ +; RUN: llc -march=x86-64 < %s | FileCheck %s + +@foobar = common global i32 0, align 4 + +define void @zed() nounwind { +entry: + call void asm "movq %mm2,${0:H}", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* @foobar) nounwind + ret void +} + +; CHECK: zed +; CHECK: movq %mm2,foobar+8(%rip) -- 2.34.1