On Mon, Jul 14, 2014 at 8:35 PM, Ehsan Akhgari <[email protected]> wrote:
> Hi rnk, > > 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. > The recent fixes probably already included tests. Does this test anything in addition to that? If so, can the test be named after what it tests? > > http://reviews.llvm.org/D4508 > > Files: > test/CodeGen/mozilla-ms-inline-asm.c > > Index: test/CodeGen/mozilla-ms-inline-asm.c > =================================================================== > --- /dev/null > +++ test/CodeGen/mozilla-ms-inline-asm.c > @@ -0,0 +1,41 @@ > +// REQUIRES: x86-registered-target > +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm > -o - | 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: %that.addr = alloca i8*, align 4 > +// CHECK: %methodIndex.addr = alloca i32, align 4 > +// CHECK: %paramCount.addr = alloca i32, align 4 > +// CHECK: %params.addr = alloca i8*, align 4 > +// CHECK: store i8* %that, i8** %that.addr, align 4 > +// CHECK: store i32 %methodIndex, i32* %methodIndex.addr, align 4 > +// CHECK: store i32 %paramCount, i32* %paramCount.addr, align 4 > +// 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 > + __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 > + } > +} > + > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
