[PATCH] Upstream an MS inline assembly test from Mozilla's inline assembly code
Reid Kleckner
rnk at google.com
Wed Jul 16 15:28:03 PDT 2014
I'm in favor of more tests like this. Please commit with some minor touch ups.
Going forward, I wonder if we can test this on the LLVM side by adding some kind of utility that parses a .test file with some "inline assembly" in a dirt simple language that mostly consists of canned lookup results. Then we could actually test the Intel inline assembly parser changes in LLVM instead of in Clang. Right now it's completely untestable.
================
Comment at: test/CodeGen/mozilla-ms-inline-asm.c:10
@@ +9,3 @@
+// CHECK: @invoke
+// CHECK: %that.addr = alloca i8*, align 4
+// CHECK: %methodIndex.addr = alloca i32, align 4
----------------
Most of these LLVM IR value names are elided in a no-asserts (NDEBUG) build. You can approximate this effect without doing a complete release build and test cycle by piping the IR through 'opt -strip -S' before FileCheck.
================
Comment at: test/CodeGen/mozilla-ms-inline-asm.c:18
@@ +17,3 @@
+// CHECK: store i8* %params, i8** %params.addr, align 4
+// CHECK: call void asm sideeffect inteldialect "mov edx,dword ptr $1\0A\09test edx,edx\0A\09jz noparams\0A\09mov eax,edx\0A\09shl eax,$$3\0A\09sub esp,eax\0A\09mov ecx,esp\0A\09push dword ptr $0\0A\09call invoke_copy_to_stack\0A\09noparams:\0A\09mov ecx,dword ptr $2\0A\09push ecx\0A\09mov edx,[ecx]\0A\09mov eax,dword ptr $3\0A\09call dword ptr[edx+eax*$$4]\0A\09mov esp,ebp\0A\09pop ebp\0A\09ret", "=*m,*m,*m,*m,~{eax},~{ebp},~{ecx},~{edx},~{flags},~{esp},~{dirflag},~{fpsr},~{flags}"(i8** %params.addr, i32* %paramCount.addr, i8** %that.addr, i32* %methodIndex.addr) #1
+// CHECK: ret void
----------------
I would wildcard most of the string literal contents. The only thing worth testing is the instructions that got rewritten and the constraints. Maybe some CHECK lines like:
// CHECK: call void asm sideeffect inteldialect
// CHECK: mov edx,dword ptr $1
// CHECK: mov ecx,dword ptr $2
// CHECK: mov eax,dword ptr $3
// CHECK: call dword ptr[edx+eax*$$4]
// CHECK: "=*m,*m,*m,*m,~{eax},~{ebp},~{ecx},~{edx},~{flags},~{esp},~{dirflag},~{fpsr},~{flags}"
// CHECK: (i8** %params.addr, i32* %paramCount.addr, i8** %that.addr, i32* %methodIndex.addr)
http://reviews.llvm.org/D4508
More information about the cfe-commits
mailing list