xref: /llvm-project/clang/test/Sema/builtins-elementwise-math.c (revision 26eb70820fb860ccf97c57ee26502ff621cf4ed2)
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 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)));
10 
11 struct Foo {
12   char *p;
13 };
14 
15 __attribute__((address_space(1))) int int_as_one;
16 typedef int bar;
17 bar b;
18 
19 __attribute__((address_space(1))) float float_as_one;
20 typedef float waffle;
21 waffle waf;
22 
23 
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'}}
27 
28   i = __builtin_elementwise_abs();
29   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
30 
31   i = __builtin_elementwise_abs(i, i);
32   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
33 
34   i = __builtin_elementwise_abs(v);
35   // expected-error@-1 {{assigning to 'int' from incompatible type 'float4' (vector of 4 'float' values)}}
36 
37   u = __builtin_elementwise_abs(u);
38   // expected-error@-1 {{1st argument must be a signed integer or floating point type (was 'unsigned int')}}
39 
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))}}
42 }
43 
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')}}
47 
48   struct Foo foo = __builtin_elementwise_add_sat(i, i);
49   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
50 
51   i = __builtin_elementwise_add_sat(i);
52   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
53 
54   i = __builtin_elementwise_add_sat();
55   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
56 
57   i = __builtin_elementwise_add_sat(i, i, i);
58   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
59 
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))}}
62 
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))}}
65 
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))}}
68 
69   s = __builtin_elementwise_add_sat(i, s);
70 
71   enum e { one,
72            two };
73   i = __builtin_elementwise_add_sat(one, two);
74 
75   enum f { three };
76   enum f x = __builtin_elementwise_add_sat(one, three);
77 
78   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
79   ext = __builtin_elementwise_add_sat(ext, ext);
80 
81   const int ci;
82   i = __builtin_elementwise_add_sat(ci, i);
83   i = __builtin_elementwise_add_sat(i, ci);
84   i = __builtin_elementwise_add_sat(ci, ci);
85 
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)?
88 
89   int A[10];
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 *')}}
92 
93   int(ii);
94   int j;
95   j = __builtin_elementwise_add_sat(i, j);
96 
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')}}
100 }
101 
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')}}
105 
106   struct Foo foo = __builtin_elementwise_sub_sat(i, i);
107   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
108 
109   i = __builtin_elementwise_sub_sat(i);
110   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
111 
112   i = __builtin_elementwise_sub_sat();
113   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
114 
115   i = __builtin_elementwise_sub_sat(i, i, i);
116   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
117 
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))}}
120 
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))}}
123 
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))}}
126 
127   s = __builtin_elementwise_sub_sat(i, s);
128 
129   enum e { one,
130            two };
131   i = __builtin_elementwise_sub_sat(one, two);
132 
133   enum f { three };
134   enum f x = __builtin_elementwise_sub_sat(one, three);
135 
136   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
137   ext = __builtin_elementwise_sub_sat(ext, ext);
138 
139   const int ci;
140   i = __builtin_elementwise_sub_sat(ci, i);
141   i = __builtin_elementwise_sub_sat(i, ci);
142   i = __builtin_elementwise_sub_sat(ci, ci);
143 
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)?
146 
147   int A[10];
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 *')}}
150 
151   int(ii);
152   int j;
153   j = __builtin_elementwise_sub_sat(i, j);
154 
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')}}
158 }
159 
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')}}
163 
164   struct Foo foo = __builtin_elementwise_max(i, i);
165   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
166 
167   i = __builtin_elementwise_max(i);
168   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
169 
170   i = __builtin_elementwise_max();
171   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
172 
173   i = __builtin_elementwise_max(i, i, i);
174   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
175 
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))}}
178 
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))}}
181 
182   s = __builtin_elementwise_max(i, s);
183 
184   enum e { one,
185            two };
186   i = __builtin_elementwise_max(one, two);
187 
188   enum f { three };
189   enum f x = __builtin_elementwise_max(one, three);
190 
191   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
192   ext = __builtin_elementwise_max(ext, ext);
193 
194   const int ci;
195   i = __builtin_elementwise_max(ci, i);
196   i = __builtin_elementwise_max(i, ci);
197   i = __builtin_elementwise_max(ci, ci);
198 
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)?
201 
202   int A[10];
203   A = __builtin_elementwise_max(A, A);
204   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
205 
206   int(ii);
207   int j;
208   j = __builtin_elementwise_max(i, j);
209 
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')}}
213 }
214 
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')}}
218 
219   struct Foo foo = __builtin_elementwise_min(i, i);
220   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
221 
222   i = __builtin_elementwise_min(i);
223   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
224 
225   i = __builtin_elementwise_min();
226   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
227 
228   i = __builtin_elementwise_min(i, i, i);
229   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
230 
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))}}
233 
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))}}
236 
237   s = __builtin_elementwise_min(i, s);
238 
239   enum e { one,
240            two };
241   i = __builtin_elementwise_min(one, two);
242 
243   enum f { three };
244   enum f x = __builtin_elementwise_min(one, three);
245 
246   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
247   ext = __builtin_elementwise_min(ext, ext);
248 
249   const int ci;
250   i = __builtin_elementwise_min(ci, i);
251   i = __builtin_elementwise_min(i, ci);
252   i = __builtin_elementwise_min(ci, ci);
253 
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)?
256 
257   int A[10];
258   A = __builtin_elementwise_min(A, A);
259   // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
260 
261   int(ii);
262   int j;
263   j = __builtin_elementwise_min(i, j);
264 
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')}}
268 }
269 
270 void test_builtin_elementwise_ceil(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
271 
272   struct Foo s = __builtin_elementwise_ceil(f);
273   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
274 
275   i = __builtin_elementwise_ceil();
276   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
277 
278   i = __builtin_elementwise_ceil(i);
279   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
280 
281   i = __builtin_elementwise_ceil(f, f);
282   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
283 
284   u = __builtin_elementwise_ceil(u);
285   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
286 
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))}}
289 }
290 
291 void test_builtin_elementwise_cos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
292 
293   struct Foo s = __builtin_elementwise_cos(f);
294   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
295 
296   i = __builtin_elementwise_cos();
297   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
298 
299   i = __builtin_elementwise_cos(i);
300   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
301 
302   i = __builtin_elementwise_cos(f, f);
303   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
304 
305   u = __builtin_elementwise_cos(u);
306   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
307 
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))}}
310 }
311 
312 void test_builtin_elementwise_floor(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
313 
314   struct Foo s = __builtin_elementwise_floor(f);
315   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
316 
317   i = __builtin_elementwise_floor();
318   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
319 
320   i = __builtin_elementwise_floor(i);
321   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
322 
323   i = __builtin_elementwise_floor(f, f);
324   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
325 
326   u = __builtin_elementwise_floor(u);
327   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
328 
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))}}
331 }
332 
333 void test_builtin_elementwise_log(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
334 
335   struct Foo s = __builtin_elementwise_log(f);
336   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
337 
338   i = __builtin_elementwise_log();
339   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
340 
341   i = __builtin_elementwise_log(i);
342   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
343 
344   i = __builtin_elementwise_log(f, f);
345   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
346 
347   u = __builtin_elementwise_log(u);
348   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
349 
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))}}
352 }
353 
354 void test_builtin_elementwise_roundeven(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
355 
356   struct Foo s = __builtin_elementwise_roundeven(f);
357   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
358 
359   i = __builtin_elementwise_roundeven();
360   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
361 
362   i = __builtin_elementwise_roundeven(i);
363   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
364 
365   i = __builtin_elementwise_roundeven(f, f);
366   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
367 
368   u = __builtin_elementwise_roundeven(u);
369   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
370 
371   uv = __builtin_elementwise_roundeven(uv);
372   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
373 }
374 
375 void test_builtin_elementwise_sin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
376 
377   struct Foo s = __builtin_elementwise_sin(f);
378   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
379 
380   i = __builtin_elementwise_sin();
381   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
382 
383   i = __builtin_elementwise_sin(i);
384   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
385 
386   i = __builtin_elementwise_sin(f, f);
387   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
388 
389   u = __builtin_elementwise_sin(u);
390   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
391 
392   uv = __builtin_elementwise_sin(uv);
393   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
394 }
395 
396 void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
397 
398   struct Foo s = __builtin_elementwise_trunc(f);
399   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
400 
401   i = __builtin_elementwise_trunc();
402   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
403 
404   i = __builtin_elementwise_trunc(i);
405   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
406 
407   i = __builtin_elementwise_trunc(f, f);
408   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
409 
410   u = __builtin_elementwise_trunc(u);
411   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
412 
413   uv = __builtin_elementwise_trunc(uv);
414   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
415 }
416 
417 void test_builtin_elementwise_canonicalize(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
418 
419   struct Foo s = __builtin_elementwise_canonicalize(f);
420   // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
421 
422   i = __builtin_elementwise_canonicalize();
423   // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
424 
425   i = __builtin_elementwise_canonicalize(i);
426   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
427 
428   i = __builtin_elementwise_canonicalize(f, f);
429   // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
430 
431   u = __builtin_elementwise_canonicalize(u);
432   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
433 
434   uv = __builtin_elementwise_canonicalize(uv);
435   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
436 }
437 
438 void test_builtin_elementwise_copysign(int i, short s, double d, float f, float4 v, int3 iv, unsigned3 uv, int *p) {
439   i = __builtin_elementwise_copysign(p, d);
440   // expected-error@-1 {{1st argument must be a floating point type (was 'int *')}}
441 
442   i = __builtin_elementwise_copysign(i, i);
443   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
444 
445   i = __builtin_elementwise_copysign(i);
446   // expected-error@-1 {{too few arguments to function call, expected 2, have 1}}
447 
448   i = __builtin_elementwise_copysign();
449   // expected-error@-1 {{too few arguments to function call, expected 2, have 0}}
450 
451   i = __builtin_elementwise_copysign(i, i, i);
452   // expected-error@-1 {{too many arguments to function call, expected 2, have 3}}
453 
454   i = __builtin_elementwise_copysign(v, iv);
455   // expected-error@-1 {{2nd argument must be a floating point type (was 'int3' (vector of 3 'int' values))}}
456 
457   i = __builtin_elementwise_copysign(uv, iv);
458   // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
459 
460   s = __builtin_elementwise_copysign(i, s);
461   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
462 
463   f = __builtin_elementwise_copysign(f, i);
464   // expected-error@-1 {{2nd argument must be a floating point type (was 'int')}}
465 
466   f = __builtin_elementwise_copysign(i, f);
467   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
468 
469   enum e { one,
470            two };
471   i = __builtin_elementwise_copysign(one, two);
472   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
473 
474   enum f { three };
475   enum f x = __builtin_elementwise_copysign(one, three);
476   // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
477 
478   _BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
479   ext = __builtin_elementwise_copysign(ext, ext);
480   // expected-error@-1 {{1st argument must be a floating point type (was '_BitInt(32)')}}
481 
482   const float cf32;
483   f = __builtin_elementwise_copysign(cf32, f);
484   f = __builtin_elementwise_copysign(f, cf32);
485   f = __builtin_elementwise_copysign(cf32, f);
486 
487   f = __builtin_elementwise_copysign(f, float_as_one); // ok (attributes don't match)?
488   f = __builtin_elementwise_copysign(f, waf);          // ok (sugar doesn't match)?
489 
490   float A[10];
491   A = __builtin_elementwise_copysign(A, A);
492   // expected-error@-1 {{1st argument must be a floating point type (was 'float *')}}
493 
494   float(ii);
495   float j;
496   j = __builtin_elementwise_copysign(f, j);
497 
498   _Complex float c1, c2;
499   c1 = __builtin_elementwise_copysign(c1, c2);
500   // expected-error@-1 {{1st argument must be a floating point type (was '_Complex float')}}
501 
502   double f64 = 0.0;
503   double tmp0 = __builtin_elementwise_copysign(f64, f);
504   // expected-error@-1 {{arguments are of different types ('double' vs 'float')}}
505 
506   float tmp1 = __builtin_elementwise_copysign(f, f64);
507   //expected-error@-1 {{arguments are of different types ('float' vs 'double')}}
508 
509   float4 v4f32 = 0.0f;
510   float4 tmp2 = __builtin_elementwise_copysign(v4f32, f);
511   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float')}}
512 
513   float tmp3 = __builtin_elementwise_copysign(f, v4f32);
514   // expected-error@-1 {{arguments are of different types ('float' vs 'float4' (vector of 4 'float' values))}}
515 
516   float2 v2f32 = 0.0f;
517   double4 v4f64 = 0.0;
518   double4 tmp4 = __builtin_elementwise_copysign(v4f64, v4f32);
519   // expected-error@-1 {{arguments are of different types ('double4' (vector of 4 'double' values) vs 'float4' (vector of 4 'float' values))}}
520 
521   float4 tmp6 = __builtin_elementwise_copysign(v4f32, v4f64);
522   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}}
523 
524   float4 tmp7 = __builtin_elementwise_copysign(v4f32, v2f32);
525   // expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float2' (vector of 2 'float' values))}}
526 
527   float2 tmp8 = __builtin_elementwise_copysign(v2f32, v4f32);
528   // expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'float4' (vector of 4 'float' values))}}
529 
530   float2 tmp9 = __builtin_elementwise_copysign(v4f32, v4f32);
531   // expected-error@-1 {{initializing 'float2' (vector of 2 'float' values) with an expression of incompatible type 'float4' (vector of 4 'float' values)}}
532 }
533