[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / ms-inline-asm-64.c
blob7c9a9f2e2bb2e867d76d661bbf166e2c6c4f7419
1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -Wno-strict-prototypes -fasm-blocks -emit-llvm -o - | FileCheck %s
4 void t1(void) {
5 int var = 10;
6 __asm mov rax, offset var ; rax = address of myvar
7 // CHECK: t1
8 // CHECK: call void asm sideeffect inteldialect
9 // CHECK-SAME: mov rax, $0
10 // CHECK-SAME: "r,~{rax},~{dirflag},~{fpsr},~{flags}"(ptr %{{.*}})
13 void t2(void) {
14 int var = 10;
15 __asm mov qword ptr [eax], offset var
16 // CHECK: t2
17 // CHECK: call void asm sideeffect inteldialect
18 // CHECK-SAME: mov qword ptr [eax], $0
19 // CHECK-SAME: "r,~{dirflag},~{fpsr},~{flags}"(ptr %{{.*}})
22 struct t3_type { int a, b; };
24 int t3(void) {
25 struct t3_type foo;
26 foo.a = 1;
27 foo.b = 2;
28 __asm {
29 lea ebx, foo
30 mov eax, [ebx].0
31 mov [ebx].4, ecx
33 return foo.b;
34 // CHECK: t3
35 // CHECK: call void asm sideeffect inteldialect
36 // CHECK-SAME: lea ebx, $0
37 // CHECK-SAME: mov eax, [ebx]
38 // CHECK-SAME: mov [ebx + $$4], ecx
39 // CHECK-SAME: "*m,~{eax},~{ebx},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(%struct.t3_type) %{{.*}})
42 int t4(void) {
43 struct t3_type foo;
44 foo.a = 1;
45 foo.b = 2;
46 __asm {
47 lea ebx, foo
49 mov eax, [ebx].foo.a
51 mov [ebx].foo.b, ecx
53 return foo.b;
54 // CHECK: t4
55 // CHECK: call void asm sideeffect inteldialect
56 // CHECK-SAME: lea ebx, $0
57 // CHECK-SAME: mov eax, [ebx]
58 // CHECK-SAME: mov [ebx + $$4], ecx
59 // CHECK-SAME: "*m,~{eax},~{ebx},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(%struct.t3_type) %{{.*}})
62 void bar() {}
64 void t5(void) {
65 __asm {
66 call bar
67 jmp bar
69 // CHECK: t5
70 // CHECK: call void asm sideeffect inteldialect
71 // CHECK-SAME: call qword ptr ${0:P}
72 // CHECK-SAME: jmp qword ptr ${1:P}
73 // CHECK-SAME: "*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (...)) @bar, ptr elementtype(void (...)) @bar)