• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple i686 -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64 -emit-llvm %s -o - | FileCheck %s
3 
4 int mout0;
5 int min1;
6 int marray[2];
7 double dout0;
8 double din1;
9 
10 // CHECK: @single_R
single_R()11 void single_R()
12 {
13   // CHECK: asm "foo $1,$0", "=R,R[[CLOBBERS:[a-zA-Z0-9@%{},~_ ]*\"]](i32 {{[a-zA-Z0-9@%]+}})
14   asm("foo %1,%0" : "=R" (mout0) : "R" (min1));
15 }
16 
17 // CHECK: @single_q
single_q()18 void single_q()
19 {
20   // CHECK: asm "foo $1,$0", "=q,q[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
21   asm("foo %1,%0" : "=q" (mout0) : "q" (min1));
22 }
23 
24 // CHECK: @single_Q
single_Q()25 void single_Q()
26 {
27   // CHECK: asm "foo $1,$0", "=Q,Q[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
28   asm("foo %1,%0" : "=Q" (mout0) : "Q" (min1));
29 }
30 
31 // CHECK: @single_a
single_a()32 void single_a()
33 {
34   // CHECK: asm "foo $1,$0", "={ax},{ax}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
35   asm("foo %1,%0" : "=a" (mout0) : "a" (min1));
36 }
37 
38 // CHECK: @single_b
single_b()39 void single_b()
40 {
41   // CHECK: asm "foo $1,$0", "={bx},{bx}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
42   asm("foo %1,%0" : "=b" (mout0) : "b" (min1));
43 }
44 
45 // CHECK: @single_c
single_c()46 void single_c()
47 {
48   // CHECK: asm "foo $1,$0", "={cx},{cx}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
49   asm("foo %1,%0" : "=c" (mout0) : "c" (min1));
50 }
51 
52 // CHECK: @single_d
single_d()53 void single_d()
54 {
55   // CHECK: asm "foo $1,$0", "={dx},{dx}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
56   asm("foo %1,%0" : "=d" (mout0) : "d" (min1));
57 }
58 
59 // CHECK: @single_S
single_S()60 void single_S()
61 {
62   // CHECK: asm "foo $1,$0", "={si},{si}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
63   asm("foo %1,%0" : "=S" (mout0) : "S" (min1));
64 }
65 
66 // CHECK: @single_D
single_D()67 void single_D()
68 {
69   // CHECK: asm "foo $1,$0", "={di},{di}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
70   asm("foo %1,%0" : "=D" (mout0) : "D" (min1));
71 }
72 
73 // CHECK: @single_A
single_A()74 void single_A()
75 {
76   // CHECK: asm "foo $1,$0", "=A,A[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
77   asm("foo %1,%0" : "=A" (mout0) : "A" (min1));
78 }
79 
80 // CHECK: @single_f
single_f()81 void single_f()
82 {
83 //FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
84 }
85 
86 // CHECK: @single_t
single_t()87 void single_t()
88 {
89 //FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
90 }
91 
92 // CHECK: @single_u
single_u()93 void single_u()
94 {
95 //FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
96 }
97 
98 // CHECK: @single_y
single_y()99 void single_y()
100 {
101   // CHECK: call double asm "foo $1,$0", "=y,y[[CLOBBERS]](double {{[a-zA-Z0-9@%]+}})
102   asm("foo %1,%0" : "=y" (dout0) : "y" (din1));
103 }
104 
105 // CHECK: @single_x
single_x()106 void single_x()
107 {
108   // CHECK: asm "foo $1,$0", "=x,x[[CLOBBERS]](double {{[a-zA-Z0-9@%]+}})
109   asm("foo %1,%0" : "=x" (dout0) : "x" (din1));
110 }
111 
112 // CHECK: @single_Y
single_Y()113 void single_Y()
114 {
115   // 'Y' constraint currently broken.
116   //asm("foo %1,%0" : "=Y0" (mout0) : "Y0" (min1));
117   //asm("foo %1,%0" : "=Yz" (mout0) : "Yz" (min1));
118   //asm("foo %1,%0" : "=Yt" (mout0) : "Yt" (min1));
119   //asm("foo %1,%0" : "=Yi" (mout0) : "Yi" (min1));
120   //asm("foo %1,%0" : "=Ym" (mout0) : "Ym" (min1));
121 }
122 
123 // CHECK: @single_I
single_I()124 void single_I()
125 {
126   // CHECK: asm "foo $1,$0", "=*m,I[[CLOBBERS]](i32* @mout0, i32 1)
127   asm("foo %1,%0" : "=m" (mout0) : "I" (1));
128 }
129 
130 // CHECK: @single_J
single_J()131 void single_J()
132 {
133   // CHECK: asm "foo $1,$0", "=*m,J[[CLOBBERS]](i32* @mout0, i32 1)
134   asm("foo %1,%0" : "=m" (mout0) : "J" (1));
135 }
136 
137 // CHECK: @single_K
single_K()138 void single_K()
139 {
140   // CHECK: asm "foo $1,$0", "=*m,K[[CLOBBERS]](i32* @mout0, i32 1)
141   asm("foo %1,%0" : "=m" (mout0) : "K" (1));
142 }
143 
144 // CHECK: @single_L
single_L()145 void single_L()
146 {
147   // CHECK: asm "foo $1,$0", "=*m,L[[CLOBBERS]](i32* @mout0, i32 255)
148   asm("foo %1,%0" : "=m" (mout0) : "L" (0xff));
149   // CHECK: asm "foo $1,$0", "=*m,L[[CLOBBERS]](i32* @mout0, i32 65535)
150   asm("foo %1,%0" : "=m" (mout0) : "L" (0xffff));
151   // CHECK: asm "foo $1,$0", "=*m,L[[CLOBBERS]](i32* @mout0, i32 -1)
152   asm("foo %1,%0" : "=m" (mout0) : "L" (0xffffffff));
153 }
154 
155 // CHECK: @single_M
single_M()156 void single_M()
157 {
158   // CHECK: asm "foo $1,$0", "=*m,M[[CLOBBERS]](i32* @mout0, i32 1)
159   asm("foo %1,%0" : "=m" (mout0) : "M" (1));
160 }
161 
162 // CHECK: @single_N
single_N()163 void single_N()
164 {
165   // CHECK: asm "foo $1,$0", "=*m,N[[CLOBBERS]](i32* @mout0, i32 1)
166   asm("foo %1,%0" : "=m" (mout0) : "N" (1));
167 }
168 
169 // CHECK: @single_G
single_G()170 void single_G()
171 {
172   // CHECK: asm "foo $1,$0", "=*m,G[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
173   asm("foo %1,%0" : "=m" (mout0) : "G" (1.0));
174 }
175 
176 // CHECK: @single_C
single_C()177 void single_C()
178 {
179   // CHECK: asm "foo $1,$0", "=*m,C[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
180   asm("foo %1,%0" : "=m" (mout0) : "C" (1.0));
181 }
182 
183 // CHECK: @single_e
single_e()184 void single_e()
185 {
186   // CHECK: asm "foo $1,$0", "=*m,e[[CLOBBERS]](i32* @mout0, i32 1)
187   asm("foo %1,%0" : "=m" (mout0) : "e" (1));
188 }
189 
190 // CHECK: @single_Z
single_Z()191 void single_Z()
192 {
193   // CHECK: asm "foo $1,$0", "=*m,Z[[CLOBBERS]](i32* @mout0, i32 1)
194   asm("foo %1,%0" : "=m" (mout0) : "Z" (1));
195 }
196 
197 // CHECK: @multi_R
multi_R()198 void multi_R()
199 {
200   // CHECK: asm "foo $1,$0", "=*r|R|m,r|R|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
201   asm("foo %1,%0" : "=r,R,m" (mout0) : "r,R,m" (min1));
202 }
203 
204 // CHECK: @multi_q
multi_q()205 void multi_q()
206 {
207   // CHECK: asm "foo $1,$0", "=*r|q|m,r|q|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
208   asm("foo %1,%0" : "=r,q,m" (mout0) : "r,q,m" (min1));
209 }
210 
211 // CHECK: @multi_Q
multi_Q()212 void multi_Q()
213 {
214   // CHECK: asm "foo $1,$0", "=*r|Q|m,r|Q|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
215   asm("foo %1,%0" : "=r,Q,m" (mout0) : "r,Q,m" (min1));
216 }
217 
218 // CHECK: @multi_a
multi_a()219 void multi_a()
220 {
221   // CHECK: asm "foo $1,$0", "=*r|{ax}|m,r|{ax}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
222   asm("foo %1,%0" : "=r,a,m" (mout0) : "r,a,m" (min1));
223 }
224 
225 // CHECK: @multi_b
multi_b()226 void multi_b()
227 {
228   // CHECK: asm "foo $1,$0", "=*r|{bx}|m,r|{bx}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
229   asm("foo %1,%0" : "=r,b,m" (mout0) : "r,b,m" (min1));
230 }
231 
232 // CHECK: @multi_c
multi_c()233 void multi_c()
234 {
235   // CHECK: asm "foo $1,$0", "=*r|{cx}|m,r|{cx}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
236   asm("foo %1,%0" : "=r,c,m" (mout0) : "r,c,m" (min1));
237 }
238 
239 // CHECK: @multi_d
multi_d()240 void multi_d()
241 {
242   // CHECK: asm "foo $1,$0", "=*r|{dx}|m,r|{dx}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
243   asm("foo %1,%0" : "=r,d,m" (mout0) : "r,d,m" (min1));
244 }
245 
246 // CHECK: @multi_S
multi_S()247 void multi_S()
248 {
249   // CHECK: asm "foo $1,$0", "=*r|{si}|m,r|{si}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
250   asm("foo %1,%0" : "=r,S,m" (mout0) : "r,S,m" (min1));
251 }
252 
253 // CHECK: @multi_D
multi_D()254 void multi_D()
255 {
256   // CHECK: asm "foo $1,$0", "=*r|{di}|m,r|{di}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
257   asm("foo %1,%0" : "=r,D,m" (mout0) : "r,D,m" (min1));
258 }
259 
260 // CHECK: @multi_A
multi_A()261 void multi_A()
262 {
263   // CHECK: asm "foo $1,$0", "=*r|A|m,r|A|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
264   asm("foo %1,%0" : "=r,A,m" (mout0) : "r,A,m" (min1));
265 }
266 
267 // CHECK: @multi_f
multi_f()268 void multi_f()
269 {
270 //FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
271 }
272 
273 // CHECK: @multi_t
multi_t()274 void multi_t()
275 {
276 //FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
277 }
278 
279 // CHECK: @multi_u
multi_u()280 void multi_u()
281 {
282 //FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
283 }
284 
285 // CHECK: @multi_y
multi_y()286 void multi_y()
287 {
288   // CHECK: asm "foo $1,$0", "=*r|y|m,r|y|m[[CLOBBERS]](double* @dout0, double {{[a-zA-Z0-9@%]+}})
289   asm("foo %1,%0" : "=r,y,m" (dout0) : "r,y,m" (din1));
290 }
291 
292 // CHECK: @multi_x
multi_x()293 void multi_x()
294 {
295   // CHECK: asm "foo $1,$0", "=*r|x|m,r|x|m[[CLOBBERS]](double* @dout0, double {{[a-zA-Z0-9@%]+}})
296   asm("foo %1,%0" : "=r,x,m" (dout0) : "r,x,m" (din1));
297 }
298 
299 // CHECK: @multi_Y
multi_Y0()300 void multi_Y0()
301 {
302   // Y constraint currently broken.
303   //asm("foo %1,%0" : "=r,Y0,m" (mout0) : "r,Y0,m" (min1));
304   //asm("foo %1,%0" : "=r,Yz,m" (mout0) : "r,Yz,m" (min1));
305   //asm("foo %1,%0" : "=r,Yt,m" (mout0) : "r,Yt,m" (min1));
306   //asm("foo %1,%0" : "=r,Yi,m" (mout0) : "r,Yi,m" (min1));
307   //asm("foo %1,%0" : "=r,Ym,m" (mout0) : "r,Ym,m" (min1));
308 }
309 
310 // CHECK: @multi_I
multi_I()311 void multi_I()
312 {
313   // CHECK: asm "foo $1,$0", "=*r|m|m,r|I|m[[CLOBBERS]](i32* @mout0, i32 1)
314   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,I,m" (1));
315 }
316 
317 // CHECK: @multi_J
multi_J()318 void multi_J()
319 {
320   // CHECK: asm "foo $1,$0", "=*r|m|m,r|J|m[[CLOBBERS]](i32* @mout0, i32 1)
321   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,J,m" (1));
322 }
323 
324 // CHECK: @multi_K
multi_K()325 void multi_K()
326 {
327   // CHECK: asm "foo $1,$0", "=*r|m|m,r|K|m[[CLOBBERS]](i32* @mout0, i32 1)
328   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,K,m" (1));
329 }
330 
331 // CHECK: @multi_L
multi_L()332 void multi_L()
333 {
334   // CHECK: asm "foo $1,$0", "=*r|m|m,r|L|m[[CLOBBERS]](i32* @mout0, i32 1)
335   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,L,m" (1));
336 }
337 
338 // CHECK: @multi_M
multi_M()339 void multi_M()
340 {
341   // CHECK: asm "foo $1,$0", "=*r|m|m,r|M|m[[CLOBBERS]](i32* @mout0, i32 1)
342   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,M,m" (1));
343 }
344 
345 // CHECK: @multi_N
multi_N()346 void multi_N()
347 {
348   // CHECK: asm "foo $1,$0", "=*r|m|m,r|N|m[[CLOBBERS]](i32* @mout0, i32 1)
349   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,N,m" (1));
350 }
351 
352 // CHECK: @multi_G
multi_G()353 void multi_G()
354 {
355   // CHECK: asm "foo $1,$0", "=*r|m|m,r|G|m[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
356   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,G,m" (1.0));
357 }
358 
359 // CHECK: @multi_C
multi_C()360 void multi_C()
361 {
362   // CHECK: asm "foo $1,$0", "=*r|m|m,r|C|m[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
363   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,C,m" (1.0));
364 }
365 
366 // CHECK: @multi_e
multi_e()367 void multi_e()
368 {
369   // CHECK: asm "foo $1,$0", "=*r|m|m,r|e|m[[CLOBBERS]](i32* @mout0, i32 1)
370   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,e,m" (1));
371 }
372 
373 // CHECK: @multi_Z
multi_Z()374 void multi_Z()
375 {
376   // CHECK: asm "foo $1,$0", "=*r|m|m,r|Z|m[[CLOBBERS]](i32* @mout0, i32 1)
377   asm("foo %1,%0" : "=r,m,m" (mout0) : "r,Z,m" (1));
378 }
379