1 ; RUN: llc < %s -march=x86 -mcpu=core2 -no-integrated-as | FileCheck %s
3 define i32 @t1() nounwind {
5 %0 = tail call i32 asm sideeffect inteldialect "mov eax, $1\0A\09mov $0, eax", "=r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 1) nounwind
8 ; CHECK: {{## InlineAsm Start|#APP}}
13 ; CHECK: {{## InlineAsm End|#NO_APP}}
16 define void @t2() nounwind {
18 call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
21 ; CHECK: {{## InlineAsm Start|#APP}}
22 ; CHECK: .intel_syntax
25 ; CHECK: {{## InlineAsm End|#NO_APP}}
28 define void @t3(i32 %V) nounwind {
30 %V.addr = alloca i32, align 4
31 store i32 %V, i32* %V.addr, align 4
32 call void asm sideeffect inteldialect "mov eax, DWORD PTR [$0]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %V.addr) nounwind
35 ; CHECK: {{## InlineAsm Start|#APP}}
36 ; CHECK: .intel_syntax
37 ; CHECK: mov eax, DWORD PTR {{[[esp]}}
39 ; CHECK: {{## InlineAsm End|#NO_APP}}
42 %struct.t18_type = type { i32, i32 }
44 define i32 @t18() nounwind {
46 %foo = alloca %struct.t18_type, align 4
47 %a = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 0
48 store i32 1, i32* %a, align 4
49 %b = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 1
50 store i32 2, i32* %b, align 4
51 call void asm sideeffect inteldialect "lea ebx, foo\0A\09mov eax, [ebx].0\0A\09mov [ebx].4, ecx", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
52 %b1 = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 1
53 %0 = load i32* %b1, align 4
56 ; CHECK: {{## InlineAsm Start|#APP}}
57 ; CHECK: .intel_syntax
59 ; CHECK: mov eax, [ebx].0
60 ; CHECK: mov [ebx].4, ecx
62 ; CHECK: {{## InlineAsm End|#NO_APP}}
65 define void @t19_helper() nounwind {
70 define void @t19() nounwind {
72 call void asm sideeffect inteldialect "call $0", "r,~{dirflag},~{fpsr},~{flags}"(void ()* @t19_helper) nounwind
75 ; CHECK: movl ${{_?}}t19_helper, %eax
76 ; CHECK: {{## InlineAsm Start|#APP}}
77 ; CHECK: .intel_syntax
80 ; CHECK: {{## InlineAsm End|#NO_APP}}
83 @results = global [2 x i32] [i32 3, i32 2], align 4
85 define i32* @t30() nounwind ssp {
87 %res = alloca i32*, align 4
88 call void asm sideeffect inteldialect "lea edi, dword ptr $0", "*m,~{edi},~{dirflag},~{fpsr},~{flags}"([2 x i32]* @results) nounwind
89 call void asm sideeffect inteldialect "mov dword ptr $0, edi", "=*m,~{dirflag},~{fpsr},~{flags}"(i32** %res) nounwind
90 %0 = load i32** %res, align 4
93 ; CHECK: {{## InlineAsm Start|#APP}}
94 ; CHECK: .intel_syntax
95 ; CHECK: lea edi, dword ptr [{{_?}}results]
97 ; CHECK: {{## InlineAsm End|#NO_APP}}
98 ; CHECK: {{## InlineAsm Start|#APP}}
99 ; CHECK: .intel_syntax
100 ; CHECK: mov dword ptr [esp], edi
102 ; CHECK: {{## InlineAsm End|#NO_APP}}
103 ; CHECK: movl (%esp), %eax
106 ; Stack realignment plus MS inline asm that does *not* adjust the stack is no
111 %val = alloca i32, align 64
112 store i32 -1, i32* %val, align 64
113 call void asm sideeffect inteldialect "mov dword ptr $0, esp", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %val) #1
114 %sp = load i32* %val, align 64
118 ; CHECK: movl %esp, %ebp
119 ; CHECK: andl $-64, %esp
120 ; CHECK: {{## InlineAsm Start|#APP}}
121 ; CHECK: .intel_syntax
122 ; CHECK: mov dword ptr [esp], esp
124 ; CHECK: {{## InlineAsm End|#NO_APP}}
125 ; CHECK: movl (%esp), %eax