[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / clang / test / CodeGen / mult-alt-generic.c
blob581200b55da8a8f8b6f4c54d18bd8882ffaec028
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 mips %s -emit-llvm -o - | FileCheck %s
5 // RUN: %clang_cc1 -triple mipsel %s -emit-llvm -o - | FileCheck %s
6 // RUN: %clang_cc1 -triple powerpc %s -emit-llvm -o - | FileCheck %s
7 // RUN: %clang_cc1 -triple powerpc64 %s -emit-llvm -o - | FileCheck %s
8 // RUN: %clang_cc1 -triple s390x %s -emit-llvm -o - | FileCheck %s
9 // RUN: %clang_cc1 -triple sparc %s -emit-llvm -o - | FileCheck %s
10 // RUN: %clang_cc1 -triple sparcv9 %s -emit-llvm -o - | FileCheck %s
11 // RUN: %clang_cc1 -triple thumb %s -emit-llvm -o - | FileCheck %s
13 int mout0;
14 int min1;
15 int marray[2];
17 // CHECK: @single_m
18 void single_m(void)
20 // CHECK: call void asm "foo $1,$0", "=*m,*m[[CLOBBERS:[a-zA-Z0-9@%{},~_$ ]*\"]](ptr elementtype(i32) {{[a-zA-Z0-9@%]+}}, ptr elementtype(i32) {{[a-zA-Z0-9@%]+}})
21 asm("foo %1,%0" : "=m" (mout0) : "m" (min1));
24 // CHECK: @single_o
25 void single_o(void)
27 register int out0 = 0;
28 register int index = 1;
29 // Doesn't really do an offset...
30 //asm("foo %1, %2,%0" : "=r" (out0) : "o" (min1));
33 // CHECK: @single_V
34 void single_V(void)
36 // asm("foo %1,%0" : "=m" (mout0) : "V" (min1));
39 // CHECK: @single_lt
40 void single_lt(void)
42 register int out0 = 0;
43 register int in1 = 1;
44 // CHECK: call i32 asm "foo $1,$0", "=r,<r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
45 asm("foo %1,%0" : "=r" (out0) : "<r" (in1));
46 // CHECK: call i32 asm "foo $1,$0", "=r,r<[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
47 asm("foo %1,%0" : "=r" (out0) : "r<" (in1));
50 // CHECK: @single_gt
51 void single_gt(void)
53 register int out0 = 0;
54 register int in1 = 1;
55 // CHECK: call i32 asm "foo $1,$0", "=r,>r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
56 asm("foo %1,%0" : "=r" (out0) : ">r" (in1));
57 // CHECK: call i32 asm "foo $1,$0", "=r,r>[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
58 asm("foo %1,%0" : "=r" (out0) : "r>" (in1));
61 // CHECK: @single_r
62 void single_r(void)
64 register int out0 = 0;
65 register int in1 = 1;
66 // CHECK: call i32 asm "foo $1,$0", "=r,r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
67 asm("foo %1,%0" : "=r" (out0) : "r" (in1));
70 // CHECK: @single_i
71 void single_i(void)
73 register int out0 = 0;
74 // CHECK: call i32 asm "foo $1,$0", "=r,i[[CLOBBERS]](i32 1)
75 asm("foo %1,%0" : "=r" (out0) : "i" (1));
78 // CHECK: @single_n
79 void single_n(void)
81 register int out0 = 0;
82 // CHECK: call i32 asm "foo $1,$0", "=r,n[[CLOBBERS]](i32 1)
83 asm("foo %1,%0" : "=r" (out0) : "n" (1));
86 // CHECK: @single_E
87 void single_E(void)
89 register double out0 = 0.0;
90 // CHECK: call double asm "foo $1,$0", "=r,E[[CLOBBERS]](double {{[0-9.eE+-]+}})
91 asm("foo %1,%0" : "=r" (out0) : "E" (1.0e+01));
94 // CHECK: @single_F
95 void single_F(void)
97 register double out0 = 0.0;
98 // CHECK: call double asm "foo $1,$0", "=r,F[[CLOBBERS]](double {{[0-9.eE+-]+}})
99 asm("foo %1,%0" : "=r" (out0) : "F" (1.0));
102 // CHECK: @single_s
103 void single_s(void)
105 register int out0 = 0;
106 //asm("foo %1,%0" : "=r" (out0) : "s" (single_s));
109 // CHECK: @single_g
110 void single_g(void)
112 register int out0 = 0;
113 register int in1 = 1;
114 // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
115 asm("foo %1,%0" : "=r" (out0) : "g" (in1));
116 // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
117 asm("foo %1,%0" : "=r" (out0) : "g" (min1));
118 // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 1)
119 asm("foo %1,%0" : "=r" (out0) : "g" (1));
122 // CHECK: @single_X
123 void single_X(void)
125 register int out0 = 0;
126 register int in1 = 1;
127 // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
128 asm("foo %1,%0" : "=r" (out0) : "X" (in1));
129 // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
130 asm("foo %1,%0" : "=r" (out0) : "X" (min1));
131 // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 1)
132 asm("foo %1,%0" : "=r" (out0) : "X" (1));
133 // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](ptr {{[a-zA-Z0-9@%]+}})
134 asm("foo %1,%0" : "=r" (out0) : "X" (marray));
135 // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](double {{[0-9.eE+-]+}})
136 asm("foo %1,%0" : "=r" (out0) : "X" (1.0e+01));
137 // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](double {{[0-9.eE+-]+}})
138 asm("foo %1,%0" : "=r" (out0) : "X" (1.0));
141 // CHECK: @single_p
142 void single_p(void)
144 register int out0 = 0;
145 // Constraint converted differently on different platforms moved to platform-specific.
146 // : call i32 asm "foo $1,$0", "=r,im[[CLOBBERS]](ptr getelementptr inbounds ([2 x i32], ptr {{[a-zA-Z0-9@%]+}}, i{{32|64}} 0, i{{32|64}} 0))
147 asm("foo %1,%0" : "=r" (out0) : "p" (marray));
150 // CHECK: @multi_m
151 void multi_m(void)
153 // CHECK: call void asm "foo $1,$0", "=*m|r,m|r[[CLOBBERS]](ptr elementtype(i32) {{[a-zA-Z0-9@%]+}}, i32 {{[a-zA-Z0-9@%]+}})
154 asm("foo %1,%0" : "=m,r" (mout0) : "m,r" (min1));
157 // CHECK: @multi_o
158 void multi_o(void)
160 register int out0 = 0;
161 register int index = 1;
162 // Doesn't really do an offset...
163 //asm("foo %1, %2,%0" : "=r,r" (out0) : "r,o" (min1));
166 // CHECK: @multi_V
167 void multi_V(void)
169 // asm("foo %1,%0" : "=m,r" (mout0) : "r,V" (min1));
172 // CHECK: @multi_lt
173 void multi_lt(void)
175 register int out0 = 0;
176 register int in1 = 1;
177 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|<r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
178 asm("foo %1,%0" : "=r,r" (out0) : "r,<r" (in1));
179 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|r<[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
180 asm("foo %1,%0" : "=r,r" (out0) : "r,r<" (in1));
183 // CHECK: @multi_gt
184 void multi_gt(void)
186 register int out0 = 0;
187 register int in1 = 1;
188 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|>r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
189 asm("foo %1,%0" : "=r,r" (out0) : "r,>r" (in1));
190 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|r>[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
191 asm("foo %1,%0" : "=r,r" (out0) : "r,r>" (in1));
194 // CHECK: @multi_r
195 void multi_r(void)
197 register int out0 = 0;
198 register int in1 = 1;
199 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|m[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
200 asm("foo %1,%0" : "=r,r" (out0) : "r,m" (in1));
203 // CHECK: @multi_i
204 void multi_i(void)
206 register int out0 = 0;
207 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|i[[CLOBBERS]](i32 1)
208 asm("foo %1,%0" : "=r,r" (out0) : "r,i" (1));
211 // CHECK: @multi_n
212 void multi_n(void)
214 register int out0 = 0;
215 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|n[[CLOBBERS]](i32 1)
216 asm("foo %1,%0" : "=r,r" (out0) : "r,n" (1));
219 // CHECK: @multi_E
220 void multi_E(void)
222 register double out0 = 0.0;
223 // CHECK: call double asm "foo $1,$0", "=r|r,r|E[[CLOBBERS]](double {{[0-9.eE+-]+}})
224 asm("foo %1,%0" : "=r,r" (out0) : "r,E" (1.0e+01));
227 // CHECK: @multi_F
228 void multi_F(void)
230 register double out0 = 0.0;
231 // CHECK: call double asm "foo $1,$0", "=r|r,r|F[[CLOBBERS]](double {{[0-9.eE+-]+}})
232 asm("foo %1,%0" : "=r,r" (out0) : "r,F" (1.0));
235 // CHECK: @multi_s
236 void multi_s(void)
238 register int out0 = 0;
239 //asm("foo %1,%0" : "=r,r" (out0) : "r,s" (multi_s));
242 // CHECK: @multi_g
243 void multi_g(void)
245 register int out0 = 0;
246 register int in1 = 1;
247 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
248 asm("foo %1,%0" : "=r,r" (out0) : "r,g" (in1));
249 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
250 asm("foo %1,%0" : "=r,r" (out0) : "r,g" (min1));
251 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 1)
252 asm("foo %1,%0" : "=r,r" (out0) : "r,g" (1));
255 // CHECK: @multi_X
256 void multi_X(void)
258 register int out0 = 0;
259 register int in1 = 1;
260 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
261 asm("foo %1,%0" : "=r,r" (out0) : "r,X" (in1));
262 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
263 asm("foo %1,%0" : "=r,r" (out0) : "r,X" (min1));
264 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 1)
265 asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1));
266 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](ptr {{[a-zA-Z0-9@%]+}})
267 asm("foo %1,%0" : "=r,r" (out0) : "r,X" (marray));
268 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](double {{[0-9.eE+-]+}})
269 asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1.0e+01));
270 // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](double {{[0-9.eE+-]+}})
271 asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1.0));
274 // CHECK: @multi_p
275 void multi_p(void)
277 register int out0 = 0;
278 // Constraint converted differently on different platforms moved to platform-specific.
279 // : call i32 asm "foo $1,$0", "=r|r,r|im[[CLOBBERS]](ptr getelementptr inbounds ([2 x i32], ptr {{[a-zA-Z0-9@%]+}}, {{i[0-9]*}} 0, {{i[0-9]*}} 0))
280 asm("foo %1,%0" : "=r,r" (out0) : "r,p" (marray));