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)));
7 typedef int int3
__attribute__((ext_vector_type(3)));
8 typedef unsigned unsigned3
__attribute__((ext_vector_type(3)));
9 typedef unsigned unsigned4
__attribute__((ext_vector_type(4)));
15 __attribute__((address_space(1))) int int_as_one
;
19 __attribute__((address_space(1))) float float_as_one
;
24 void test_builtin_elementwise_abs(int i
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
25 struct Foo s
= __builtin_elementwise_abs(i
);
26 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
28 i
= __builtin_elementwise_abs();
29 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
31 i
= __builtin_elementwise_abs(i
, i
);
32 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
34 i
= __builtin_elementwise_abs(v
);
35 // expected-error@-1 {{assigning to 'int' from incompatible type 'float4' (vector of 4 'float' values)}}
37 u
= __builtin_elementwise_abs(u
);
38 // expected-error@-1 {{1st argument must be a signed integer or floating point type (was 'unsigned int')}}
40 uv
= __builtin_elementwise_abs(uv
);
41 // expected-error@-1 {{1st argument must be a signed integer or floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
44 void test_builtin_elementwise_add_sat(int i
, short s
, double d
, float4 v
, int3 iv
, unsigned3 uv
, int *p
) {
45 i
= __builtin_elementwise_add_sat(p
, d
);
46 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
48 struct Foo foo
= __builtin_elementwise_add_sat(i
, i
);
49 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
51 i
= __builtin_elementwise_add_sat(i
);
52 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
54 i
= __builtin_elementwise_add_sat();
55 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
57 i
= __builtin_elementwise_add_sat(i
, i
, i
);
58 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
60 i
= __builtin_elementwise_add_sat(v
, iv
);
61 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
63 i
= __builtin_elementwise_add_sat(uv
, iv
);
64 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
66 v
= __builtin_elementwise_add_sat(v
, v
);
67 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
69 s
= __builtin_elementwise_add_sat(i
, s
);
73 i
= __builtin_elementwise_add_sat(one
, two
);
76 enum f x
= __builtin_elementwise_add_sat(one
, three
);
78 _BitInt(32) ext
; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
79 ext
= __builtin_elementwise_add_sat(ext
, ext
);
82 i
= __builtin_elementwise_add_sat(ci
, i
);
83 i
= __builtin_elementwise_add_sat(i
, ci
);
84 i
= __builtin_elementwise_add_sat(ci
, ci
);
86 i
= __builtin_elementwise_add_sat(i
, int_as_one
); // ok (attributes don't match)?
87 i
= __builtin_elementwise_add_sat(i
, b
); // ok (sugar doesn't match)?
90 A
= __builtin_elementwise_add_sat(A
, A
);
91 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
95 j
= __builtin_elementwise_add_sat(i
, j
);
97 _Complex
float c1
, c2
;
98 c1
= __builtin_elementwise_add_sat(c1
, c2
);
99 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
102 void test_builtin_elementwise_sub_sat(int i
, short s
, double d
, float4 v
, int3 iv
, unsigned3 uv
, int *p
) {
103 i
= __builtin_elementwise_sub_sat(p
, d
);
104 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
106 struct Foo foo
= __builtin_elementwise_sub_sat(i
, i
);
107 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
109 i
= __builtin_elementwise_sub_sat(i
);
110 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
112 i
= __builtin_elementwise_sub_sat();
113 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
115 i
= __builtin_elementwise_sub_sat(i
, i
, i
);
116 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
118 i
= __builtin_elementwise_sub_sat(v
, iv
);
119 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
121 i
= __builtin_elementwise_sub_sat(uv
, iv
);
122 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
124 v
= __builtin_elementwise_sub_sat(v
, v
);
125 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
127 s
= __builtin_elementwise_sub_sat(i
, s
);
131 i
= __builtin_elementwise_sub_sat(one
, two
);
134 enum f x
= __builtin_elementwise_sub_sat(one
, three
);
136 _BitInt(32) ext
; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
137 ext
= __builtin_elementwise_sub_sat(ext
, ext
);
140 i
= __builtin_elementwise_sub_sat(ci
, i
);
141 i
= __builtin_elementwise_sub_sat(i
, ci
);
142 i
= __builtin_elementwise_sub_sat(ci
, ci
);
144 i
= __builtin_elementwise_sub_sat(i
, int_as_one
); // ok (attributes don't match)?
145 i
= __builtin_elementwise_sub_sat(i
, b
); // ok (sugar doesn't match)?
148 A
= __builtin_elementwise_sub_sat(A
, A
);
149 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
153 j
= __builtin_elementwise_sub_sat(i
, j
);
155 _Complex
float c1
, c2
;
156 c1
= __builtin_elementwise_sub_sat(c1
, c2
);
157 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
160 void test_builtin_elementwise_max(int i
, short s
, double d
, float4 v
, int3 iv
, unsigned3 uv
, int *p
) {
161 i
= __builtin_elementwise_max(p
, d
);
162 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
164 struct Foo foo
= __builtin_elementwise_max(i
, i
);
165 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
167 i
= __builtin_elementwise_max(i
);
168 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
170 i
= __builtin_elementwise_max();
171 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
173 i
= __builtin_elementwise_max(i
, i
, i
);
174 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
176 i
= __builtin_elementwise_max(v
, iv
);
177 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
179 i
= __builtin_elementwise_max(uv
, iv
);
180 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
182 s
= __builtin_elementwise_max(i
, s
);
186 i
= __builtin_elementwise_max(one
, two
);
189 enum f x
= __builtin_elementwise_max(one
, three
);
191 _BitInt(32) ext
; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
192 ext
= __builtin_elementwise_max(ext
, ext
);
195 i
= __builtin_elementwise_max(ci
, i
);
196 i
= __builtin_elementwise_max(i
, ci
);
197 i
= __builtin_elementwise_max(ci
, ci
);
199 i
= __builtin_elementwise_max(i
, int_as_one
); // ok (attributes don't match)?
200 i
= __builtin_elementwise_max(i
, b
); // ok (sugar doesn't match)?
203 A
= __builtin_elementwise_max(A
, A
);
204 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
208 j
= __builtin_elementwise_max(i
, j
);
210 _Complex
float c1
, c2
;
211 c1
= __builtin_elementwise_max(c1
, c2
);
212 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
215 void test_builtin_elementwise_min(int i
, short s
, double d
, float4 v
, int3 iv
, unsigned3 uv
, int *p
) {
216 i
= __builtin_elementwise_min(p
, d
);
217 // expected-error@-1 {{arguments are of different types ('int *' vs 'double')}}
219 struct Foo foo
= __builtin_elementwise_min(i
, i
);
220 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
222 i
= __builtin_elementwise_min(i
);
223 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
225 i
= __builtin_elementwise_min();
226 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
228 i
= __builtin_elementwise_min(i
, i
, i
);
229 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
231 i
= __builtin_elementwise_min(v
, iv
);
232 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
234 i
= __builtin_elementwise_min(uv
, iv
);
235 // expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
237 s
= __builtin_elementwise_min(i
, s
);
241 i
= __builtin_elementwise_min(one
, two
);
244 enum f x
= __builtin_elementwise_min(one
, three
);
246 _BitInt(32) ext
; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
247 ext
= __builtin_elementwise_min(ext
, ext
);
250 i
= __builtin_elementwise_min(ci
, i
);
251 i
= __builtin_elementwise_min(i
, ci
);
252 i
= __builtin_elementwise_min(ci
, ci
);
254 i
= __builtin_elementwise_min(i
, int_as_one
); // ok (attributes don't match)?
255 i
= __builtin_elementwise_min(i
, b
); // ok (sugar doesn't match)?
258 A
= __builtin_elementwise_min(A
, A
);
259 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
263 j
= __builtin_elementwise_min(i
, j
);
265 _Complex
float c1
, c2
;
266 c1
= __builtin_elementwise_min(c1
, c2
);
267 // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
270 void test_builtin_elementwise_ceil(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
272 struct Foo s
= __builtin_elementwise_ceil(f
);
273 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
275 i
= __builtin_elementwise_ceil();
276 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
278 i
= __builtin_elementwise_ceil(i
);
279 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
281 i
= __builtin_elementwise_ceil(f
, f
);
282 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
284 u
= __builtin_elementwise_ceil(u
);
285 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
287 uv
= __builtin_elementwise_ceil(uv
);
288 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
291 void test_builtin_elementwise_cos(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
293 struct Foo s
= __builtin_elementwise_cos(f
);
294 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
296 i
= __builtin_elementwise_cos();
297 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
299 i
= __builtin_elementwise_cos(i
);
300 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
302 i
= __builtin_elementwise_cos(f
, f
);
303 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
305 u
= __builtin_elementwise_cos(u
);
306 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
308 uv
= __builtin_elementwise_cos(uv
);
309 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
312 void test_builtin_elementwise_floor(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
314 struct Foo s
= __builtin_elementwise_floor(f
);
315 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
317 i
= __builtin_elementwise_floor();
318 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
320 i
= __builtin_elementwise_floor(i
);
321 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
323 i
= __builtin_elementwise_floor(f
, f
);
324 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
326 u
= __builtin_elementwise_floor(u
);
327 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
329 uv
= __builtin_elementwise_floor(uv
);
330 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
333 void test_builtin_elementwise_log(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
335 struct Foo s
= __builtin_elementwise_log(f
);
336 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
338 i
= __builtin_elementwise_log();
339 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
341 i
= __builtin_elementwise_log(i
);
342 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
344 i
= __builtin_elementwise_log(f
, f
);
345 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
347 u
= __builtin_elementwise_log(u
);
348 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
350 uv
= __builtin_elementwise_log(uv
);
351 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
354 void test_builtin_elementwise_log10(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
356 struct Foo s
= __builtin_elementwise_log10(f
);
357 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
359 i
= __builtin_elementwise_log10();
360 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
362 i
= __builtin_elementwise_log10(i
);
363 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
365 i
= __builtin_elementwise_log10(f
, f
);
366 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
368 u
= __builtin_elementwise_log10(u
);
369 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
371 uv
= __builtin_elementwise_log10(uv
);
372 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
375 void test_builtin_elementwise_log2(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
377 struct Foo s
= __builtin_elementwise_log2(f
);
378 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
380 i
= __builtin_elementwise_log2();
381 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
383 i
= __builtin_elementwise_log2(i
);
384 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
386 i
= __builtin_elementwise_log2(f
, f
);
387 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
389 u
= __builtin_elementwise_log2(u
);
390 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
392 uv
= __builtin_elementwise_log2(uv
);
393 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
396 void test_builtin_elementwise_roundeven(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
398 struct Foo s
= __builtin_elementwise_roundeven(f
);
399 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
401 i
= __builtin_elementwise_roundeven();
402 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
404 i
= __builtin_elementwise_roundeven(i
);
405 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
407 i
= __builtin_elementwise_roundeven(f
, f
);
408 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
410 u
= __builtin_elementwise_roundeven(u
);
411 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
413 uv
= __builtin_elementwise_roundeven(uv
);
414 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
417 void test_builtin_elementwise_sin(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
419 struct Foo s
= __builtin_elementwise_sin(f
);
420 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
422 i
= __builtin_elementwise_sin();
423 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
425 i
= __builtin_elementwise_sin(i
);
426 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
428 i
= __builtin_elementwise_sin(f
, f
);
429 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
431 u
= __builtin_elementwise_sin(u
);
432 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
434 uv
= __builtin_elementwise_sin(uv
);
435 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
438 void test_builtin_elementwise_trunc(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
440 struct Foo s
= __builtin_elementwise_trunc(f
);
441 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
443 i
= __builtin_elementwise_trunc();
444 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
446 i
= __builtin_elementwise_trunc(i
);
447 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
449 i
= __builtin_elementwise_trunc(f
, f
);
450 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
452 u
= __builtin_elementwise_trunc(u
);
453 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
455 uv
= __builtin_elementwise_trunc(uv
);
456 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
459 void test_builtin_elementwise_canonicalize(int i
, float f
, double d
, float4 v
, int3 iv
, unsigned u
, unsigned4 uv
) {
461 struct Foo s
= __builtin_elementwise_canonicalize(f
);
462 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
464 i
= __builtin_elementwise_canonicalize();
465 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
467 i
= __builtin_elementwise_canonicalize(i
);
468 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
470 i
= __builtin_elementwise_canonicalize(f
, f
);
471 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
473 u
= __builtin_elementwise_canonicalize(u
);
474 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
476 uv
= __builtin_elementwise_canonicalize(uv
);
477 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
480 void test_builtin_elementwise_copysign(int i
, short s
, double d
, float f
, float4 v
, int3 iv
, unsigned3 uv
, int *p
) {
481 i
= __builtin_elementwise_copysign(p
, d
);
482 // expected-error@-1 {{1st argument must be a floating point type (was 'int *')}}
484 i
= __builtin_elementwise_copysign(i
, i
);
485 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
487 i
= __builtin_elementwise_copysign(i
);
488 // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
490 i
= __builtin_elementwise_copysign();
491 // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
493 i
= __builtin_elementwise_copysign(i
, i
, i
);
494 // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
496 i
= __builtin_elementwise_copysign(v
, iv
);
497 // expected-error@-1 {{2nd argument must be a floating point type (was 'int3' (vector of 3 'int' values))}}
499 i
= __builtin_elementwise_copysign(uv
, iv
);
500 // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
502 s
= __builtin_elementwise_copysign(i
, s
);
503 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
505 f
= __builtin_elementwise_copysign(f
, i
);
506 // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
508 f
= __builtin_elementwise_copysign(i
, f
);
509 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
513 i
= __builtin_elementwise_copysign(one
, two
);
514 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
517 enum f x
= __builtin_elementwise_copysign(one
, three
);
518 // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
520 _BitInt(32) ext
; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
521 ext
= __builtin_elementwise_copysign(ext
, ext
);
522 // expected-error@-1 {{1st argument must be a floating point type (was '_BitInt(32)')}}
525 f
= __builtin_elementwise_copysign(cf32
, f
);
526 f
= __builtin_elementwise_copysign(f
, cf32
);
527 f
= __builtin_elementwise_copysign(cf32
, f
);
529 f
= __builtin_elementwise_copysign(f
, float_as_one
); // ok (attributes don't match)?
530 f
= __builtin_elementwise_copysign(f
, waf
); // ok (sugar doesn't match)?
533 A
= __builtin_elementwise_copysign(A
, A
);
534 // expected-error@-1 {{1st argument must be a floating point type (was 'float *')}}
538 j
= __builtin_elementwise_copysign(f
, j
);
540 _Complex
float c1
, c2
;
541 c1
= __builtin_elementwise_copysign(c1
, c2
);
542 // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
545 double tmp0
= __builtin_elementwise_copysign(f64
, f
);
546 // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
548 float tmp1
= __builtin_elementwise_copysign(f
, f64
);
549 //expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
552 float4 tmp2
= __builtin_elementwise_copysign(v4f32
, f
);
553 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float')}}
555 float tmp3
= __builtin_elementwise_copysign(f
, v4f32
);
556 // expected-error@-1 {{arguments are of different types ('float' vs 'float4' (vector of 4 'float' values))}}
560 double4 tmp4
= __builtin_elementwise_copysign(v4f64
, v4f32
);
561 // expected-error@-1 {{arguments are of different types ('double4' (vector of 4 'double' values) vs 'float4' (vector of 4 'float' values))}}
563 float4 tmp6
= __builtin_elementwise_copysign(v4f32
, v4f64
);
564 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}}
566 float4 tmp7
= __builtin_elementwise_copysign(v4f32
, v2f32
);
567 // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float2' (vector of 2 'float' values))}}
569 float2 tmp8
= __builtin_elementwise_copysign(v2f32
, v4f32
);
570 // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'float4' (vector of 4 'float' values))}}
572 float2 tmp9
= __builtin_elementwise_copysign(v4f32
, v4f32
);
573 // expected-error@-1 {{initializing 'float2' (vector of 2 'float' values) with an expression of incompatible type 'float4' (vector of 4 'float' values)}}