• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple i686 %s -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64 %s -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple arm %s -emit-llvm -o - | FileCheck %s
4 // RUN: %clang_cc1 -triple mblaze %s -emit-llvm -o - | FileCheck %s
5 // RUN: %clang_cc1 -triple mips %s -emit-llvm -o - | FileCheck %s
6 // RUN: %clang_cc1 -triple mipsel %s -emit-llvm -o - | FileCheck %s
7 // RUN: %clang_cc1 -triple powerpc %s -emit-llvm -o - | FileCheck %s
8 // RUN: %clang_cc1 -triple powerpc64 %s -emit-llvm -o - | FileCheck %s
9 // RUN: %clang_cc1 -triple sparc %s -emit-llvm -o - | FileCheck %s
10 // RUN: %clang_cc1 -triple thumb %s -emit-llvm -o - | FileCheck %s
11 
12 int mout0;
13 int min1;
14 int marray[2];
15 
16 // CHECK: @single_m
single_m()17 void single_m()
18 {
19   // CHECK: call void asm "foo $1,$0", "=*m,*m[[CLOBBERS:[a-zA-Z0-9@%{},~_ ]*\"]](i32* {{[a-zA-Z0-9@%]+}}, i32* {{[a-zA-Z0-9@%]+}})
20   asm("foo %1,%0" : "=m" (mout0) : "m" (min1));
21 }
22 
23 // CHECK: @single_o
single_o()24 void single_o()
25 {
26   register int out0 = 0;
27   register int index = 1;
28   // Doesn't really do an offset...
29   //asm("foo %1, %2,%0" : "=r" (out0) : "o" (min1));
30 }
31 
32 // CHECK: @single_V
single_V()33 void single_V()
34 {
35 //  asm("foo %1,%0" : "=m" (mout0) : "V" (min1));
36 }
37 
38 // CHECK: @single_lt
single_lt()39 void single_lt()
40 {
41   register int out0 = 0;
42   register int in1 = 1;
43   // CHECK: call i32 asm "foo $1,$0", "=r,<r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
44   asm("foo %1,%0" : "=r" (out0) : "<r" (in1));
45   // CHECK: call i32 asm "foo $1,$0", "=r,r<[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
46   asm("foo %1,%0" : "=r" (out0) : "r<" (in1));
47 }
48 
49 // CHECK: @single_gt
single_gt()50 void single_gt()
51 {
52   register int out0 = 0;
53   register int in1 = 1;
54   // CHECK: call i32 asm "foo $1,$0", "=r,>r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
55   asm("foo %1,%0" : "=r" (out0) : ">r" (in1));
56   // CHECK: call i32 asm "foo $1,$0", "=r,r>[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
57   asm("foo %1,%0" : "=r" (out0) : "r>" (in1));
58 }
59 
60 // CHECK: @single_r
single_r()61 void single_r()
62 {
63   register int out0 = 0;
64   register int in1 = 1;
65   // CHECK: call i32 asm "foo $1,$0", "=r,r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
66   asm("foo %1,%0" : "=r" (out0) : "r" (in1));
67 }
68 
69 // CHECK: @single_i
single_i()70 void single_i()
71 {
72   register int out0 = 0;
73   // CHECK: call i32 asm "foo $1,$0", "=r,i[[CLOBBERS]](i32 1)
74   asm("foo %1,%0" : "=r" (out0) : "i" (1));
75 }
76 
77 // CHECK: @single_n
single_n()78 void single_n()
79 {
80   register int out0 = 0;
81   // CHECK: call i32 asm "foo $1,$0", "=r,n[[CLOBBERS]](i32 1)
82   asm("foo %1,%0" : "=r" (out0) : "n" (1));
83 }
84 
85 // CHECK: @single_E
single_E()86 void single_E()
87 {
88   register double out0 = 0.0;
89   // CHECK: call double asm "foo $1,$0", "=r,E[[CLOBBERS]](double {{[0-9.eE+-]+}})
90   asm("foo %1,%0" : "=r" (out0) : "E" (1.0e+01));
91 }
92 
93 // CHECK: @single_F
single_F()94 void single_F()
95 {
96   register double out0 = 0.0;
97   // CHECK: call double asm "foo $1,$0", "=r,F[[CLOBBERS]](double {{[0-9.eE+-]+}})
98   asm("foo %1,%0" : "=r" (out0) : "F" (1.0));
99 }
100 
101 // CHECK: @single_s
single_s()102 void single_s()
103 {
104   register int out0 = 0;
105   //asm("foo %1,%0" : "=r" (out0) : "s" (single_s));
106 }
107 
108 // CHECK: @single_g
single_g()109 void single_g()
110 {
111   register int out0 = 0;
112   register int in1 = 1;
113   // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
114   asm("foo %1,%0" : "=r" (out0) : "g" (in1));
115   // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
116   asm("foo %1,%0" : "=r" (out0) : "g" (min1));
117   // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 1)
118   asm("foo %1,%0" : "=r" (out0) : "g" (1));
119 }
120 
121 // CHECK: @single_X
single_X()122 void single_X()
123 {
124   register int out0 = 0;
125   register int in1 = 1;
126   // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
127   asm("foo %1,%0" : "=r" (out0) : "X" (in1));
128   // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
129   asm("foo %1,%0" : "=r" (out0) : "X" (min1));
130   // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 1)
131   asm("foo %1,%0" : "=r" (out0) : "X" (1));
132   // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
133   asm("foo %1,%0" : "=r" (out0) : "X" (marray));
134   // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](double {{[0-9.eE+-]+}})
135   asm("foo %1,%0" : "=r" (out0) : "X" (1.0e+01));
136   // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](double {{[0-9.eE+-]+}})
137   asm("foo %1,%0" : "=r" (out0) : "X" (1.0));
138 }
139 
140 // CHECK: @single_p
single_p()141 void single_p()
142 {
143   register int out0 = 0;
144   // Constraint converted differently on different platforms moved to platform-specific.
145   // : call i32 asm "foo $1,$0", "=r,im[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
146   asm("foo %1,%0" : "=r" (out0) : "p" (marray));
147 }
148 
149 // CHECK: @multi_m
multi_m()150 void multi_m()
151 {
152   // CHECK: call void asm "foo $1,$0", "=*m|r,m|r[[CLOBBERS]](i32* {{[a-zA-Z0-9@%]+}}, i32 {{[a-zA-Z0-9@%]+}})
153   asm("foo %1,%0" : "=m,r" (mout0) : "m,r" (min1));
154 }
155 
156 // CHECK: @multi_o
multi_o()157 void multi_o()
158 {
159   register int out0 = 0;
160   register int index = 1;
161   // Doesn't really do an offset...
162   //asm("foo %1, %2,%0" : "=r,r" (out0) : "r,o" (min1));
163 }
164 
165 // CHECK: @multi_V
multi_V()166 void multi_V()
167 {
168 //  asm("foo %1,%0" : "=m,r" (mout0) : "r,V" (min1));
169 }
170 
171 // CHECK: @multi_lt
multi_lt()172 void multi_lt()
173 {
174   register int out0 = 0;
175   register int in1 = 1;
176   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|<r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
177   asm("foo %1,%0" : "=r,r" (out0) : "r,<r" (in1));
178   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|r<[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
179   asm("foo %1,%0" : "=r,r" (out0) : "r,r<" (in1));
180 }
181 
182 // CHECK: @multi_gt
multi_gt()183 void multi_gt()
184 {
185   register int out0 = 0;
186   register int in1 = 1;
187   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|>r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
188   asm("foo %1,%0" : "=r,r" (out0) : "r,>r" (in1));
189   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|r>[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
190   asm("foo %1,%0" : "=r,r" (out0) : "r,r>" (in1));
191 }
192 
193 // CHECK: @multi_r
multi_r()194 void multi_r()
195 {
196   register int out0 = 0;
197   register int in1 = 1;
198   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|m[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
199   asm("foo %1,%0" : "=r,r" (out0) : "r,m" (in1));
200 }
201 
202 // CHECK: @multi_i
multi_i()203 void multi_i()
204 {
205   register int out0 = 0;
206   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|i[[CLOBBERS]](i32 1)
207   asm("foo %1,%0" : "=r,r" (out0) : "r,i" (1));
208 }
209 
210 // CHECK: @multi_n
multi_n()211 void multi_n()
212 {
213   register int out0 = 0;
214   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|n[[CLOBBERS]](i32 1)
215   asm("foo %1,%0" : "=r,r" (out0) : "r,n" (1));
216 }
217 
218 // CHECK: @multi_E
multi_E()219 void multi_E()
220 {
221   register double out0 = 0.0;
222   // CHECK: call double asm "foo $1,$0", "=r|r,r|E[[CLOBBERS]](double {{[0-9.eE+-]+}})
223   asm("foo %1,%0" : "=r,r" (out0) : "r,E" (1.0e+01));
224 }
225 
226 // CHECK: @multi_F
multi_F()227 void multi_F()
228 {
229   register double out0 = 0.0;
230   // CHECK: call double asm "foo $1,$0", "=r|r,r|F[[CLOBBERS]](double {{[0-9.eE+-]+}})
231   asm("foo %1,%0" : "=r,r" (out0) : "r,F" (1.0));
232 }
233 
234 // CHECK: @multi_s
multi_s()235 void multi_s()
236 {
237   register int out0 = 0;
238   //asm("foo %1,%0" : "=r,r" (out0) : "r,s" (multi_s));
239 }
240 
241 // CHECK: @multi_g
multi_g()242 void multi_g()
243 {
244   register int out0 = 0;
245   register int in1 = 1;
246   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
247   asm("foo %1,%0" : "=r,r" (out0) : "r,g" (in1));
248   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
249   asm("foo %1,%0" : "=r,r" (out0) : "r,g" (min1));
250   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 1)
251   asm("foo %1,%0" : "=r,r" (out0) : "r,g" (1));
252 }
253 
254 // CHECK: @multi_X
multi_X()255 void multi_X()
256 {
257   register int out0 = 0;
258   register int in1 = 1;
259   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
260   asm("foo %1,%0" : "=r,r" (out0) : "r,X" (in1));
261   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
262   asm("foo %1,%0" : "=r,r" (out0) : "r,X" (min1));
263   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 1)
264   asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1));
265   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
266   asm("foo %1,%0" : "=r,r" (out0) : "r,X" (marray));
267   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](double {{[0-9.eE+-]+}})
268   asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1.0e+01));
269   // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](double {{[0-9.eE+-]+}})
270   asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1.0));
271 }
272 
273 // CHECK: @multi_p
multi_p()274 void multi_p()
275 {
276   register int out0 = 0;
277   // Constraint converted differently on different platforms moved to platform-specific.
278   // : call i32 asm "foo $1,$0", "=r|r,r|im[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
279   asm("foo %1,%0" : "=r,r" (out0) : "r,p" (marray));
280 }
281