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