[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / builtins-elementwise-math.c
blob6002e91f8ec6fa9e7f3ad0d8c5a0069bbfd8d577
1 // RUN: %clang_cc1 -std=c99 %s -pedantic -verify -triple=x86_64-apple-darwin9
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)));
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)));
13 struct Foo {
14 char *p;
17 __attribute__((address_space(1))) int int_as_one;
18 typedef int bar;
19 bar b;
21 __attribute__((address_space(1))) float float_as_one;
22 typedef float waffle;
23 waffle waf;
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'}}
30 i = __builtin_elementwise_abs();
31 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
33 i = __builtin_elementwise_abs(i, i);
34 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
36 i = __builtin_elementwise_abs(v);
37 // expected-error@-1 {{assigning to 'int' from incompatible type 'float4' (vector of 4 'float' values)}}
39 u = __builtin_elementwise_abs(u);
40 // expected-error@-1 {{1st argument must be a signed integer or floating point type (was 'unsigned int')}}
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))}}
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')}}
50 struct Foo foo = __builtin_elementwise_add_sat(i, i);
51 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
53 i = __builtin_elementwise_add_sat(i);
54 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
56 i = __builtin_elementwise_add_sat();
57 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
59 i = __builtin_elementwise_add_sat(i, i, i);
60 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
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))}}
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))}}
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))}}
71 s = __builtin_elementwise_add_sat(i, s);
73 enum e { one,
74 two };
75 i = __builtin_elementwise_add_sat(one, two);
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')}}
81 _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
82 ext = __builtin_elementwise_add_sat(ext, ext);
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);
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)?
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 *')}}
96 int(ii);
97 int j;
98 j = __builtin_elementwise_add_sat(i, j);
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')}}
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')}}
109 struct Foo foo = __builtin_elementwise_sub_sat(i, i);
110 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
112 i = __builtin_elementwise_sub_sat(i);
113 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
115 i = __builtin_elementwise_sub_sat();
116 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
118 i = __builtin_elementwise_sub_sat(i, i, i);
119 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
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))}}
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))}}
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))}}
130 s = __builtin_elementwise_sub_sat(i, s);
132 enum e { one,
133 two };
134 i = __builtin_elementwise_sub_sat(one, two);
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')}}
140 _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
141 ext = __builtin_elementwise_sub_sat(ext, ext);
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);
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)?
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 *')}}
155 int(ii);
156 int j;
157 j = __builtin_elementwise_sub_sat(i, j);
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')}}
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')}}
168 struct Foo foo = __builtin_elementwise_max(i, i);
169 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
171 i = __builtin_elementwise_max(i);
172 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
174 i = __builtin_elementwise_max();
175 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
177 i = __builtin_elementwise_max(i, i, i);
178 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
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))}}
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))}}
186 s = __builtin_elementwise_max(i, s);
188 enum e { one,
189 two };
190 i = __builtin_elementwise_max(one, two);
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')}}
196 _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
197 ext = __builtin_elementwise_max(ext, ext);
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);
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)?
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 *')}}
211 int(ii);
212 int j;
213 j = __builtin_elementwise_max(i, j);
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')}}
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')}}
224 struct Foo foo = __builtin_elementwise_min(i, i);
225 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
227 i = __builtin_elementwise_min(i);
228 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
230 i = __builtin_elementwise_min();
231 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
233 i = __builtin_elementwise_min(i, i, i);
234 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
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))}}
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))}}
242 s = __builtin_elementwise_min(i, s);
244 enum e { one,
245 two };
246 i = __builtin_elementwise_min(one, two);
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')}}
252 _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
253 ext = __builtin_elementwise_min(ext, ext);
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);
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)?
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 *')}}
267 int(ii);
268 int j;
269 j = __builtin_elementwise_min(i, j);
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')}}
276 void test_builtin_elementwise_maximum(int i, short s, float f, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
277 i = __builtin_elementwise_maximum(p, d);
278 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
280 struct Foo foo = __builtin_elementwise_maximum(d, d);
281 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}}
283 i = __builtin_elementwise_maximum(i);
284 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
286 i = __builtin_elementwise_maximum();
287 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
289 i = __builtin_elementwise_maximum(i, i, i);
290 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
292 i = __builtin_elementwise_maximum(v, iv);
293 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
295 i = __builtin_elementwise_maximum(uv, iv);
296 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
298 d = __builtin_elementwise_maximum(f, d);
300 v = __builtin_elementwise_maximum(v, v);
302 i = __builtin_elementwise_maximum(iv, iv);
303 // expected-error@-1 {{1st argument must be a floating point type (was 'int3' (vector of 3 'int' values))}}
305 i = __builtin_elementwise_maximum(i, i);
306 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
308 int A[10];
309 A = __builtin_elementwise_maximum(A, A);
310 // expected-error@-1 {{1st argument must be a floating point type (was 'int *')}}
312 _Complex float c1, c2;
313 c1 = __builtin_elementwise_maximum(c1, c2);
314 // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
317 void test_builtin_elementwise_minimum(int i, short s, float f, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
318 i = __builtin_elementwise_minimum(p, d);
319 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
321 struct Foo foo = __builtin_elementwise_minimum(d, d);
322 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}}
324 i = __builtin_elementwise_minimum(i);
325 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
327 i = __builtin_elementwise_minimum();
328 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
330 i = __builtin_elementwise_minimum(i, i, i);
331 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
333 i = __builtin_elementwise_minimum(v, iv);
334 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
336 i = __builtin_elementwise_minimum(uv, iv);
337 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
339 d = __builtin_elementwise_minimum(f, d);
341 v = __builtin_elementwise_minimum(v, v);
343 i = __builtin_elementwise_minimum(iv, iv);
344 // expected-error@-1 {{1st argument must be a floating point type (was 'int3' (vector of 3 'int' values))}}
346 i = __builtin_elementwise_minimum(i, i);
347 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
349 int A[10];
350 A = __builtin_elementwise_minimum(A, A);
351 // expected-error@-1 {{1st argument must be a floating point type (was 'int *')}}
353 _Complex float c1, c2;
354 c1 = __builtin_elementwise_minimum(c1, c2);
355 // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
358 void test_builtin_elementwise_bitreverse(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
360 struct Foo s = __builtin_elementwise_bitreverse(i);
361 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
363 i = __builtin_elementwise_bitreverse();
364 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
366 i = __builtin_elementwise_bitreverse(f);
367 // expected-error@-1 {{1st argument must be a vector of integers (was 'float')}}
369 i = __builtin_elementwise_bitreverse(f, f);
370 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
372 u = __builtin_elementwise_bitreverse(d);
373 // expected-error@-1 {{1st argument must be a vector of integers (was 'double')}}
375 v = __builtin_elementwise_bitreverse(v);
376 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
379 void test_builtin_elementwise_ceil(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
381 struct Foo s = __builtin_elementwise_ceil(f);
382 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
384 i = __builtin_elementwise_ceil();
385 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
387 i = __builtin_elementwise_ceil(i);
388 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
390 i = __builtin_elementwise_ceil(f, f);
391 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
393 u = __builtin_elementwise_ceil(u);
394 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
396 uv = __builtin_elementwise_ceil(uv);
397 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
400 void test_builtin_elementwise_acos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
402 struct Foo s = __builtin_elementwise_acos(f);
403 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
405 i = __builtin_elementwise_acos();
406 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
408 i = __builtin_elementwise_acos(i);
409 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
411 i = __builtin_elementwise_acos(f, f);
412 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
414 u = __builtin_elementwise_acos(u);
415 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
417 uv = __builtin_elementwise_acos(uv);
418 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
421 void test_builtin_elementwise_cos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
423 struct Foo s = __builtin_elementwise_cos(f);
424 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
426 i = __builtin_elementwise_cos();
427 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
429 i = __builtin_elementwise_cos(i);
430 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
432 i = __builtin_elementwise_cos(f, f);
433 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
435 u = __builtin_elementwise_cos(u);
436 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
438 uv = __builtin_elementwise_cos(uv);
439 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
442 void test_builtin_elementwise_cosh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
444 struct Foo s = __builtin_elementwise_cosh(f);
445 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
447 i = __builtin_elementwise_cosh();
448 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
450 i = __builtin_elementwise_cosh(i);
451 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
453 i = __builtin_elementwise_cosh(f, f);
454 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
456 u = __builtin_elementwise_cosh(u);
457 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
459 uv = __builtin_elementwise_cosh(uv);
460 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
463 void test_builtin_elementwise_exp(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
465 struct Foo s = __builtin_elementwise_exp(f);
466 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
468 i = __builtin_elementwise_exp();
469 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
471 i = __builtin_elementwise_exp(i);
472 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
474 i = __builtin_elementwise_exp(f, f);
475 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
477 u = __builtin_elementwise_exp(u);
478 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
480 uv = __builtin_elementwise_exp(uv);
481 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
484 void test_builtin_elementwise_exp2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
486 struct Foo s = __builtin_elementwise_exp2(f);
487 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
489 i = __builtin_elementwise_exp2();
490 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
492 i = __builtin_elementwise_exp2(i);
493 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
495 i = __builtin_elementwise_exp2(f, f);
496 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
498 u = __builtin_elementwise_exp2(u);
499 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
501 uv = __builtin_elementwise_exp2(uv);
502 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
506 void test_builtin_elementwise_floor(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
508 struct Foo s = __builtin_elementwise_floor(f);
509 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
511 i = __builtin_elementwise_floor();
512 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
514 i = __builtin_elementwise_floor(i);
515 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
517 i = __builtin_elementwise_floor(f, f);
518 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
520 u = __builtin_elementwise_floor(u);
521 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
523 uv = __builtin_elementwise_floor(uv);
524 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
527 void test_builtin_elementwise_log(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
529 struct Foo s = __builtin_elementwise_log(f);
530 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
532 i = __builtin_elementwise_log();
533 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
535 i = __builtin_elementwise_log(i);
536 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
538 i = __builtin_elementwise_log(f, f);
539 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
541 u = __builtin_elementwise_log(u);
542 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
544 uv = __builtin_elementwise_log(uv);
545 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
548 void test_builtin_elementwise_log10(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
550 struct Foo s = __builtin_elementwise_log10(f);
551 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
553 i = __builtin_elementwise_log10();
554 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
556 i = __builtin_elementwise_log10(i);
557 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
559 i = __builtin_elementwise_log10(f, f);
560 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
562 u = __builtin_elementwise_log10(u);
563 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
565 uv = __builtin_elementwise_log10(uv);
566 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
569 void test_builtin_elementwise_log2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
571 struct Foo s = __builtin_elementwise_log2(f);
572 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
574 i = __builtin_elementwise_log2();
575 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
577 i = __builtin_elementwise_log2(i);
578 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
580 i = __builtin_elementwise_log2(f, f);
581 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
583 u = __builtin_elementwise_log2(u);
584 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
586 uv = __builtin_elementwise_log2(uv);
587 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
590 void test_builtin_elementwise_popcount(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
592 struct Foo s = __builtin_elementwise_popcount(i);
593 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
595 i = __builtin_elementwise_popcount();
596 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
598 i = __builtin_elementwise_popcount(f);
599 // expected-error@-1 {{1st argument must be a vector of integers (was 'float')}}
601 i = __builtin_elementwise_popcount(f, f);
602 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
604 u = __builtin_elementwise_popcount(d);
605 // expected-error@-1 {{1st argument must be a vector of integers (was 'double')}}
607 v = __builtin_elementwise_popcount(v);
608 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
610 int2 i2 = __builtin_elementwise_popcount(iv);
611 // expected-error@-1 {{initializing 'int2' (vector of 2 'int' values) with an expression of incompatible type 'int3' (vector of 3 'int' values)}}
613 iv = __builtin_elementwise_popcount(i2);
614 // expected-error@-1 {{assigning to 'int3' (vector of 3 'int' values) from incompatible type 'int2' (vector of 2 'int' values)}}
616 unsigned3 u3 = __builtin_elementwise_popcount(iv);
617 // expected-error@-1 {{initializing 'unsigned3' (vector of 3 'unsigned int' values) with an expression of incompatible type 'int3' (vector of 3 'int' values)}}
619 iv = __builtin_elementwise_popcount(u3);
620 // expected-error@-1 {{assigning to 'int3' (vector of 3 'int' values) from incompatible type 'unsigned3' (vector of 3 'unsigned int' values)}}
623 void test_builtin_elementwise_fmod(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
624 i = __builtin_elementwise_fmod(p, d);
625 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
627 struct Foo foo = __builtin_elementwise_fmod(i, i);
628 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
630 i = __builtin_elementwise_fmod(i);
631 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
633 i = __builtin_elementwise_fmod();
634 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
636 i = __builtin_elementwise_fmod(i, i, i);
637 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
639 i = __builtin_elementwise_fmod(v, iv);
640 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
642 i = __builtin_elementwise_fmod(uv, iv);
643 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
645 i = __builtin_elementwise_fmod(d, v);
646 // expected-error@-1 {{arguments are of different types ('double' vs 'float4' (vector of 4 'float' values))}}
649 void test_builtin_elementwise_pow(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
650 i = __builtin_elementwise_pow(p, d);
651 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
653 struct Foo foo = __builtin_elementwise_pow(i, i);
654 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
656 i = __builtin_elementwise_pow(i);
657 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
659 i = __builtin_elementwise_pow();
660 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
662 i = __builtin_elementwise_pow(i, i, i);
663 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
665 i = __builtin_elementwise_pow(v, iv);
666 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
668 i = __builtin_elementwise_pow(uv, iv);
669 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
673 void test_builtin_elementwise_roundeven(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
675 struct Foo s = __builtin_elementwise_roundeven(f);
676 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
678 i = __builtin_elementwise_roundeven();
679 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
681 i = __builtin_elementwise_roundeven(i);
682 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
684 i = __builtin_elementwise_roundeven(f, f);
685 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
687 u = __builtin_elementwise_roundeven(u);
688 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
690 uv = __builtin_elementwise_roundeven(uv);
691 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
694 void test_builtin_elementwise_round(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
695 struct Foo s = __builtin_elementwise_round(f);
696 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
698 i = __builtin_elementwise_round();
699 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
701 i = __builtin_elementwise_round(i);
702 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
704 i = __builtin_elementwise_round(f, f);
705 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
707 u = __builtin_elementwise_round(u);
708 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
710 uv = __builtin_elementwise_round(uv);
711 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
713 // FIXME: Error should not mention integer
714 _Complex float c1, c2;
715 c1 = __builtin_elementwise_round(c1);
716 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
719 void test_builtin_elementwise_rint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
720 struct Foo s = __builtin_elementwise_rint(f);
721 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
723 i = __builtin_elementwise_rint();
724 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
726 i = __builtin_elementwise_rint(i);
727 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
729 i = __builtin_elementwise_rint(f, f);
730 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
732 u = __builtin_elementwise_rint(u);
733 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
735 uv = __builtin_elementwise_rint(uv);
736 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
738 // FIXME: Error should not mention integer
739 _Complex float c1, c2;
740 c1 = __builtin_elementwise_rint(c1);
741 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
744 void test_builtin_elementwise_nearbyint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
745 struct Foo s = __builtin_elementwise_nearbyint(f);
746 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
748 i = __builtin_elementwise_nearbyint();
749 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
751 i = __builtin_elementwise_nearbyint(i);
752 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
754 i = __builtin_elementwise_nearbyint(f, f);
755 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
757 u = __builtin_elementwise_nearbyint(u);
758 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
760 uv = __builtin_elementwise_nearbyint(uv);
761 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
763 // FIXME: Error should not mention integer
764 _Complex float c1, c2;
765 c1 = __builtin_elementwise_nearbyint(c1);
766 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
769 void test_builtin_elementwise_asin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
771 struct Foo s = __builtin_elementwise_asin(f);
772 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
774 i = __builtin_elementwise_asin();
775 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
777 i = __builtin_elementwise_asin(i);
778 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
780 i = __builtin_elementwise_asin(f, f);
781 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
783 u = __builtin_elementwise_asin(u);
784 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
786 uv = __builtin_elementwise_asin(uv);
787 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
790 void test_builtin_elementwise_sin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
792 struct Foo s = __builtin_elementwise_sin(f);
793 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
795 i = __builtin_elementwise_sin();
796 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
798 i = __builtin_elementwise_sin(i);
799 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
801 i = __builtin_elementwise_sin(f, f);
802 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
804 u = __builtin_elementwise_sin(u);
805 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
807 uv = __builtin_elementwise_sin(uv);
808 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
811 void test_builtin_elementwise_sinh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
813 struct Foo s = __builtin_elementwise_sinh(f);
814 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
816 i = __builtin_elementwise_sinh();
817 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
819 i = __builtin_elementwise_sinh(i);
820 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
822 i = __builtin_elementwise_sinh(f, f);
823 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
825 u = __builtin_elementwise_sinh(u);
826 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
828 uv = __builtin_elementwise_sinh(uv);
829 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
832 void test_builtin_elementwise_sqrt(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
834 struct Foo s = __builtin_elementwise_sqrt(f);
835 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
837 i = __builtin_elementwise_sqrt();
838 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
840 i = __builtin_elementwise_sqrt(i);
841 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
843 i = __builtin_elementwise_sqrt(f, f);
844 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
846 u = __builtin_elementwise_sqrt(u);
847 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
849 uv = __builtin_elementwise_sqrt(uv);
850 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
853 void test_builtin_elementwise_atan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
855 struct Foo s = __builtin_elementwise_atan(f);
856 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
858 i = __builtin_elementwise_atan();
859 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
861 i = __builtin_elementwise_atan(i);
862 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
864 i = __builtin_elementwise_atan(f, f);
865 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
867 u = __builtin_elementwise_atan(u);
868 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
870 uv = __builtin_elementwise_atan(uv);
871 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
874 void test_builtin_elementwise_atan2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
876 struct Foo s = __builtin_elementwise_atan2(f, f);
877 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
879 i = __builtin_elementwise_atan2();
880 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
882 i = __builtin_elementwise_atan2(f);
883 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
885 i = __builtin_elementwise_atan2(i, i);
886 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
888 i = __builtin_elementwise_atan2(f, f, f);
889 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
891 u = __builtin_elementwise_atan2(u, u);
892 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
894 uv = __builtin_elementwise_atan2(uv, uv);
895 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
898 void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
900 struct Foo s = __builtin_elementwise_tan(f);
901 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
903 i = __builtin_elementwise_tan();
904 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
906 i = __builtin_elementwise_tan(i);
907 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
909 i = __builtin_elementwise_tan(f, f);
910 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
912 u = __builtin_elementwise_tan(u);
913 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
915 uv = __builtin_elementwise_tan(uv);
916 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
919 void test_builtin_elementwise_tanh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
921 struct Foo s = __builtin_elementwise_tanh(f);
922 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
924 i = __builtin_elementwise_tanh();
925 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
927 i = __builtin_elementwise_tanh(i);
928 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
930 i = __builtin_elementwise_tanh(f, f);
931 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
933 u = __builtin_elementwise_tanh(u);
934 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
936 uv = __builtin_elementwise_tanh(uv);
937 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
940 void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
942 struct Foo s = __builtin_elementwise_trunc(f);
943 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
945 i = __builtin_elementwise_trunc();
946 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
948 i = __builtin_elementwise_trunc(i);
949 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
951 i = __builtin_elementwise_trunc(f, f);
952 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
954 u = __builtin_elementwise_trunc(u);
955 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
957 uv = __builtin_elementwise_trunc(uv);
958 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
961 void test_builtin_elementwise_canonicalize(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
963 struct Foo s = __builtin_elementwise_canonicalize(f);
964 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
966 i = __builtin_elementwise_canonicalize();
967 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
969 i = __builtin_elementwise_canonicalize(i);
970 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
972 i = __builtin_elementwise_canonicalize(f, f);
973 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
975 u = __builtin_elementwise_canonicalize(u);
976 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
978 uv = __builtin_elementwise_canonicalize(uv);
979 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
982 void test_builtin_elementwise_copysign(int i, short s, double d, float f, float4 v, int3 iv, unsigned3 uv, int *p) {
983 i = __builtin_elementwise_copysign(p, d);
984 // expected-error@-1 {{1st argument must be a floating point type (was 'int *')}}
986 i = __builtin_elementwise_copysign(i, i);
987 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
989 i = __builtin_elementwise_copysign(i);
990 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
992 i = __builtin_elementwise_copysign();
993 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
995 i = __builtin_elementwise_copysign(i, i, i);
996 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
998 i = __builtin_elementwise_copysign(v, iv);
999 // expected-error@-1 {{2nd argument must be a floating point type (was 'int3' (vector of 3 'int' values))}}
1001 i = __builtin_elementwise_copysign(uv, iv);
1002 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
1004 s = __builtin_elementwise_copysign(i, s);
1005 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
1007 f = __builtin_elementwise_copysign(f, i);
1008 // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
1010 f = __builtin_elementwise_copysign(i, f);
1011 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
1013 enum e { one,
1014 two };
1015 i = __builtin_elementwise_copysign(one, two);
1016 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
1018 enum f { three };
1019 enum f x = __builtin_elementwise_copysign(one, three);
1020 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
1022 _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
1023 ext = __builtin_elementwise_copysign(ext, ext);
1024 // expected-error@-1 {{1st argument must be a floating point type (was '_BitInt(32)')}}
1026 const float cf32;
1027 f = __builtin_elementwise_copysign(cf32, f);
1028 f = __builtin_elementwise_copysign(f, cf32);
1029 f = __builtin_elementwise_copysign(cf32, f);
1031 f = __builtin_elementwise_copysign(f, float_as_one); // ok (attributes don't match)?
1032 f = __builtin_elementwise_copysign(f, waf); // ok (sugar doesn't match)?
1034 float A[10];
1035 A = __builtin_elementwise_copysign(A, A);
1036 // expected-error@-1 {{1st argument must be a floating point type (was 'float *')}}
1038 float(ii);
1039 float j;
1040 j = __builtin_elementwise_copysign(f, j);
1042 _Complex float c1, c2;
1043 c1 = __builtin_elementwise_copysign(c1, c2);
1044 // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
1046 double f64 = 0.0;
1047 double tmp0 = __builtin_elementwise_copysign(f64, f);
1048 // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1050 float tmp1 = __builtin_elementwise_copysign(f, f64);
1051 //expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1053 float4 v4f32 = 0.0f;
1054 float4 tmp2 = __builtin_elementwise_copysign(v4f32, f);
1055 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float')}}
1057 float tmp3 = __builtin_elementwise_copysign(f, v4f32);
1058 // expected-error@-1 {{arguments are of different types ('float' vs 'float4' (vector of 4 'float' values))}}
1060 float2 v2f32 = 0.0f;
1061 double4 v4f64 = 0.0;
1062 double4 tmp4 = __builtin_elementwise_copysign(v4f64, v4f32);
1063 // expected-error@-1 {{arguments are of different types ('double4' (vector of 4 'double' values) vs 'float4' (vector of 4 'float' values))}}
1065 float4 tmp6 = __builtin_elementwise_copysign(v4f32, v4f64);
1066 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}}
1068 float4 tmp7 = __builtin_elementwise_copysign(v4f32, v2f32);
1069 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float2' (vector of 2 'float' values))}}
1071 float2 tmp8 = __builtin_elementwise_copysign(v2f32, v4f32);
1072 // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'float4' (vector of 4 'float' values))}}
1074 float2 tmp9 = __builtin_elementwise_copysign(v4f32, v4f32);
1075 // expected-error@-1 {{initializing 'float2' (vector of 2 'float' values) with an expression of incompatible type 'float4' (vector of 4 'float' values)}}
1078 void test_builtin_elementwise_fma(int i32, int2 v2i32, short i16,
1079 double f64, double2 v2f64, double2 v3f64,
1080 float f32, float2 v2f32, float v3f32, float4 v4f32,
1081 const float4 c_v4f32,
1082 int3 v3i32, int *ptr) {
1084 f32 = __builtin_elementwise_fma();
1085 // expected-error@-1 {{too few arguments to function call, expected 3, have 0}}
1087 f32 = __builtin_elementwise_fma(f32);
1088 // expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
1090 f32 = __builtin_elementwise_fma(f32, f32);
1091 // expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
1093 f32 = __builtin_elementwise_fma(f32, f32, f32, f32);
1094 // expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
1096 f32 = __builtin_elementwise_fma(f64, f32, f32);
1097 // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1099 f32 = __builtin_elementwise_fma(f32, f64, f32);
1100 // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1102 f32 = __builtin_elementwise_fma(f32, f32, f64);
1103 // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1105 f32 = __builtin_elementwise_fma(f32, f32, f64);
1106 // expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
1108 f64 = __builtin_elementwise_fma(f64, f32, f32);
1109 // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1111 f64 = __builtin_elementwise_fma(f64, f64, f32);
1112 // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1114 f64 = __builtin_elementwise_fma(f64, f32, f64);
1115 // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
1117 v2f64 = __builtin_elementwise_fma(v2f32, f64, f64);
1118 // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}}
1120 v2f64 = __builtin_elementwise_fma(v2f32, v2f64, f64);
1121 // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double2' (vector of 2 'double' values)}}
1123 v2f64 = __builtin_elementwise_fma(v2f32, f64, v2f64);
1124 // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}}
1126 v2f64 = __builtin_elementwise_fma(f64, v2f32, v2f64);
1127 // expected-error@-1 {{arguments are of different types ('double' vs 'float2' (vector of 2 'float' values)}}
1129 v2f64 = __builtin_elementwise_fma(f64, v2f64, v2f64);
1130 // expected-error@-1 {{arguments are of different types ('double' vs 'double2' (vector of 2 'double' values)}}
1132 i32 = __builtin_elementwise_fma(i32, i32, i32);
1133 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
1135 v2i32 = __builtin_elementwise_fma(v2i32, v2i32, v2i32);
1136 // expected-error@-1 {{1st argument must be a floating point type (was 'int2' (vector of 2 'int' values))}}
1138 f32 = __builtin_elementwise_fma(f32, f32, i32);
1139 // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
1141 f32 = __builtin_elementwise_fma(f32, i32, f32);
1142 // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
1144 f32 = __builtin_elementwise_fma(f32, f32, i32);
1145 // expected-error@-1 {{3rd argument must be a floating point type (was 'int')}}
1148 _Complex float c1, c2, c3;
1149 c1 = __builtin_elementwise_fma(c1, f32, f32);
1150 // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
1152 c2 = __builtin_elementwise_fma(f32, c2, f32);
1153 // expected-error@-1 {{2nd argument must be a floating point type (was '_Complex float')}}
1155 c3 = __builtin_elementwise_fma(f32, f32, c3);
1156 // expected-error@-1 {{3rd argument must be a floating point type (was '_Complex float')}}