From 4a7aa252a32a94b1bb61b3dc7f027b4a27ae334f Mon Sep 17 00:00:00 2001 From: Eric Astor Date: Mon, 30 Dec 2019 14:33:56 -0500 Subject: [X86][AsmParser] re-introduce 'offset' operator Summary: Amend MS offset operator implementation, to more closely fit with its MS counterpart: 1. InlineAsm: evaluate non-local source entities to their (address) location 2. Provide a mean with which one may acquire the address of an assembly label via MS syntax, rather than yielding a memory reference (i.e. "offset asm_label" and "$asm_label" should be synonymous 3. address PR32530 Based on http://llvm.org/D37461 Fix broken test where the break appears unrelated. - Set up appropriate memory-input rewrites for variable references. - Intel-dialect assembly printing now correctly handles addresses by adding "offset". - Pass offsets as immediate operands (using "r" constraint for offsets of locals). Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D71436 --- clang/test/CodeGen/ms-inline-asm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'clang/test/CodeGen/ms-inline-asm.c') diff --git a/clang/test/CodeGen/ms-inline-asm.c b/clang/test/CodeGen/ms-inline-asm.c index 0c9b35a6452..17526f52231 100644 --- a/clang/test/CodeGen/ms-inline-asm.c +++ b/clang/test/CodeGen/ms-inline-asm.c @@ -190,14 +190,20 @@ void t15() { // CHECK: mov eax, $1 __asm mov eax, offset gvar ; eax = address of gvar // CHECK: mov eax, $2 -// CHECK: "*m,r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* @{{.*}}) + __asm mov eax, offset gvar+1 ; eax = 1 + address of gvar +// CHECK: mov eax, $3 + $$1 + __asm mov eax, 1+offset gvar ; eax = 1 + address of gvar +// CHECK: mov eax, $4 + $$1 + __asm mov eax, 1+offset gvar+1 ; eax = 2 + address of gvar +// CHECK: mov eax, $5 + $$2 +// CHECK: "*m,r,i,i,i,i,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* @{{.*}}, i32* @{{.*}}, i32* @{{.*}}, i32* @{{.*}}) } void t16() { int var = 10; - __asm mov [eax], offset var + __asm mov dword ptr [eax], offset var // CHECK: t16 -// CHECK: call void asm sideeffect inteldialect "mov [eax], $0", "r,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}) +// CHECK: call void asm sideeffect inteldialect "mov dword ptr [eax], $0", "r,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}) } void t17() { -- cgit v1.2.3