xref: /llvm-project/clang/test/Sema/builtins-elementwise-math.c (revision 5d08f3256b134e9c5414b4e50563e5de0f1735c6)
1 // RUN: %clang_cc1 -std=c99 %s -pedantic -verify -triple=x86_64-apple-darwin9
2 
3 typedef double double2 __attribute__((ext_vector_type(2)));
4 typedef double double4 __attribute__((ext_vector_type(4)));
5 typedef float float2 __attribute__((ext_vector_type(2)));
6 typedef float float4 __attribute__((ext_vector_type(4)));
7 
8 typedef int int2 __attribute__((ext_vector_type(2)));
9 typedef int int3 __attribute__((ext_vector_type(3)));
10 typedef unsigned unsigned3 __attribute__((ext_vector_type(3)));
11 typedef unsigned unsigned4 __attribute__((ext_vector_type(4)));
12 
13 struct Foo {
14   char *p;
15 };
16 
17 __attribute__((address_space(1))) int int_as_one;
18 typedef int bar;
19 bar b;
20 
21 __attribute__((address_space(1))) float float_as_one;
22 typedef float waffle;
23 waffle waf;
24 
25 
26 void test_builtin_elementwise_abs(int i, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
27   struct Foo s = __builtin_elementwise_abs(i);
28   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
29 
30   i = __builtin_elementwise_abs();
31   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
32 
33   i = __builtin_elementwise_abs(i, i);
34   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
35 
36   i = __builtin_elementwise_abs(v);
37   // expected-error@-1 {{assigning to 'int' from incompatible type 'float4' (vector of 4 'float' values)}}
38 
39   u = __builtin_elementwise_abs(u);
40   // expected-error@-1 {{1st argument must be a signed integer or floating point type (was 'unsigned int')}}
41 
42   uv = __builtin_elementwise_abs(uv);
43   // expected-error@-1 {{1st argument must be a signed integer or floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
44 }
45 
46 void test_builtin_elementwise_add_sat(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
47   i = __builtin_elementwise_add_sat(p, d);
48   // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
49 
50   struct Foo foo = __builtin_elementwise_add_sat(i, i);
51   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
52 
53   i = __builtin_elementwise_add_sat(i);
54   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
55 
56   i = __builtin_elementwise_add_sat();
57   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
58 
59   i = __builtin_elementwise_add_sat(i, i, i);
60   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
61 
62   i = __builtin_elementwise_add_sat(v, iv);
63   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
64 
65   i = __builtin_elementwise_add_sat(uv, iv);
66   // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
67 
68   v = __builtin_elementwise_add_sat(v, v);
69   // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
70 
71   s = __builtin_elementwise_add_sat(i, s);
72 
73   enum e { one,
74            two };
75   i = __builtin_elementwise_add_sat(one, two);
76 
77   enum f { three };
78   enum f x = __builtin_elementwise_add_sat(one, three);
79   // expected-warning@-1 {{comparison of different enumeration types ('enum e' and 'enum f')}}
80 
81   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
82   ext = __builtin_elementwise_add_sat(ext, ext);
83 
84   const int ci;
85   i = __builtin_elementwise_add_sat(ci, i);
86   i = __builtin_elementwise_add_sat(i, ci);
87   i = __builtin_elementwise_add_sat(ci, ci);
88 
89   i = __builtin_elementwise_add_sat(i, int_as_one); // ok (attributes don't match)?
90   i = __builtin_elementwise_add_sat(i, b);          // ok (sugar doesn't match)?
91 
92   int A[10];
93   A = __builtin_elementwise_add_sat(A, A);
94   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
95 
96   int(ii);
97   int j;
98   j = __builtin_elementwise_add_sat(i, j);
99 
100   _Complex float c1, c2;
101   c1 = __builtin_elementwise_add_sat(c1, c2);
102   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
103 }
104 
105 void test_builtin_elementwise_sub_sat(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
106   i = __builtin_elementwise_sub_sat(p, d);
107   // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
108 
109   struct Foo foo = __builtin_elementwise_sub_sat(i, i);
110   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
111 
112   i = __builtin_elementwise_sub_sat(i);
113   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
114 
115   i = __builtin_elementwise_sub_sat();
116   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
117 
118   i = __builtin_elementwise_sub_sat(i, i, i);
119   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
120 
121   i = __builtin_elementwise_sub_sat(v, iv);
122   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
123 
124   i = __builtin_elementwise_sub_sat(uv, iv);
125   // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
126 
127   v = __builtin_elementwise_sub_sat(v, v);
128   // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
129 
130   s = __builtin_elementwise_sub_sat(i, s);
131 
132   enum e { one,
133            two };
134   i = __builtin_elementwise_sub_sat(one, two);
135 
136   enum f { three };
137   enum f x = __builtin_elementwise_sub_sat(one, three);
138   // expected-warning@-1 {{comparison of different enumeration types ('enum e' and 'enum f')}}
139 
140   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
141   ext = __builtin_elementwise_sub_sat(ext, ext);
142 
143   const int ci;
144   i = __builtin_elementwise_sub_sat(ci, i);
145   i = __builtin_elementwise_sub_sat(i, ci);
146   i = __builtin_elementwise_sub_sat(ci, ci);
147 
148   i = __builtin_elementwise_sub_sat(i, int_as_one); // ok (attributes don't match)?
149   i = __builtin_elementwise_sub_sat(i, b);          // ok (sugar doesn't match)?
150 
151   int A[10];
152   A = __builtin_elementwise_sub_sat(A, A);
153   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
154 
155   int(ii);
156   int j;
157   j = __builtin_elementwise_sub_sat(i, j);
158 
159   _Complex float c1, c2;
160   c1 = __builtin_elementwise_sub_sat(c1, c2);
161   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
162 }
163 
164 void test_builtin_elementwise_max(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
165   i = __builtin_elementwise_max(p, d);
166   // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
167 
168   struct Foo foo = __builtin_elementwise_max(i, i);
169   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
170 
171   i = __builtin_elementwise_max(i);
172   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
173 
174   i = __builtin_elementwise_max();
175   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
176 
177   i = __builtin_elementwise_max(i, i, i);
178   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
179 
180   i = __builtin_elementwise_max(v, iv);
181   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
182 
183   i = __builtin_elementwise_max(uv, iv);
184   // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
185 
186   s = __builtin_elementwise_max(i, s);
187 
188   enum e { one,
189            two };
190   i = __builtin_elementwise_max(one, two);
191 
192   enum f { three };
193   enum f x = __builtin_elementwise_max(one, three);
194   // expected-warning@-1 {{comparison of different enumeration types ('enum e' and 'enum f')}}
195 
196   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
197   ext = __builtin_elementwise_max(ext, ext);
198 
199   const int ci;
200   i = __builtin_elementwise_max(ci, i);
201   i = __builtin_elementwise_max(i, ci);
202   i = __builtin_elementwise_max(ci, ci);
203 
204   i = __builtin_elementwise_max(i, int_as_one); // ok (attributes don't match)?
205   i = __builtin_elementwise_max(i, b);          // ok (sugar doesn't match)?
206 
207   int A[10];
208   A = __builtin_elementwise_max(A, A);
209   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
210 
211   int(ii);
212   int j;
213   j = __builtin_elementwise_max(i, j);
214 
215   _Complex float c1, c2;
216   c1 = __builtin_elementwise_max(c1, c2);
217   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
218 }
219 
220 void test_builtin_elementwise_min(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
221   i = __builtin_elementwise_min(p, d);
222   // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
223 
224   struct Foo foo = __builtin_elementwise_min(i, i);
225   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
226 
227   i = __builtin_elementwise_min(i);
228   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
229 
230   i = __builtin_elementwise_min();
231   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
232 
233   i = __builtin_elementwise_min(i, i, i);
234   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
235 
236   i = __builtin_elementwise_min(v, iv);
237   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
238 
239   i = __builtin_elementwise_min(uv, iv);
240   // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
241 
242   s = __builtin_elementwise_min(i, s);
243 
244   enum e { one,
245            two };
246   i = __builtin_elementwise_min(one, two);
247 
248   enum f { three };
249   enum f x = __builtin_elementwise_min(one, three);
250   // expected-warning@-1 {{comparison of different enumeration types ('enum e' and 'enum f')}}
251 
252   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
253   ext = __builtin_elementwise_min(ext, ext);
254 
255   const int ci;
256   i = __builtin_elementwise_min(ci, i);
257   i = __builtin_elementwise_min(i, ci);
258   i = __builtin_elementwise_min(ci, ci);
259 
260   i = __builtin_elementwise_min(i, int_as_one); // ok (attributes don't match)?
261   i = __builtin_elementwise_min(i, b);          // ok (sugar doesn't match)?
262 
263   int A[10];
264   A = __builtin_elementwise_min(A, A);
265   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
266 
267   int(ii);
268   int j;
269   j = __builtin_elementwise_min(i, j);
270 
271   _Complex float c1, c2;
272   c1 = __builtin_elementwise_min(c1, c2);
273   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
274 }
275 
276 void test_builtin_elementwise_bitreverse(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
277 
278   struct Foo s = __builtin_elementwise_bitreverse(i);
279   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
280 
281   i = __builtin_elementwise_bitreverse();
282   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
283 
284   i = __builtin_elementwise_bitreverse(f);
285   // expected-error@-1 {{1st argument must be a vector of integers (was 'float')}}
286 
287   i = __builtin_elementwise_bitreverse(f, f);
288   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
289 
290   u = __builtin_elementwise_bitreverse(d);
291   // expected-error@-1 {{1st argument must be a vector of integers (was 'double')}}
292 
293   v = __builtin_elementwise_bitreverse(v);
294   // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
295 }
296 
297 void test_builtin_elementwise_ceil(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
298 
299   struct Foo s = __builtin_elementwise_ceil(f);
300   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
301 
302   i = __builtin_elementwise_ceil();
303   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
304 
305   i = __builtin_elementwise_ceil(i);
306   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
307 
308   i = __builtin_elementwise_ceil(f, f);
309   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
310 
311   u = __builtin_elementwise_ceil(u);
312   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
313 
314   uv = __builtin_elementwise_ceil(uv);
315   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
316 }
317 
318 void test_builtin_elementwise_acos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
319 
320   struct Foo s = __builtin_elementwise_acos(f);
321   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
322 
323   i = __builtin_elementwise_acos();
324   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
325 
326   i = __builtin_elementwise_acos(i);
327   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
328 
329   i = __builtin_elementwise_acos(f, f);
330   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
331 
332   u = __builtin_elementwise_acos(u);
333   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
334 
335   uv = __builtin_elementwise_acos(uv);
336   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
337 }
338 
339 void test_builtin_elementwise_cos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
340 
341   struct Foo s = __builtin_elementwise_cos(f);
342   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
343 
344   i = __builtin_elementwise_cos();
345   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
346 
347   i = __builtin_elementwise_cos(i);
348   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
349 
350   i = __builtin_elementwise_cos(f, f);
351   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
352 
353   u = __builtin_elementwise_cos(u);
354   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
355 
356   uv = __builtin_elementwise_cos(uv);
357   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
358 }
359 
360 void test_builtin_elementwise_cosh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
361 
362   struct Foo s = __builtin_elementwise_cosh(f);
363   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
364 
365   i = __builtin_elementwise_cosh();
366   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
367 
368   i = __builtin_elementwise_cosh(i);
369   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
370 
371   i = __builtin_elementwise_cosh(f, f);
372   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
373 
374   u = __builtin_elementwise_cosh(u);
375   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
376 
377   uv = __builtin_elementwise_cosh(uv);
378   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
379 }
380 
381 void test_builtin_elementwise_exp(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
382 
383   struct Foo s = __builtin_elementwise_exp(f);
384   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
385 
386   i = __builtin_elementwise_exp();
387   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
388 
389   i = __builtin_elementwise_exp(i);
390   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
391 
392   i = __builtin_elementwise_exp(f, f);
393   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
394 
395   u = __builtin_elementwise_exp(u);
396   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
397 
398   uv = __builtin_elementwise_exp(uv);
399   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
400 }
401 
402 void test_builtin_elementwise_exp2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
403 
404   struct Foo s = __builtin_elementwise_exp2(f);
405   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
406 
407   i = __builtin_elementwise_exp2();
408   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
409 
410   i = __builtin_elementwise_exp2(i);
411   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
412 
413   i = __builtin_elementwise_exp2(f, f);
414   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
415 
416   u = __builtin_elementwise_exp2(u);
417   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
418 
419   uv = __builtin_elementwise_exp2(uv);
420   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
421 }
422 
423 
424 void test_builtin_elementwise_floor(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
425 
426   struct Foo s = __builtin_elementwise_floor(f);
427   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
428 
429   i = __builtin_elementwise_floor();
430   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
431 
432   i = __builtin_elementwise_floor(i);
433   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
434 
435   i = __builtin_elementwise_floor(f, f);
436   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
437 
438   u = __builtin_elementwise_floor(u);
439   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
440 
441   uv = __builtin_elementwise_floor(uv);
442   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
443 }
444 
445 void test_builtin_elementwise_log(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
446 
447   struct Foo s = __builtin_elementwise_log(f);
448   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
449 
450   i = __builtin_elementwise_log();
451   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
452 
453   i = __builtin_elementwise_log(i);
454   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
455 
456   i = __builtin_elementwise_log(f, f);
457   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
458 
459   u = __builtin_elementwise_log(u);
460   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
461 
462   uv = __builtin_elementwise_log(uv);
463   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
464 }
465 
466 void test_builtin_elementwise_log10(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
467 
468   struct Foo s = __builtin_elementwise_log10(f);
469   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
470 
471   i = __builtin_elementwise_log10();
472   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
473 
474   i = __builtin_elementwise_log10(i);
475   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
476 
477   i = __builtin_elementwise_log10(f, f);
478   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
479 
480   u = __builtin_elementwise_log10(u);
481   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
482 
483   uv = __builtin_elementwise_log10(uv);
484   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
485 }
486 
487 void test_builtin_elementwise_log2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
488 
489   struct Foo s = __builtin_elementwise_log2(f);
490   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
491 
492   i = __builtin_elementwise_log2();
493   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
494 
495   i = __builtin_elementwise_log2(i);
496   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
497 
498   i = __builtin_elementwise_log2(f, f);
499   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
500 
501   u = __builtin_elementwise_log2(u);
502   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
503 
504   uv = __builtin_elementwise_log2(uv);
505   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
506 }
507 
508 void test_builtin_elementwise_popcount(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
509 
510   struct Foo s = __builtin_elementwise_popcount(i);
511   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
512 
513   i = __builtin_elementwise_popcount();
514   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
515 
516   i = __builtin_elementwise_popcount(f);
517   // expected-error@-1 {{1st argument must be a vector of integers (was 'float')}}
518 
519   i = __builtin_elementwise_popcount(f, f);
520   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
521 
522   u = __builtin_elementwise_popcount(d);
523   // expected-error@-1 {{1st argument must be a vector of integers (was 'double')}}
524 
525   v = __builtin_elementwise_popcount(v);
526   // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
527 
528   int2 i2 = __builtin_elementwise_popcount(iv);
529   // expected-error@-1 {{initializing 'int2' (vector of 2 'int' values) with an expression of incompatible type 'int3' (vector of 3 'int' values)}}
530 
531   iv = __builtin_elementwise_popcount(i2);
532   // expected-error@-1 {{assigning to 'int3' (vector of 3 'int' values) from incompatible type 'int2' (vector of 2 'int' values)}}
533 
534   unsigned3 u3 = __builtin_elementwise_popcount(iv);
535   // expected-error@-1 {{initializing 'unsigned3' (vector of 3 'unsigned int' values) with an expression of incompatible type 'int3' (vector of 3 'int' values)}}
536 
537   iv = __builtin_elementwise_popcount(u3);
538   // expected-error@-1 {{assigning to 'int3' (vector of 3 'int' values) from incompatible type 'unsigned3' (vector of 3 'unsigned int' values)}}
539 }
540 
541 void test_builtin_elementwise_fmod(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
542   i = __builtin_elementwise_fmod(p, d);
543   // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
544 
545   struct Foo foo = __builtin_elementwise_fmod(i, i);
546   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
547 
548   i = __builtin_elementwise_fmod(i);
549   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
550 
551   i = __builtin_elementwise_fmod();
552   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
553 
554   i = __builtin_elementwise_fmod(i, i, i);
555   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
556 
557   i = __builtin_elementwise_fmod(v, iv);
558   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
559 
560   i = __builtin_elementwise_fmod(uv, iv);
561   // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
562 
563   i = __builtin_elementwise_fmod(d, v);
564   // expected-error@-1 {{arguments are of different types ('double' vs 'float4' (vector of 4 'float' values))}}
565 }
566 
567 void test_builtin_elementwise_pow(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
568   i = __builtin_elementwise_pow(p, d);
569   // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
570 
571   struct Foo foo = __builtin_elementwise_pow(i, i);
572   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
573 
574   i = __builtin_elementwise_pow(i);
575   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
576 
577   i = __builtin_elementwise_pow();
578   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
579 
580   i = __builtin_elementwise_pow(i, i, i);
581   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
582 
583   i = __builtin_elementwise_pow(v, iv);
584   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
585 
586   i = __builtin_elementwise_pow(uv, iv);
587   // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
588 
589 }
590 
591 void test_builtin_elementwise_roundeven(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
592 
593   struct Foo s = __builtin_elementwise_roundeven(f);
594   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
595 
596   i = __builtin_elementwise_roundeven();
597   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
598 
599   i = __builtin_elementwise_roundeven(i);
600   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
601 
602   i = __builtin_elementwise_roundeven(f, f);
603   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
604 
605   u = __builtin_elementwise_roundeven(u);
606   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
607 
608   uv = __builtin_elementwise_roundeven(uv);
609   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
610 }
611 
612 void test_builtin_elementwise_round(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
613   struct Foo s = __builtin_elementwise_round(f);
614   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
615 
616   i = __builtin_elementwise_round();
617   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
618 
619   i = __builtin_elementwise_round(i);
620   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
621 
622   i = __builtin_elementwise_round(f, f);
623   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
624 
625   u = __builtin_elementwise_round(u);
626   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
627 
628   uv = __builtin_elementwise_round(uv);
629   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
630 
631   // FIXME: Error should not mention integer
632   _Complex float c1, c2;
633   c1 = __builtin_elementwise_round(c1);
634   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
635 }
636 
637 void test_builtin_elementwise_rint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
638   struct Foo s = __builtin_elementwise_rint(f);
639   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
640 
641   i = __builtin_elementwise_rint();
642   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
643 
644   i = __builtin_elementwise_rint(i);
645   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
646 
647   i = __builtin_elementwise_rint(f, f);
648   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
649 
650   u = __builtin_elementwise_rint(u);
651   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
652 
653   uv = __builtin_elementwise_rint(uv);
654   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
655 
656   // FIXME: Error should not mention integer
657   _Complex float c1, c2;
658   c1 = __builtin_elementwise_rint(c1);
659   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
660 }
661 
662 void test_builtin_elementwise_nearbyint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
663   struct Foo s = __builtin_elementwise_nearbyint(f);
664   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
665 
666   i = __builtin_elementwise_nearbyint();
667   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
668 
669   i = __builtin_elementwise_nearbyint(i);
670   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
671 
672   i = __builtin_elementwise_nearbyint(f, f);
673   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
674 
675   u = __builtin_elementwise_nearbyint(u);
676   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
677 
678   uv = __builtin_elementwise_nearbyint(uv);
679   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
680 
681   // FIXME: Error should not mention integer
682   _Complex float c1, c2;
683   c1 = __builtin_elementwise_nearbyint(c1);
684   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
685 }
686 
687 void test_builtin_elementwise_asin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
688 
689   struct Foo s = __builtin_elementwise_asin(f);
690   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
691 
692   i = __builtin_elementwise_asin();
693   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
694 
695   i = __builtin_elementwise_asin(i);
696   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
697 
698   i = __builtin_elementwise_asin(f, f);
699   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
700 
701   u = __builtin_elementwise_asin(u);
702   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
703 
704   uv = __builtin_elementwise_asin(uv);
705   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
706 }
707 
708 void test_builtin_elementwise_sin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
709 
710   struct Foo s = __builtin_elementwise_sin(f);
711   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
712 
713   i = __builtin_elementwise_sin();
714   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
715 
716   i = __builtin_elementwise_sin(i);
717   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
718 
719   i = __builtin_elementwise_sin(f, f);
720   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
721 
722   u = __builtin_elementwise_sin(u);
723   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
724 
725   uv = __builtin_elementwise_sin(uv);
726   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
727 }
728 
729 void test_builtin_elementwise_sinh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
730 
731   struct Foo s = __builtin_elementwise_sinh(f);
732   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
733 
734   i = __builtin_elementwise_sinh();
735   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
736 
737   i = __builtin_elementwise_sinh(i);
738   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
739 
740   i = __builtin_elementwise_sinh(f, f);
741   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
742 
743   u = __builtin_elementwise_sinh(u);
744   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
745 
746   uv = __builtin_elementwise_sinh(uv);
747   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
748 }
749 
750 void test_builtin_elementwise_sqrt(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
751 
752   struct Foo s = __builtin_elementwise_sqrt(f);
753   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
754 
755   i = __builtin_elementwise_sqrt();
756   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
757 
758   i = __builtin_elementwise_sqrt(i);
759   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
760 
761   i = __builtin_elementwise_sqrt(f, f);
762   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
763 
764   u = __builtin_elementwise_sqrt(u);
765   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
766 
767   uv = __builtin_elementwise_sqrt(uv);
768   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
769 }
770 
771 void test_builtin_elementwise_atan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
772 
773   struct Foo s = __builtin_elementwise_atan(f);
774   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
775 
776   i = __builtin_elementwise_atan();
777   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
778 
779   i = __builtin_elementwise_atan(i);
780   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
781 
782   i = __builtin_elementwise_atan(f, f);
783   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
784 
785   u = __builtin_elementwise_atan(u);
786   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
787 
788   uv = __builtin_elementwise_atan(uv);
789   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
790 }
791 
792 void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
793 
794   struct Foo s = __builtin_elementwise_tan(f);
795   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
796 
797   i = __builtin_elementwise_tan();
798   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
799 
800   i = __builtin_elementwise_tan(i);
801   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
802 
803   i = __builtin_elementwise_tan(f, f);
804   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
805 
806   u = __builtin_elementwise_tan(u);
807   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
808 
809   uv = __builtin_elementwise_tan(uv);
810   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
811 }
812 
813 void test_builtin_elementwise_tanh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
814 
815   struct Foo s = __builtin_elementwise_tanh(f);
816   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
817 
818   i = __builtin_elementwise_tanh();
819   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
820 
821   i = __builtin_elementwise_tanh(i);
822   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
823 
824   i = __builtin_elementwise_tanh(f, f);
825   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
826 
827   u = __builtin_elementwise_tanh(u);
828   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
829 
830   uv = __builtin_elementwise_tanh(uv);
831   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
832 }
833 
834 void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
835 
836   struct Foo s = __builtin_elementwise_trunc(f);
837   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
838 
839   i = __builtin_elementwise_trunc();
840   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
841 
842   i = __builtin_elementwise_trunc(i);
843   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
844 
845   i = __builtin_elementwise_trunc(f, f);
846   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
847 
848   u = __builtin_elementwise_trunc(u);
849   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
850 
851   uv = __builtin_elementwise_trunc(uv);
852   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
853 }
854 
855 void test_builtin_elementwise_canonicalize(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
856 
857   struct Foo s = __builtin_elementwise_canonicalize(f);
858   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
859 
860   i = __builtin_elementwise_canonicalize();
861   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
862 
863   i = __builtin_elementwise_canonicalize(i);
864   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
865 
866   i = __builtin_elementwise_canonicalize(f, f);
867   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
868 
869   u = __builtin_elementwise_canonicalize(u);
870   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
871 
872   uv = __builtin_elementwise_canonicalize(uv);
873   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
874 }
875 
876 void test_builtin_elementwise_copysign(int i, short s, double d, float f, float4 v, int3 iv, unsigned3 uv, int *p) {
877   i = __builtin_elementwise_copysign(p, d);
878   // expected-error@-1 {{1st argument must be a floating point type (was 'int *')}}
879 
880   i = __builtin_elementwise_copysign(i, i);
881   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
882 
883   i = __builtin_elementwise_copysign(i);
884   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
885 
886   i = __builtin_elementwise_copysign();
887   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
888 
889   i = __builtin_elementwise_copysign(i, i, i);
890   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
891 
892   i = __builtin_elementwise_copysign(v, iv);
893   // expected-error@-1 {{2nd argument must be a floating point type (was 'int3' (vector of 3 'int' values))}}
894 
895   i = __builtin_elementwise_copysign(uv, iv);
896   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
897 
898   s = __builtin_elementwise_copysign(i, s);
899   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
900 
901   f = __builtin_elementwise_copysign(f, i);
902   // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
903 
904   f = __builtin_elementwise_copysign(i, f);
905   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
906 
907   enum e { one,
908            two };
909   i = __builtin_elementwise_copysign(one, two);
910   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
911 
912   enum f { three };
913   enum f x = __builtin_elementwise_copysign(one, three);
914   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
915 
916   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
917   ext = __builtin_elementwise_copysign(ext, ext);
918   // expected-error@-1 {{1st argument must be a floating point type (was '_BitInt(32)')}}
919 
920   const float cf32;
921   f = __builtin_elementwise_copysign(cf32, f);
922   f = __builtin_elementwise_copysign(f, cf32);
923   f = __builtin_elementwise_copysign(cf32, f);
924 
925   f = __builtin_elementwise_copysign(f, float_as_one); // ok (attributes don't match)?
926   f = __builtin_elementwise_copysign(f, waf);          // ok (sugar doesn't match)?
927 
928   float A[10];
929   A = __builtin_elementwise_copysign(A, A);
930   // expected-error@-1 {{1st argument must be a floating point type (was 'float *')}}
931 
932   float(ii);
933   float j;
934   j = __builtin_elementwise_copysign(f, j);
935 
936   _Complex float c1, c2;
937   c1 = __builtin_elementwise_copysign(c1, c2);
938   // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
939 
940   double f64 = 0.0;
941   double tmp0 = __builtin_elementwise_copysign(f64, f);
942   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
943 
944   float tmp1 = __builtin_elementwise_copysign(f, f64);
945   //expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
946 
947   float4 v4f32 = 0.0f;
948   float4 tmp2 = __builtin_elementwise_copysign(v4f32, f);
949   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float')}}
950 
951   float tmp3 = __builtin_elementwise_copysign(f, v4f32);
952   // expected-error@-1 {{arguments are of different types ('float' vs 'float4' (vector of 4 'float' values))}}
953 
954   float2 v2f32 = 0.0f;
955   double4 v4f64 = 0.0;
956   double4 tmp4 = __builtin_elementwise_copysign(v4f64, v4f32);
957   // expected-error@-1 {{arguments are of different types ('double4' (vector of 4 'double' values) vs 'float4' (vector of 4 'float' values))}}
958 
959   float4 tmp6 = __builtin_elementwise_copysign(v4f32, v4f64);
960   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}}
961 
962   float4 tmp7 = __builtin_elementwise_copysign(v4f32, v2f32);
963   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float2' (vector of 2 'float' values))}}
964 
965   float2 tmp8 = __builtin_elementwise_copysign(v2f32, v4f32);
966   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'float4' (vector of 4 'float' values))}}
967 
968   float2 tmp9 = __builtin_elementwise_copysign(v4f32, v4f32);
969   // expected-error@-1 {{initializing 'float2' (vector of 2 'float' values) with an expression of incompatible type 'float4' (vector of 4 'float' values)}}
970 }
971 
972 void test_builtin_elementwise_fma(int i32, int2 v2i32, short i16,
973                                   double f64, double2 v2f64, double2 v3f64,
974                                   float f32, float2 v2f32, float v3f32, float4 v4f32,
975                                   const float4 c_v4f32,
976                                   int3 v3i32, int *ptr) {
977 
978   f32 = __builtin_elementwise_fma();
979   // expected-error@-1 {{too few arguments to function call, expected 3, have 0}}
980 
981   f32 = __builtin_elementwise_fma(f32);
982   // expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
983 
984   f32 = __builtin_elementwise_fma(f32, f32);
985   // expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
986 
987   f32 = __builtin_elementwise_fma(f32, f32, f32, f32);
988   // expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
989 
990   f32 = __builtin_elementwise_fma(f64, f32, f32);
991   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
992 
993   f32 = __builtin_elementwise_fma(f32, f64, f32);
994   // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
995 
996   f32 = __builtin_elementwise_fma(f32, f32, f64);
997   // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
998 
999   f32 = __builtin_elementwise_fma(f32, f32, f64);
1000   // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1001 
1002   f64 = __builtin_elementwise_fma(f64, f32, f32);
1003   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1004 
1005   f64 = __builtin_elementwise_fma(f64, f64, f32);
1006   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1007 
1008   f64 = __builtin_elementwise_fma(f64, f32, f64);
1009   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1010 
1011   v2f64 = __builtin_elementwise_fma(v2f32, f64, f64);
1012   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}}
1013 
1014   v2f64 = __builtin_elementwise_fma(v2f32, v2f64, f64);
1015   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double2' (vector of 2 'double' values)}}
1016 
1017   v2f64 = __builtin_elementwise_fma(v2f32, f64, v2f64);
1018   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}}
1019 
1020   v2f64 = __builtin_elementwise_fma(f64, v2f32, v2f64);
1021   // expected-error@-1 {{arguments are of different types ('double' vs 'float2' (vector of 2 'float' values)}}
1022 
1023   v2f64 = __builtin_elementwise_fma(f64, v2f64, v2f64);
1024   // expected-error@-1 {{arguments are of different types ('double' vs 'double2' (vector of 2 'double' values)}}
1025 
1026   i32 = __builtin_elementwise_fma(i32, i32, i32);
1027   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
1028 
1029   v2i32 = __builtin_elementwise_fma(v2i32, v2i32, v2i32);
1030   // expected-error@-1 {{1st argument must be a floating point type (was 'int2' (vector of 2 'int' values))}}
1031 
1032   f32 = __builtin_elementwise_fma(f32, f32, i32);
1033   // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
1034 
1035   f32 = __builtin_elementwise_fma(f32, i32, f32);
1036   // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
1037 
1038   f32 = __builtin_elementwise_fma(f32, f32, i32);
1039   // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
1040 
1041 
1042   _Complex float c1, c2, c3;
1043   c1 = __builtin_elementwise_fma(c1, f32, f32);
1044   // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
1045 
1046   c2 = __builtin_elementwise_fma(f32, c2, f32);
1047   // expected-error@-1 {{2nd argument must be a floating point type (was '_Complex float')}}
1048 
1049   c3 = __builtin_elementwise_fma(f32, f32, c3);
1050   // expected-error@-1 {{3rd argument must be a floating point type (was '_Complex float')}}
1051 }
1052