1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | opt -passes=strip -S | FileCheck %s
4 // Some test cases for MS inline asm support from Mozilla code base.
6 void invoke_copy_to_stack() {}
8 void invoke(void* that
, unsigned methodIndex
,
9 unsigned paramCount
, void* params
)
12 // CHECK: %5 = alloca ptr, align 4
13 // CHECK: %6 = alloca i32, align 4
14 // CHECK: %7 = alloca i32, align 4
15 // CHECK: %8 = alloca ptr, align 4
16 // CHECK: store ptr %0, ptr %5, align 4
17 // CHECK: store i32 %1, ptr %6, align 4
18 // CHECK: store i32 %2, ptr %7, align 4
19 // CHECK: store ptr %3, ptr %8, align 4
20 // CHECK: call void asm sideeffect inteldialect
21 // CHECK-SAME: mov edx,$1
22 // CHECK-SAME: test edx,edx
23 // CHECK-SAME: jz {{[^_]*}}__MSASMLABEL_.${:uid}__noparams
24 // ^ Can't use {{.*}} here because the matching is greedy.
25 // CHECK-SAME: mov eax,edx
26 // CHECK-SAME: shl eax,$$3
27 // CHECK-SAME: sub esp,eax
28 // CHECK-SAME: mov ecx,esp
29 // CHECK-SAME: push $0
30 // CHECK-SAME: call ${2:P}
31 // CHECK-SAME: {{.*}}__MSASMLABEL_.${:uid}__noparams:
32 // CHECK-SAME: mov ecx,$3
33 // CHECK-SAME: push ecx
34 // CHECK-SAME: mov edx,[ecx]
35 // CHECK-SAME: mov eax,$4
36 // CHECK-SAME: call dword ptr[edx + eax * $$4]
37 // CHECK-SAME: mov esp,ebp
38 // CHECK-SAME: pop ebp
40 // CHECK: "=*m,*m,*m,*m,*m,~{eax},~{ebp},~{ecx},~{edx},~{flags},~{esp},~{dirflag},~{fpsr},~{flags}"
41 // CHECK: (ptr elementtype(ptr) %8, ptr elementtype(i32) %7, ptr elementtype(void (...)) @invoke_copy_to_stack, ptr elementtype(ptr) %5, ptr elementtype(i32) %6)
52 call invoke_copy_to_stack
58 call dword ptr
[edx
+eax
*4]