1 // RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9
3 typedef float float4
__attribute__((ext_vector_type(4)));
4 typedef int int3
__attribute__((ext_vector_type(3)));
5 typedef unsigned unsigned4
__attribute__((ext_vector_type(4)));
11 void test_builtin_reduce_max(int i
, float4 v
, int3 iv
) {
12 struct Foo s
= __builtin_reduce_max(iv
);
13 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
15 i
= __builtin_reduce_max(v
, v
);
16 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
18 i
= __builtin_reduce_max();
19 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
21 i
= __builtin_reduce_max(i
);
22 // expected-error@-1 {{1st argument must be a vector type (was 'int')}}
25 void test_builtin_reduce_min(int i
, float4 v
, int3 iv
) {
26 struct Foo s
= __builtin_reduce_min(iv
);
27 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
29 i
= __builtin_reduce_min(v
, v
);
30 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
32 i
= __builtin_reduce_min();
33 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
35 i
= __builtin_reduce_min(i
);
36 // expected-error@-1 {{1st argument must be a vector type (was 'int')}}
39 void test_builtin_reduce_add(int i
, float4 v
, int3 iv
) {
40 struct Foo s
= __builtin_reduce_add(iv
);
41 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
43 i
= __builtin_reduce_add();
44 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
46 i
= __builtin_reduce_add(iv
, iv
);
47 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
49 i
= __builtin_reduce_add(i
);
50 // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}
52 i
= __builtin_reduce_add(v
);
53 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
56 void test_builtin_reduce_mul(int i
, float4 v
, int3 iv
) {
57 struct Foo s
= __builtin_reduce_mul(iv
);
58 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
60 i
= __builtin_reduce_mul();
61 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
63 i
= __builtin_reduce_mul(iv
, iv
);
64 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
66 i
= __builtin_reduce_mul(i
);
67 // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}
69 i
= __builtin_reduce_mul(v
);
70 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
73 void test_builtin_reduce_xor(int i
, float4 v
, int3 iv
) {
74 struct Foo s
= __builtin_reduce_xor(iv
);
75 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
77 i
= __builtin_reduce_xor();
78 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
80 i
= __builtin_reduce_xor(iv
, iv
);
81 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
83 i
= __builtin_reduce_xor(i
);
84 // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}
86 i
= __builtin_reduce_xor(v
);
87 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
90 void test_builtin_reduce_or(int i
, float4 v
, int3 iv
) {
91 struct Foo s
= __builtin_reduce_or(iv
);
92 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
94 i
= __builtin_reduce_or();
95 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
97 i
= __builtin_reduce_or(iv
, iv
);
98 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
100 i
= __builtin_reduce_or(i
);
101 // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}
103 i
= __builtin_reduce_or(v
);
104 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
107 void test_builtin_reduce_and(int i
, float4 v
, int3 iv
) {
108 struct Foo s
= __builtin_reduce_and(iv
);
109 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
111 i
= __builtin_reduce_and();
112 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
114 i
= __builtin_reduce_and(iv
, iv
);
115 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
117 i
= __builtin_reduce_and(i
);
118 // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}
120 i
= __builtin_reduce_and(v
);
121 // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
124 void test_builtin_reduce_maximum(int i
, float4 v
, int3 iv
) {
125 struct Foo s
= __builtin_reduce_maximum(v
);
126 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
128 i
= __builtin_reduce_maximum(v
, v
);
129 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
131 i
= __builtin_reduce_maximum();
132 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
134 i
= __builtin_reduce_maximum(i
);
135 // expected-error@-1 {{1st argument must be a vector of floating points (was 'int')}}
138 void test_builtin_reduce_minimum(int i
, float4 v
, int3 iv
) {
139 struct Foo s
= __builtin_reduce_minimum(v
);
140 // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
142 i
= __builtin_reduce_minimum(v
, v
);
143 // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
145 i
= __builtin_reduce_minimum();
146 // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
148 i
= __builtin_reduce_minimum(i
);
149 // expected-error@-1 {{1st argument must be a vector of floating points (was 'int')}}