1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
; RUN: llc < %s -march=x86 | FileCheck %s
define i32 @t1() nounwind {
entry:
%0 = tail call i32 asm sideeffect inteldialect "mov eax, $1\0A\09mov $0, eax", "=r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 1) nounwind
ret i32 %0
; CHECK: t1
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, ecx
; CHECK: mov ecx, eax
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
}
define void @t2() nounwind {
entry:
call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
ret void
; CHECK: t2
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, 1
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
}
define void @t3(i32 %V) nounwind {
entry:
%V.addr = alloca i32, align 4
store i32 %V, i32* %V.addr, align 4
call void asm sideeffect inteldialect "mov eax, DWORD PTR [$0]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %V.addr) nounwind
ret void
; CHECK: t3
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, DWORD PTR {{[[esp]}}
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
}
%struct.t18_type = type { i32, i32 }
define i32 @t18() nounwind {
entry:
%foo = alloca %struct.t18_type, align 4
%a = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 0
store i32 1, i32* %a, align 4
%b = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 1
store i32 2, i32* %b, align 4
call void asm sideeffect inteldialect "lea ebx, foo\0A\09mov eax, [ebx].0\0A\09mov [ebx].4, ecx", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
%b1 = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 1
%0 = load i32* %b1, align 4
ret i32 %0
; CHECK: t18
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: lea ebx, foo
; CHECK: mov eax, [ebx].0
; CHECK: mov [ebx].4, ecx
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
}
define void @t21() nounwind {
; CHECK: t21
entry:
br label %foo
foo: ; preds = %entry
call void asm sideeffect inteldialect "mov eax, [4*eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [4*eax + 4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [4*eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [4*eax][4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi + eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi + eax]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi][eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi][eax]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi + 4*eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi + 4*eax]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi][4*eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi][4*eax]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi + eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi + eax + 4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi][eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi][eax + 4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi + eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi + eax][4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi][eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi][eax][4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi + 2*eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi + 2*eax + 4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi][2*eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi][2*eax + 4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi + 2*eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi + 2*eax][4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
call void asm sideeffect inteldialect "mov eax, [esi][2*eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
; CHECK: {{## InlineAsm Start|#APP}}
; CHECK: .intel_syntax
; CHECK: mov eax, [esi][2*eax][4]
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
ret void
}
|