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