diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2014-07-17 11:38:22 +0000 |
---|---|---|
committer | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2014-07-17 11:38:22 +0000 |
commit | d86ca7a9c7c27eb968645a12cf8bb1f708c4fed3 (patch) | |
tree | 1318384633f015a0097d282859452031e013c975 /clang/test/CodeGen/mozilla-ms-inline-asm.c | |
parent | 53f3bcf0e9a4a19b60cf2ae80fcefbe1b5a4c847 (diff) | |
download | bcm5719-llvm-d86ca7a9c7c27eb968645a12cf8bb1f708c4fed3.tar.gz bcm5719-llvm-d86ca7a9c7c27eb968645a12cf8bb1f708c4fed3.zip |
Upstream an MS inline assembly test from Mozilla's inline assembly code
Summary:
I'm planning on upstreaming some test cases for the inline assembly
usage in the Mozilla code base. A lot of these test cases test the
recent fixes to this code.
Reviewers: rnk
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4508
llvm-svn: 213255
Diffstat (limited to 'clang/test/CodeGen/mozilla-ms-inline-asm.c')
-rw-r--r-- | clang/test/CodeGen/mozilla-ms-inline-asm.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/clang/test/CodeGen/mozilla-ms-inline-asm.c b/clang/test/CodeGen/mozilla-ms-inline-asm.c new file mode 100644 index 00000000000..0f541d70fcd --- /dev/null +++ b/clang/test/CodeGen/mozilla-ms-inline-asm.c @@ -0,0 +1,61 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | opt -strip -S | FileCheck %s + +// Some test cases for MS inline asm support from Mozilla code base. + +void invoke(void* that, unsigned methodIndex, + unsigned paramCount, void* params) +{ +// CHECK: @invoke +// CHECK: %5 = alloca i8*, align 4 +// CHECK: %6 = alloca i32, align 4 +// CHECK: %7 = alloca i32, align 4 +// CHECK: %8 = alloca i8*, align 4 +// CHECK: store i8* %0, i8** %5, align 4 +// CHECK: store i32 %1, i32* %6, align 4 +// CHECK: store i32 %2, i32* %7, align 4 +// CHECK: store i8* %3, i8** %8, align 4 +// CHECK: call void asm sideeffect inteldialect +// CHECK: mov edx,dword ptr $1 +// CHECK: test edx,edx +// CHECK: jz noparams +// CHECK: mov eax,edx +// CHECK: shl eax,$$3 +// CHECK: sub esp,eax +// CHECK: mov ecx,esp +// CHECK: push dword ptr $0 +// CHECK: call invoke_copy_to_stack +// CHECK: noparams: +// CHECK: mov ecx,dword ptr $2 +// CHECK: push ecx +// CHECK: mov edx,[ecx] +// CHECK: mov eax,dword ptr $3 +// CHECK: call dword ptr[edx+eax*$$4] +// CHECK: mov esp,ebp +// CHECK: pop ebp +// CHECK: ret +// CHECK: "=*m,*m,*m,*m,~{eax},~{ebp},~{ecx},~{edx},~{flags},~{esp},~{dirflag},~{fpsr},~{flags}" +// CHECK: (i8** %8, i32* %7, i8** %5, i32* %6) +// CHECK: ret void + __asm { + mov edx,paramCount + test edx,edx + jz noparams + mov eax,edx + shl eax,3 + sub esp,eax + mov ecx,esp + push params + call invoke_copy_to_stack +noparams: + mov ecx,that + push ecx + mov edx,[ecx] + mov eax,methodIndex + call dword ptr[edx+eax*4] + mov esp,ebp + pop ebp + ret + } +} + |