xref: /llvm-project/clang/test/Sema/builtins-elementwise-math.c (revision b70d32789c9463d49b46b4e57c44607d1c956e4c)
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_atan2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
793 
794   struct Foo s = __builtin_elementwise_atan2(f, f);
795   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
796 
797   i = __builtin_elementwise_atan2();
798   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
799 
800   i = __builtin_elementwise_atan2(f);
801   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
802 
803   i = __builtin_elementwise_atan2(i, i);
804   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
805 
806   i = __builtin_elementwise_atan2(f, f, f);
807   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
808 
809   u = __builtin_elementwise_atan2(u, u);
810   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
811 
812   uv = __builtin_elementwise_atan2(uv, uv);
813   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
814 }
815 
816 void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
817 
818   struct Foo s = __builtin_elementwise_tan(f);
819   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
820 
821   i = __builtin_elementwise_tan();
822   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
823 
824   i = __builtin_elementwise_tan(i);
825   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
826 
827   i = __builtin_elementwise_tan(f, f);
828   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
829 
830   u = __builtin_elementwise_tan(u);
831   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
832 
833   uv = __builtin_elementwise_tan(uv);
834   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
835 }
836 
837 void test_builtin_elementwise_tanh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
838 
839   struct Foo s = __builtin_elementwise_tanh(f);
840   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
841 
842   i = __builtin_elementwise_tanh();
843   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
844 
845   i = __builtin_elementwise_tanh(i);
846   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
847 
848   i = __builtin_elementwise_tanh(f, f);
849   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
850 
851   u = __builtin_elementwise_tanh(u);
852   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
853 
854   uv = __builtin_elementwise_tanh(uv);
855   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
856 }
857 
858 void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
859 
860   struct Foo s = __builtin_elementwise_trunc(f);
861   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
862 
863   i = __builtin_elementwise_trunc();
864   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
865 
866   i = __builtin_elementwise_trunc(i);
867   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
868 
869   i = __builtin_elementwise_trunc(f, f);
870   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
871 
872   u = __builtin_elementwise_trunc(u);
873   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
874 
875   uv = __builtin_elementwise_trunc(uv);
876   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
877 }
878 
879 void test_builtin_elementwise_canonicalize(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
880 
881   struct Foo s = __builtin_elementwise_canonicalize(f);
882   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
883 
884   i = __builtin_elementwise_canonicalize();
885   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
886 
887   i = __builtin_elementwise_canonicalize(i);
888   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
889 
890   i = __builtin_elementwise_canonicalize(f, f);
891   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
892 
893   u = __builtin_elementwise_canonicalize(u);
894   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
895 
896   uv = __builtin_elementwise_canonicalize(uv);
897   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
898 }
899 
900 void test_builtin_elementwise_copysign(int i, short s, double d, float f, float4 v, int3 iv, unsigned3 uv, int *p) {
901   i = __builtin_elementwise_copysign(p, d);
902   // expected-error@-1 {{1st argument must be a floating point type (was 'int *')}}
903 
904   i = __builtin_elementwise_copysign(i, i);
905   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
906 
907   i = __builtin_elementwise_copysign(i);
908   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
909 
910   i = __builtin_elementwise_copysign();
911   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
912 
913   i = __builtin_elementwise_copysign(i, i, i);
914   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
915 
916   i = __builtin_elementwise_copysign(v, iv);
917   // expected-error@-1 {{2nd argument must be a floating point type (was 'int3' (vector of 3 'int' values))}}
918 
919   i = __builtin_elementwise_copysign(uv, iv);
920   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
921 
922   s = __builtin_elementwise_copysign(i, s);
923   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
924 
925   f = __builtin_elementwise_copysign(f, i);
926   // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
927 
928   f = __builtin_elementwise_copysign(i, f);
929   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
930 
931   enum e { one,
932            two };
933   i = __builtin_elementwise_copysign(one, two);
934   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
935 
936   enum f { three };
937   enum f x = __builtin_elementwise_copysign(one, three);
938   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
939 
940   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
941   ext = __builtin_elementwise_copysign(ext, ext);
942   // expected-error@-1 {{1st argument must be a floating point type (was '_BitInt(32)')}}
943 
944   const float cf32;
945   f = __builtin_elementwise_copysign(cf32, f);
946   f = __builtin_elementwise_copysign(f, cf32);
947   f = __builtin_elementwise_copysign(cf32, f);
948 
949   f = __builtin_elementwise_copysign(f, float_as_one); // ok (attributes don't match)?
950   f = __builtin_elementwise_copysign(f, waf);          // ok (sugar doesn't match)?
951 
952   float A[10];
953   A = __builtin_elementwise_copysign(A, A);
954   // expected-error@-1 {{1st argument must be a floating point type (was 'float *')}}
955 
956   float(ii);
957   float j;
958   j = __builtin_elementwise_copysign(f, j);
959 
960   _Complex float c1, c2;
961   c1 = __builtin_elementwise_copysign(c1, c2);
962   // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
963 
964   double f64 = 0.0;
965   double tmp0 = __builtin_elementwise_copysign(f64, f);
966   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
967 
968   float tmp1 = __builtin_elementwise_copysign(f, f64);
969   //expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
970 
971   float4 v4f32 = 0.0f;
972   float4 tmp2 = __builtin_elementwise_copysign(v4f32, f);
973   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float')}}
974 
975   float tmp3 = __builtin_elementwise_copysign(f, v4f32);
976   // expected-error@-1 {{arguments are of different types ('float' vs 'float4' (vector of 4 'float' values))}}
977 
978   float2 v2f32 = 0.0f;
979   double4 v4f64 = 0.0;
980   double4 tmp4 = __builtin_elementwise_copysign(v4f64, v4f32);
981   // expected-error@-1 {{arguments are of different types ('double4' (vector of 4 'double' values) vs 'float4' (vector of 4 'float' values))}}
982 
983   float4 tmp6 = __builtin_elementwise_copysign(v4f32, v4f64);
984   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}}
985 
986   float4 tmp7 = __builtin_elementwise_copysign(v4f32, v2f32);
987   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float2' (vector of 2 'float' values))}}
988 
989   float2 tmp8 = __builtin_elementwise_copysign(v2f32, v4f32);
990   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'float4' (vector of 4 'float' values))}}
991 
992   float2 tmp9 = __builtin_elementwise_copysign(v4f32, v4f32);
993   // expected-error@-1 {{initializing 'float2' (vector of 2 'float' values) with an expression of incompatible type 'float4' (vector of 4 'float' values)}}
994 }
995 
996 void test_builtin_elementwise_fma(int i32, int2 v2i32, short i16,
997                                   double f64, double2 v2f64, double2 v3f64,
998                                   float f32, float2 v2f32, float v3f32, float4 v4f32,
999                                   const float4 c_v4f32,
1000                                   int3 v3i32, int *ptr) {
1001 
1002   f32 = __builtin_elementwise_fma();
1003   // expected-error@-1 {{too few arguments to function call, expected 3, have 0}}
1004 
1005   f32 = __builtin_elementwise_fma(f32);
1006   // expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
1007 
1008   f32 = __builtin_elementwise_fma(f32, f32);
1009   // expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
1010 
1011   f32 = __builtin_elementwise_fma(f32, f32, f32, f32);
1012   // expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
1013 
1014   f32 = __builtin_elementwise_fma(f64, f32, f32);
1015   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1016 
1017   f32 = __builtin_elementwise_fma(f32, f64, f32);
1018   // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1019 
1020   f32 = __builtin_elementwise_fma(f32, f32, f64);
1021   // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1022 
1023   f32 = __builtin_elementwise_fma(f32, f32, f64);
1024   // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1025 
1026   f64 = __builtin_elementwise_fma(f64, f32, f32);
1027   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1028 
1029   f64 = __builtin_elementwise_fma(f64, f64, f32);
1030   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1031 
1032   f64 = __builtin_elementwise_fma(f64, f32, f64);
1033   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1034 
1035   v2f64 = __builtin_elementwise_fma(v2f32, f64, f64);
1036   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}}
1037 
1038   v2f64 = __builtin_elementwise_fma(v2f32, v2f64, f64);
1039   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double2' (vector of 2 'double' values)}}
1040 
1041   v2f64 = __builtin_elementwise_fma(v2f32, f64, v2f64);
1042   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}}
1043 
1044   v2f64 = __builtin_elementwise_fma(f64, v2f32, v2f64);
1045   // expected-error@-1 {{arguments are of different types ('double' vs 'float2' (vector of 2 'float' values)}}
1046 
1047   v2f64 = __builtin_elementwise_fma(f64, v2f64, v2f64);
1048   // expected-error@-1 {{arguments are of different types ('double' vs 'double2' (vector of 2 'double' values)}}
1049 
1050   i32 = __builtin_elementwise_fma(i32, i32, i32);
1051   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
1052 
1053   v2i32 = __builtin_elementwise_fma(v2i32, v2i32, v2i32);
1054   // expected-error@-1 {{1st argument must be a floating point type (was 'int2' (vector of 2 'int' values))}}
1055 
1056   f32 = __builtin_elementwise_fma(f32, f32, i32);
1057   // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
1058 
1059   f32 = __builtin_elementwise_fma(f32, i32, f32);
1060   // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
1061 
1062   f32 = __builtin_elementwise_fma(f32, f32, i32);
1063   // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
1064 
1065 
1066   _Complex float c1, c2, c3;
1067   c1 = __builtin_elementwise_fma(c1, f32, f32);
1068   // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
1069 
1070   c2 = __builtin_elementwise_fma(f32, c2, f32);
1071   // expected-error@-1 {{2nd argument must be a floating point type (was '_Complex float')}}
1072 
1073   c3 = __builtin_elementwise_fma(f32, f32, c3);
1074   // expected-error@-1 {{3rd argument must be a floating point type (was '_Complex float')}}
1075 }
1076