| 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 float3 __attribute__((ext_vector_type(3))); |
| 7 |
typedef float float4 __attribute__((ext_vector_type(4))); |
| 8 |
typedef const float cfloat4 __attribute__((ext_vector_type(4))); |
| 9 |
|
| 10 |
typedef int int2 __attribute__((ext_vector_type(2))); |
| 11 |
typedef int int3 __attribute__((ext_vector_type(3))); |
| 12 |
typedef unsigned unsigned3 __attribute__((ext_vector_type(3))); |
| 13 |
typedef unsigned unsigned4 __attribute__((ext_vector_type(4))); |
| 14 |
|
| 15 |
struct Foo { |
| 16 |
char *p; |
| 17 |
}; |
| 18 |
|
| 19 |
__attribute__((address_space(1))) int int_as_one; |
| 20 |
typedef int bar; |
| 21 |
bar b; |
| 22 |
|
| 23 |
__attribute__((address_space(1))) float float_as_one; |
| 24 |
typedef float waffle; |
| 25 |
waffle waf; |
| 26 |
|
| 27 |
|
| 28 |
void test_builtin_elementwise_abs(int i, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 29 |
struct Foo s = __builtin_elementwise_abs(i); |
| 30 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 31 |
|
| 32 |
i = __builtin_elementwise_abs(); |
| 33 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 34 |
|
| 35 |
i = __builtin_elementwise_abs(i, i); |
| 36 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 37 |
|
| 38 |
i = __builtin_elementwise_abs(v); |
| 39 |
// expected-error@-1 {{assigning to 'int' from incompatible type 'float4' (vector of 4 'float' values)}} |
| 40 |
|
| 41 |
u = __builtin_elementwise_abs(u); |
| 42 |
// expected-error@-1 {{1st argument must be a scalar or vector of signed integer or floating-point types (was 'unsigned int')}} |
| 43 |
|
| 44 |
uv = __builtin_elementwise_abs(uv); |
| 45 |
// expected-error@-1 {{1st argument must be a scalar or vector of signed integer or floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 46 |
} |
| 47 |
|
| 48 |
void test_builtin_elementwise_add_sat(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) { |
| 49 |
i = __builtin_elementwise_add_sat(p, d); |
| 50 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'int *')}} |
| 51 |
|
| 52 |
struct Foo foo = __builtin_elementwise_add_sat(i, i); |
| 53 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 54 |
|
| 55 |
i = __builtin_elementwise_add_sat(i); |
| 56 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 57 |
|
| 58 |
i = __builtin_elementwise_add_sat(); |
| 59 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 60 |
|
| 61 |
i = __builtin_elementwise_add_sat(i, i, i); |
| 62 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 63 |
|
| 64 |
i = __builtin_elementwise_add_sat(v, iv); |
| 65 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 66 |
|
| 67 |
i = __builtin_elementwise_add_sat(iv, v); |
| 68 |
// expected-error@-1 {{arguments are of different types ('int3' (vector of 3 'int' values) vs 'float4' (vector of 4 'float' values))}} |
| 69 |
|
| 70 |
i = __builtin_elementwise_add_sat(uv, iv); |
| 71 |
// expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}} |
| 72 |
|
| 73 |
v = __builtin_elementwise_add_sat(v, v); |
| 74 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 75 |
|
| 76 |
s = __builtin_elementwise_add_sat(i, s); |
| 77 |
// expected-error@-1 {{arguments are of different types ('int' vs 'short')}} |
| 78 |
|
| 79 |
enum e { one, |
| 80 |
two }; |
| 81 |
i = __builtin_elementwise_add_sat(one, two); |
| 82 |
|
| 83 |
i = __builtin_elementwise_add_sat(one, d); |
| 84 |
// expected-error@-1 {{arguments are of different types ('int' vs 'double')}} |
| 85 |
|
| 86 |
enum f { three }; |
| 87 |
enum f x = __builtin_elementwise_add_sat(one, three); |
| 88 |
// expected-error@-1 {{invalid arithmetic between different enumeration types ('enum e' and 'enum f')}} |
| 89 |
|
| 90 |
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}} |
| 91 |
ext = __builtin_elementwise_add_sat(ext, ext); |
| 92 |
|
| 93 |
const int ci = 0; |
| 94 |
i = __builtin_elementwise_add_sat(ci, i); |
| 95 |
i = __builtin_elementwise_add_sat(i, ci); |
| 96 |
i = __builtin_elementwise_add_sat(ci, ci); |
| 97 |
|
| 98 |
i = __builtin_elementwise_add_sat(i, int_as_one); // ok (attributes don't match)? |
| 99 |
i = __builtin_elementwise_add_sat(i, b); // ok (sugar doesn't match)? |
| 100 |
|
| 101 |
int A[10]; |
| 102 |
A = __builtin_elementwise_add_sat(A, A); |
| 103 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'int *')}} |
| 104 |
|
| 105 |
int(ii); |
| 106 |
int j; |
| 107 |
j = __builtin_elementwise_add_sat(i, j); |
| 108 |
|
| 109 |
_Complex float c1, c2; |
| 110 |
c1 = __builtin_elementwise_add_sat(c1, c2); |
| 111 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was '_Complex float')}} |
| 112 |
} |
| 113 |
|
| 114 |
void test_builtin_elementwise_sub_sat(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) { |
| 115 |
i = __builtin_elementwise_sub_sat(p, d); |
| 116 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'int *')}} |
| 117 |
|
| 118 |
struct Foo foo = __builtin_elementwise_sub_sat(i, i); |
| 119 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 120 |
|
| 121 |
i = __builtin_elementwise_sub_sat(i); |
| 122 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 123 |
|
| 124 |
i = __builtin_elementwise_sub_sat(); |
| 125 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 126 |
|
| 127 |
i = __builtin_elementwise_sub_sat(i, i, i); |
| 128 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 129 |
|
| 130 |
i = __builtin_elementwise_sub_sat(v, iv); |
| 131 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 132 |
|
| 133 |
i = __builtin_elementwise_sub_sat(iv, v); |
| 134 |
// expected-error@-1 {{arguments are of different types ('int3' (vector of 3 'int' values) vs 'float4' (vector of 4 'float' values))}} |
| 135 |
|
| 136 |
i = __builtin_elementwise_sub_sat(uv, iv); |
| 137 |
// expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}} |
| 138 |
|
| 139 |
v = __builtin_elementwise_sub_sat(v, v); |
| 140 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 141 |
|
| 142 |
s = __builtin_elementwise_sub_sat(i, s); |
| 143 |
// expected-error@-1 {{arguments are of different types ('int' vs 'short')}} |
| 144 |
|
| 145 |
enum e { one, |
| 146 |
two }; |
| 147 |
i = __builtin_elementwise_sub_sat(one, two); |
| 148 |
|
| 149 |
i = __builtin_elementwise_sub_sat(one, d); |
| 150 |
// expected-error@-1 {{arguments are of different types ('int' vs 'double')}} |
| 151 |
|
| 152 |
enum f { three }; |
| 153 |
enum f x = __builtin_elementwise_sub_sat(one, three); |
| 154 |
// expected-error@-1 {{invalid arithmetic between different enumeration types ('enum e' and 'enum f')}} |
| 155 |
|
| 156 |
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}} |
| 157 |
ext = __builtin_elementwise_sub_sat(ext, ext); |
| 158 |
|
| 159 |
const int ci = 0; |
| 160 |
i = __builtin_elementwise_sub_sat(ci, i); |
| 161 |
i = __builtin_elementwise_sub_sat(i, ci); |
| 162 |
i = __builtin_elementwise_sub_sat(ci, ci); |
| 163 |
|
| 164 |
i = __builtin_elementwise_sub_sat(i, int_as_one); // ok (attributes don't match)? |
| 165 |
i = __builtin_elementwise_sub_sat(i, b); // ok (sugar doesn't match)? |
| 166 |
|
| 167 |
int A[10]; |
| 168 |
A = __builtin_elementwise_sub_sat(A, A); |
| 169 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'int *')}} |
| 170 |
|
| 171 |
int(ii); |
| 172 |
int j; |
| 173 |
j = __builtin_elementwise_sub_sat(i, j); |
| 174 |
|
| 175 |
_Complex float c1, c2; |
| 176 |
c1 = __builtin_elementwise_sub_sat(c1, c2); |
| 177 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was '_Complex float')}} |
| 178 |
} |
| 179 |
|
| 180 |
void test_builtin_elementwise_max(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) { |
| 181 |
i = __builtin_elementwise_max(p, d); |
| 182 |
// expected-error@-1 {{1st argument must be a vector, integer or floating-point type (was 'int *')}} |
| 183 |
|
| 184 |
struct Foo foo = __builtin_elementwise_max(i, i); |
| 185 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 186 |
|
| 187 |
i = __builtin_elementwise_max(i); |
| 188 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 189 |
|
| 190 |
i = __builtin_elementwise_max(); |
| 191 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 192 |
|
| 193 |
i = __builtin_elementwise_max(i, i, i); |
| 194 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 195 |
|
| 196 |
i = __builtin_elementwise_max(v, iv); |
| 197 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 198 |
|
| 199 |
i = __builtin_elementwise_max(uv, iv); |
| 200 |
// expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}} |
| 201 |
|
| 202 |
s = __builtin_elementwise_max(i, s); |
| 203 |
// expected-error@-1 {{arguments are of different types ('int' vs 'short')}} |
| 204 |
|
| 205 |
enum e { one, |
| 206 |
two }; |
| 207 |
i = __builtin_elementwise_max(one, two); |
| 208 |
|
| 209 |
i = __builtin_elementwise_max(one, d); |
| 210 |
// expected-error@-1 {{arguments are of different types ('int' vs 'double')}} |
| 211 |
|
| 212 |
enum f { three }; |
| 213 |
enum f x = __builtin_elementwise_max(one, three); |
| 214 |
// expected-error@-1 {{invalid arithmetic between different enumeration types ('enum e' and 'enum f')}} |
| 215 |
|
| 216 |
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}} |
| 217 |
ext = __builtin_elementwise_max(ext, ext); |
| 218 |
|
| 219 |
const int ci = 0; |
| 220 |
i = __builtin_elementwise_max(ci, i); |
| 221 |
i = __builtin_elementwise_max(i, ci); |
| 222 |
i = __builtin_elementwise_max(ci, ci); |
| 223 |
|
| 224 |
i = __builtin_elementwise_max(i, int_as_one); // ok (attributes don't match)? |
| 225 |
i = __builtin_elementwise_max(i, b); // ok (sugar doesn't match)? |
| 226 |
|
| 227 |
int A[10]; |
| 228 |
A = __builtin_elementwise_max(A, A); |
| 229 |
// expected-error@-1 {{1st argument must be a vector, integer or floating-point type (was 'int *')}} |
| 230 |
|
| 231 |
int(ii); |
| 232 |
int j; |
| 233 |
j = __builtin_elementwise_max(i, j); |
| 234 |
|
| 235 |
_Complex float c1, c2; |
| 236 |
c1 = __builtin_elementwise_max(c1, c2); |
| 237 |
// expected-error@-1 {{1st argument must be a vector, integer or floating-point type (was '_Complex float')}} |
| 238 |
} |
| 239 |
|
| 240 |
void test_builtin_elementwise_min(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) { |
| 241 |
i = __builtin_elementwise_min(p, d); |
| 242 |
// expected-error@-1 {{1st argument must be a vector, integer or floating-point type (was 'int *')}} |
| 243 |
|
| 244 |
struct Foo foo = __builtin_elementwise_min(i, i); |
| 245 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 246 |
|
| 247 |
i = __builtin_elementwise_min(i); |
| 248 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 249 |
|
| 250 |
i = __builtin_elementwise_min(); |
| 251 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 252 |
|
| 253 |
i = __builtin_elementwise_min(i, i, i); |
| 254 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 255 |
|
| 256 |
i = __builtin_elementwise_min(v, iv); |
| 257 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 258 |
|
| 259 |
i = __builtin_elementwise_min(uv, iv); |
| 260 |
// expected-error@-1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}} |
| 261 |
|
| 262 |
s = __builtin_elementwise_min(i, s); |
| 263 |
// expected-error@-1 {{arguments are of different types ('int' vs 'short')}} |
| 264 |
|
| 265 |
enum e { one, |
| 266 |
two }; |
| 267 |
i = __builtin_elementwise_min(one, two); |
| 268 |
|
| 269 |
i = __builtin_elementwise_min(one, d); |
| 270 |
// expected-error@-1 {{arguments are of different types ('int' vs 'double')}} |
| 271 |
|
| 272 |
enum f { three }; |
| 273 |
enum f x = __builtin_elementwise_min(one, three); |
| 274 |
// expected-error@-1 {{invalid arithmetic between different enumeration types ('enum e' and 'enum f')}} |
| 275 |
|
| 276 |
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}} |
| 277 |
ext = __builtin_elementwise_min(ext, ext); |
| 278 |
|
| 279 |
const int ci = 0; |
| 280 |
i = __builtin_elementwise_min(ci, i); |
| 281 |
i = __builtin_elementwise_min(i, ci); |
| 282 |
i = __builtin_elementwise_min(ci, ci); |
| 283 |
|
| 284 |
i = __builtin_elementwise_min(i, int_as_one); // ok (attributes don't match)? |
| 285 |
i = __builtin_elementwise_min(i, b); // ok (sugar doesn't match)? |
| 286 |
|
| 287 |
int A[10]; |
| 288 |
A = __builtin_elementwise_min(A, A); |
| 289 |
// expected-error@-1 {{1st argument must be a vector, integer or floating-point type (was 'int *')}} |
| 290 |
|
| 291 |
int(ii); |
| 292 |
int j; |
| 293 |
j = __builtin_elementwise_min(i, j); |
| 294 |
|
| 295 |
_Complex float c1, c2; |
| 296 |
c1 = __builtin_elementwise_min(c1, c2); |
| 297 |
// expected-error@-1 {{1st argument must be a vector, integer or floating-point type (was '_Complex float')}} |
| 298 |
} |
| 299 |
|
| 300 |
void test_builtin_elementwise_maximum(int i, short s, float f, double d, float4 fv, double4 dv, int3 iv, unsigned3 uv, int *p) { |
| 301 |
i = __builtin_elementwise_maximum(p, d); |
| 302 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 303 |
|
| 304 |
struct Foo foo = __builtin_elementwise_maximum(d, d); |
| 305 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}} |
| 306 |
|
| 307 |
i = __builtin_elementwise_maximum(i); |
| 308 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 309 |
|
| 310 |
i = __builtin_elementwise_maximum(); |
| 311 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 312 |
|
| 313 |
i = __builtin_elementwise_maximum(i, i, i); |
| 314 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 315 |
|
| 316 |
i = __builtin_elementwise_maximum(fv, iv); |
| 317 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 318 |
|
| 319 |
i = __builtin_elementwise_maximum(uv, iv); |
| 320 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned3' (vector of 3 'unsigned int' values))}} |
| 321 |
|
| 322 |
dv = __builtin_elementwise_maximum(fv, dv); |
| 323 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}} |
| 324 |
|
| 325 |
d = __builtin_elementwise_maximum(f, d); |
| 326 |
// expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 327 |
|
| 328 |
fv = __builtin_elementwise_maximum(fv, fv); |
| 329 |
|
| 330 |
i = __builtin_elementwise_maximum(iv, iv); |
| 331 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int3' (vector of 3 'int' values))}} |
| 332 |
|
| 333 |
i = __builtin_elementwise_maximum(i, i); |
| 334 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 335 |
|
| 336 |
int A[10]; |
| 337 |
A = __builtin_elementwise_maximum(A, A); |
| 338 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 339 |
|
| 340 |
_Complex float c1, c2; |
| 341 |
c1 = __builtin_elementwise_maximum(c1, c2); |
| 342 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 343 |
} |
| 344 |
|
| 345 |
void test_builtin_elementwise_minimum(int i, short s, float f, double d, float4 fv, double4 dv, int3 iv, unsigned3 uv, int *p) { |
| 346 |
i = __builtin_elementwise_minimum(p, d); |
| 347 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 348 |
|
| 349 |
struct Foo foo = __builtin_elementwise_minimum(d, d); |
| 350 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}} |
| 351 |
|
| 352 |
i = __builtin_elementwise_minimum(i); |
| 353 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 354 |
|
| 355 |
i = __builtin_elementwise_minimum(); |
| 356 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 357 |
|
| 358 |
i = __builtin_elementwise_minimum(i, i, i); |
| 359 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 360 |
|
| 361 |
i = __builtin_elementwise_minimum(fv, iv); |
| 362 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 363 |
|
| 364 |
i = __builtin_elementwise_minimum(uv, iv); |
| 365 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned3' (vector of 3 'unsigned int' values))}} |
| 366 |
|
| 367 |
dv = __builtin_elementwise_minimum(fv, dv); |
| 368 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}} |
| 369 |
|
| 370 |
d = __builtin_elementwise_minimum(f, d); |
| 371 |
// expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 372 |
|
| 373 |
fv = __builtin_elementwise_minimum(fv, fv); |
| 374 |
|
| 375 |
i = __builtin_elementwise_minimum(iv, iv); |
| 376 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int3' (vector of 3 'int' values))}} |
| 377 |
|
| 378 |
i = __builtin_elementwise_minimum(i, i); |
| 379 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 380 |
|
| 381 |
int A[10]; |
| 382 |
A = __builtin_elementwise_minimum(A, A); |
| 383 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 384 |
|
| 385 |
_Complex float c1, c2; |
| 386 |
c1 = __builtin_elementwise_minimum(c1, c2); |
| 387 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 388 |
} |
| 389 |
|
| 390 |
void test_builtin_elementwise_maximumnum(int i, short s, float f, double d, float4 fv, double4 dv, int3 iv, unsigned3 uv, int *p) { |
| 391 |
i = __builtin_elementwise_maximumnum(p, d); |
| 392 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 393 |
|
| 394 |
struct Foo foo = __builtin_elementwise_maximumnum(d, d); |
| 395 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}} |
| 396 |
|
| 397 |
i = __builtin_elementwise_maximumnum(i); |
| 398 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 399 |
|
| 400 |
i = __builtin_elementwise_maximumnum(); |
| 401 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 402 |
|
| 403 |
i = __builtin_elementwise_maximumnum(i, i, i); |
| 404 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 405 |
|
| 406 |
i = __builtin_elementwise_maximumnum(fv, iv); |
| 407 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 408 |
|
| 409 |
i = __builtin_elementwise_maximumnum(uv, iv); |
| 410 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned3' (vector of 3 'unsigned int' values))}} |
| 411 |
|
| 412 |
dv = __builtin_elementwise_maximumnum(fv, dv); |
| 413 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}} |
| 414 |
|
| 415 |
d = __builtin_elementwise_maximumnum(f, d); |
| 416 |
// expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 417 |
|
| 418 |
fv = __builtin_elementwise_maximumnum(fv, fv); |
| 419 |
|
| 420 |
i = __builtin_elementwise_maximumnum(iv, iv); |
| 421 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int3' (vector of 3 'int' values))}} |
| 422 |
|
| 423 |
i = __builtin_elementwise_maximumnum(i, i); |
| 424 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 425 |
|
| 426 |
int A[10]; |
| 427 |
A = __builtin_elementwise_maximumnum(A, A); |
| 428 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 429 |
|
| 430 |
_Complex float c1, c2; |
| 431 |
c1 = __builtin_elementwise_maximumnum(c1, c2); |
| 432 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 433 |
} |
| 434 |
|
| 435 |
void test_builtin_elementwise_minimumnum(int i, short s, float f, double d, float4 fv, double4 dv, int3 iv, unsigned3 uv, int *p) { |
| 436 |
i = __builtin_elementwise_minimumnum(p, d); |
| 437 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 438 |
|
| 439 |
struct Foo foo = __builtin_elementwise_minimumnum(d, d); |
| 440 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}} |
| 441 |
|
| 442 |
i = __builtin_elementwise_minimumnum(i); |
| 443 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 444 |
|
| 445 |
i = __builtin_elementwise_minimumnum(); |
| 446 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 447 |
|
| 448 |
i = __builtin_elementwise_minimumnum(i, i, i); |
| 449 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 450 |
|
| 451 |
i = __builtin_elementwise_minimumnum(fv, iv); |
| 452 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 453 |
|
| 454 |
i = __builtin_elementwise_minimumnum(uv, iv); |
| 455 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned3' (vector of 3 'unsigned int' values))}} |
| 456 |
|
| 457 |
dv = __builtin_elementwise_minimumnum(fv, dv); |
| 458 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}} |
| 459 |
|
| 460 |
d = __builtin_elementwise_minimumnum(f, d); |
| 461 |
// expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 462 |
|
| 463 |
fv = __builtin_elementwise_minimumnum(fv, fv); |
| 464 |
|
| 465 |
i = __builtin_elementwise_minimumnum(iv, iv); |
| 466 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int3' (vector of 3 'int' values))}} |
| 467 |
|
| 468 |
i = __builtin_elementwise_minimumnum(i, i); |
| 469 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 470 |
|
| 471 |
int A[10]; |
| 472 |
A = __builtin_elementwise_minimumnum(A, A); |
| 473 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 474 |
|
| 475 |
_Complex float c1, c2; |
| 476 |
c1 = __builtin_elementwise_minimumnum(c1, c2); |
| 477 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 478 |
} |
| 479 |
|
| 480 |
void test_builtin_elementwise_bitreverse(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 481 |
|
| 482 |
struct Foo s = __builtin_elementwise_bitreverse(i); |
| 483 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 484 |
|
| 485 |
i = __builtin_elementwise_bitreverse(); |
| 486 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 487 |
|
| 488 |
i = __builtin_elementwise_bitreverse(f); |
| 489 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float')}} |
| 490 |
|
| 491 |
i = __builtin_elementwise_bitreverse(f, f); |
| 492 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 493 |
|
| 494 |
u = __builtin_elementwise_bitreverse(d); |
| 495 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'double')}} |
| 496 |
|
| 497 |
v = __builtin_elementwise_bitreverse(v); |
| 498 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 499 |
} |
| 500 |
|
| 501 |
void test_builtin_elementwise_ceil(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 502 |
|
| 503 |
struct Foo s = __builtin_elementwise_ceil(f); |
| 504 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 505 |
|
| 506 |
i = __builtin_elementwise_ceil(); |
| 507 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 508 |
|
| 509 |
i = __builtin_elementwise_ceil(i); |
| 510 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 511 |
|
| 512 |
i = __builtin_elementwise_ceil(f, f); |
| 513 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 514 |
|
| 515 |
u = __builtin_elementwise_ceil(u); |
| 516 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 517 |
|
| 518 |
uv = __builtin_elementwise_ceil(uv); |
| 519 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 520 |
} |
| 521 |
|
| 522 |
void test_builtin_elementwise_acos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 523 |
|
| 524 |
struct Foo s = __builtin_elementwise_acos(f); |
| 525 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 526 |
|
| 527 |
i = __builtin_elementwise_acos(); |
| 528 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 529 |
|
| 530 |
i = __builtin_elementwise_acos(i); |
| 531 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 532 |
|
| 533 |
i = __builtin_elementwise_acos(f, f); |
| 534 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 535 |
|
| 536 |
u = __builtin_elementwise_acos(u); |
| 537 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 538 |
|
| 539 |
uv = __builtin_elementwise_acos(uv); |
| 540 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 541 |
} |
| 542 |
|
| 543 |
void test_builtin_elementwise_cos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 544 |
|
| 545 |
struct Foo s = __builtin_elementwise_cos(f); |
| 546 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 547 |
|
| 548 |
i = __builtin_elementwise_cos(); |
| 549 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 550 |
|
| 551 |
i = __builtin_elementwise_cos(i); |
| 552 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 553 |
|
| 554 |
i = __builtin_elementwise_cos(f, f); |
| 555 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 556 |
|
| 557 |
u = __builtin_elementwise_cos(u); |
| 558 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 559 |
|
| 560 |
uv = __builtin_elementwise_cos(uv); |
| 561 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 562 |
} |
| 563 |
|
| 564 |
void test_builtin_elementwise_cosh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 565 |
|
| 566 |
struct Foo s = __builtin_elementwise_cosh(f); |
| 567 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 568 |
|
| 569 |
i = __builtin_elementwise_cosh(); |
| 570 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 571 |
|
| 572 |
i = __builtin_elementwise_cosh(i); |
| 573 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 574 |
|
| 575 |
i = __builtin_elementwise_cosh(f, f); |
| 576 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 577 |
|
| 578 |
u = __builtin_elementwise_cosh(u); |
| 579 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 580 |
|
| 581 |
uv = __builtin_elementwise_cosh(uv); |
| 582 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 583 |
} |
| 584 |
|
| 585 |
void test_builtin_elementwise_exp(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 586 |
|
| 587 |
struct Foo s = __builtin_elementwise_exp(f); |
| 588 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 589 |
|
| 590 |
i = __builtin_elementwise_exp(); |
| 591 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 592 |
|
| 593 |
i = __builtin_elementwise_exp(i); |
| 594 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 595 |
|
| 596 |
i = __builtin_elementwise_exp(f, f); |
| 597 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 598 |
|
| 599 |
u = __builtin_elementwise_exp(u); |
| 600 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 601 |
|
| 602 |
uv = __builtin_elementwise_exp(uv); |
| 603 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 604 |
} |
| 605 |
|
| 606 |
void test_builtin_elementwise_exp2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 607 |
|
| 608 |
struct Foo s = __builtin_elementwise_exp2(f); |
| 609 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 610 |
|
| 611 |
i = __builtin_elementwise_exp2(); |
| 612 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 613 |
|
| 614 |
i = __builtin_elementwise_exp2(i); |
| 615 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 616 |
|
| 617 |
i = __builtin_elementwise_exp2(f, f); |
| 618 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 619 |
|
| 620 |
u = __builtin_elementwise_exp2(u); |
| 621 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 622 |
|
| 623 |
uv = __builtin_elementwise_exp2(uv); |
| 624 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 625 |
} |
| 626 |
|
| 627 |
void test_builtin_elementwise_exp10(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 628 |
|
| 629 |
struct Foo s = __builtin_elementwise_exp10(f); |
| 630 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 631 |
|
| 632 |
i = __builtin_elementwise_exp10(); |
| 633 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 634 |
|
| 635 |
i = __builtin_elementwise_exp10(i); |
| 636 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 637 |
|
| 638 |
i = __builtin_elementwise_exp10(f, f); |
| 639 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 640 |
|
| 641 |
u = __builtin_elementwise_exp10(u); |
| 642 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 643 |
|
| 644 |
uv = __builtin_elementwise_exp10(uv); |
| 645 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 646 |
} |
| 647 |
|
| 648 |
void test_builtin_elementwise_ldexp(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 649 |
|
| 650 |
struct Foo s = __builtin_elementwise_ldexp(f, i); |
| 651 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 652 |
|
| 653 |
f = __builtin_elementwise_ldexp(); |
| 654 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 655 |
|
| 656 |
f = __builtin_elementwise_ldexp(f); |
| 657 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 658 |
|
| 659 |
f = __builtin_elementwise_ldexp(f, i, i); |
| 660 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 661 |
|
| 662 |
f = __builtin_elementwise_ldexp(i, i); |
| 663 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 664 |
|
| 665 |
f = __builtin_elementwise_ldexp(f, f); |
| 666 |
// expected-error@-1 {{2nd argument must be a scalar or vector of integer types (was 'float')}} |
| 667 |
|
| 668 |
f = __builtin_elementwise_ldexp(v, iv); |
| 669 |
// expected-error@-1 {{vector operands do not have the same number of elements ('float4' (vector of 4 'float' values) and 'int3' (vector of 3 'int' values))}} |
| 670 |
|
| 671 |
v = __builtin_elementwise_ldexp(v, i); |
| 672 |
// expected-error@-1 {{vector operands do not have the same number of elements ('float4' (vector of 4 'float' values) and 'int')}} |
| 673 |
|
| 674 |
v = __builtin_elementwise_ldexp(f, iv); |
| 675 |
// expected-error@-1 {{vector operands do not have the same number of elements ('float' and 'int3' (vector of 3 'int' values))}} |
| 676 |
|
| 677 |
f = __builtin_elementwise_ldexp(u, i); |
| 678 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 679 |
|
| 680 |
f = __builtin_elementwise_ldexp(uv, i); |
| 681 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 682 |
} |
| 683 |
|
| 684 |
void test_builtin_elementwise_floor(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 685 |
|
| 686 |
struct Foo s = __builtin_elementwise_floor(f); |
| 687 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 688 |
|
| 689 |
i = __builtin_elementwise_floor(); |
| 690 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 691 |
|
| 692 |
i = __builtin_elementwise_floor(i); |
| 693 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 694 |
|
| 695 |
i = __builtin_elementwise_floor(f, f); |
| 696 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 697 |
|
| 698 |
u = __builtin_elementwise_floor(u); |
| 699 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 700 |
|
| 701 |
uv = __builtin_elementwise_floor(uv); |
| 702 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 703 |
} |
| 704 |
|
| 705 |
void test_builtin_elementwise_log(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 706 |
|
| 707 |
struct Foo s = __builtin_elementwise_log(f); |
| 708 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 709 |
|
| 710 |
i = __builtin_elementwise_log(); |
| 711 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 712 |
|
| 713 |
i = __builtin_elementwise_log(i); |
| 714 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 715 |
|
| 716 |
i = __builtin_elementwise_log(f, f); |
| 717 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 718 |
|
| 719 |
u = __builtin_elementwise_log(u); |
| 720 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 721 |
|
| 722 |
uv = __builtin_elementwise_log(uv); |
| 723 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 724 |
} |
| 725 |
|
| 726 |
void test_builtin_elementwise_log10(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 727 |
|
| 728 |
struct Foo s = __builtin_elementwise_log10(f); |
| 729 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 730 |
|
| 731 |
i = __builtin_elementwise_log10(); |
| 732 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 733 |
|
| 734 |
i = __builtin_elementwise_log10(i); |
| 735 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 736 |
|
| 737 |
i = __builtin_elementwise_log10(f, f); |
| 738 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 739 |
|
| 740 |
u = __builtin_elementwise_log10(u); |
| 741 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 742 |
|
| 743 |
uv = __builtin_elementwise_log10(uv); |
| 744 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 745 |
} |
| 746 |
|
| 747 |
void test_builtin_elementwise_log2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 748 |
|
| 749 |
struct Foo s = __builtin_elementwise_log2(f); |
| 750 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 751 |
|
| 752 |
i = __builtin_elementwise_log2(); |
| 753 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 754 |
|
| 755 |
i = __builtin_elementwise_log2(i); |
| 756 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 757 |
|
| 758 |
i = __builtin_elementwise_log2(f, f); |
| 759 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 760 |
|
| 761 |
u = __builtin_elementwise_log2(u); |
| 762 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 763 |
|
| 764 |
uv = __builtin_elementwise_log2(uv); |
| 765 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 766 |
} |
| 767 |
|
| 768 |
void test_builtin_elementwise_popcount(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 769 |
|
| 770 |
struct Foo s = __builtin_elementwise_popcount(i); |
| 771 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 772 |
|
| 773 |
i = __builtin_elementwise_popcount(); |
| 774 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 775 |
|
| 776 |
i = __builtin_elementwise_popcount(f); |
| 777 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float')}} |
| 778 |
|
| 779 |
i = __builtin_elementwise_popcount(f, f); |
| 780 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 781 |
|
| 782 |
u = __builtin_elementwise_popcount(d); |
| 783 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'double')}} |
| 784 |
|
| 785 |
v = __builtin_elementwise_popcount(v); |
| 786 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 787 |
|
| 788 |
int2 i2 = __builtin_elementwise_popcount(iv); |
| 789 |
// expected-error@-1 {{initializing 'int2' (vector of 2 'int' values) with an expression of incompatible type 'int3' (vector of 3 'int' values)}} |
| 790 |
|
| 791 |
iv = __builtin_elementwise_popcount(i2); |
| 792 |
// expected-error@-1 {{assigning to 'int3' (vector of 3 'int' values) from incompatible type 'int2' (vector of 2 'int' values)}} |
| 793 |
|
| 794 |
unsigned3 u3 = __builtin_elementwise_popcount(iv); |
| 795 |
// expected-error@-1 {{initializing 'unsigned3' (vector of 3 'unsigned int' values) with an expression of incompatible type 'int3' (vector of 3 'int' values)}} |
| 796 |
|
| 797 |
iv = __builtin_elementwise_popcount(u3); |
| 798 |
// expected-error@-1 {{assigning to 'int3' (vector of 3 'int' values) from incompatible type 'unsigned3' (vector of 3 'unsigned int' values)}} |
| 799 |
} |
| 800 |
|
| 801 |
void test_builtin_elementwise_fmod(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) { |
| 802 |
i = __builtin_elementwise_fmod(p, d); |
| 803 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 804 |
|
| 805 |
struct Foo foo = __builtin_elementwise_fmod(i, i); |
| 806 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 807 |
|
| 808 |
i = __builtin_elementwise_fmod(i); |
| 809 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 810 |
|
| 811 |
i = __builtin_elementwise_fmod(); |
| 812 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 813 |
|
| 814 |
i = __builtin_elementwise_fmod(i, i, i); |
| 815 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 816 |
|
| 817 |
i = __builtin_elementwise_fmod(v, iv); |
| 818 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 819 |
|
| 820 |
i = __builtin_elementwise_fmod(uv, iv); |
| 821 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned3' (vector of 3 'unsigned int' values))}} |
| 822 |
|
| 823 |
i = __builtin_elementwise_fmod(d, v); |
| 824 |
// expected-error@-1 {{arguments are of different types ('double' vs 'float4' (vector of 4 'float' values))}} |
| 825 |
} |
| 826 |
|
| 827 |
void test_builtin_elementwise_pow(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) { |
| 828 |
i = __builtin_elementwise_pow(p, d); |
| 829 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 830 |
|
| 831 |
struct Foo foo = __builtin_elementwise_pow(i, i); |
| 832 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 833 |
|
| 834 |
i = __builtin_elementwise_pow(i); |
| 835 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 836 |
|
| 837 |
i = __builtin_elementwise_pow(); |
| 838 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 839 |
|
| 840 |
i = __builtin_elementwise_pow(i, i, i); |
| 841 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 842 |
|
| 843 |
i = __builtin_elementwise_pow(v, iv); |
| 844 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}} |
| 845 |
|
| 846 |
i = __builtin_elementwise_pow(uv, iv); |
| 847 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned3' (vector of 3 'unsigned int' values))}} |
| 848 |
|
| 849 |
} |
| 850 |
|
| 851 |
void test_builtin_elementwise_roundeven(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 852 |
|
| 853 |
struct Foo s = __builtin_elementwise_roundeven(f); |
| 854 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 855 |
|
| 856 |
i = __builtin_elementwise_roundeven(); |
| 857 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 858 |
|
| 859 |
i = __builtin_elementwise_roundeven(i); |
| 860 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 861 |
|
| 862 |
i = __builtin_elementwise_roundeven(f, f); |
| 863 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 864 |
|
| 865 |
u = __builtin_elementwise_roundeven(u); |
| 866 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 867 |
|
| 868 |
uv = __builtin_elementwise_roundeven(uv); |
| 869 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 870 |
} |
| 871 |
|
| 872 |
void test_builtin_elementwise_round(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 873 |
struct Foo s = __builtin_elementwise_round(f); |
| 874 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 875 |
|
| 876 |
i = __builtin_elementwise_round(); |
| 877 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 878 |
|
| 879 |
i = __builtin_elementwise_round(i); |
| 880 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 881 |
|
| 882 |
i = __builtin_elementwise_round(f, f); |
| 883 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 884 |
|
| 885 |
u = __builtin_elementwise_round(u); |
| 886 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 887 |
|
| 888 |
uv = __builtin_elementwise_round(uv); |
| 889 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 890 |
|
| 891 |
_Complex float c1, c2; |
| 892 |
c1 = __builtin_elementwise_round(c1); |
| 893 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 894 |
} |
| 895 |
|
| 896 |
void test_builtin_elementwise_rint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 897 |
struct Foo s = __builtin_elementwise_rint(f); |
| 898 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 899 |
|
| 900 |
i = __builtin_elementwise_rint(); |
| 901 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 902 |
|
| 903 |
i = __builtin_elementwise_rint(i); |
| 904 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 905 |
|
| 906 |
i = __builtin_elementwise_rint(f, f); |
| 907 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 908 |
|
| 909 |
u = __builtin_elementwise_rint(u); |
| 910 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 911 |
|
| 912 |
uv = __builtin_elementwise_rint(uv); |
| 913 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 914 |
|
| 915 |
_Complex float c1, c2; |
| 916 |
c1 = __builtin_elementwise_rint(c1); |
| 917 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 918 |
} |
| 919 |
|
| 920 |
void test_builtin_elementwise_nearbyint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 921 |
struct Foo s = __builtin_elementwise_nearbyint(f); |
| 922 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 923 |
|
| 924 |
i = __builtin_elementwise_nearbyint(); |
| 925 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 926 |
|
| 927 |
i = __builtin_elementwise_nearbyint(i); |
| 928 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 929 |
|
| 930 |
i = __builtin_elementwise_nearbyint(f, f); |
| 931 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 932 |
|
| 933 |
u = __builtin_elementwise_nearbyint(u); |
| 934 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 935 |
|
| 936 |
uv = __builtin_elementwise_nearbyint(uv); |
| 937 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 938 |
|
| 939 |
_Complex float c1, c2; |
| 940 |
c1 = __builtin_elementwise_nearbyint(c1); |
| 941 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 942 |
} |
| 943 |
|
| 944 |
void test_builtin_elementwise_asin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 945 |
|
| 946 |
struct Foo s = __builtin_elementwise_asin(f); |
| 947 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 948 |
|
| 949 |
i = __builtin_elementwise_asin(); |
| 950 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 951 |
|
| 952 |
i = __builtin_elementwise_asin(i); |
| 953 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 954 |
|
| 955 |
i = __builtin_elementwise_asin(f, f); |
| 956 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 957 |
|
| 958 |
u = __builtin_elementwise_asin(u); |
| 959 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 960 |
|
| 961 |
uv = __builtin_elementwise_asin(uv); |
| 962 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 963 |
} |
| 964 |
|
| 965 |
void test_builtin_elementwise_sin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 966 |
|
| 967 |
struct Foo s = __builtin_elementwise_sin(f); |
| 968 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 969 |
|
| 970 |
i = __builtin_elementwise_sin(); |
| 971 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 972 |
|
| 973 |
i = __builtin_elementwise_sin(i); |
| 974 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 975 |
|
| 976 |
i = __builtin_elementwise_sin(f, f); |
| 977 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 978 |
|
| 979 |
u = __builtin_elementwise_sin(u); |
| 980 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 981 |
|
| 982 |
uv = __builtin_elementwise_sin(uv); |
| 983 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 984 |
} |
| 985 |
|
| 986 |
void test_builtin_elementwise_sinh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 987 |
|
| 988 |
struct Foo s = __builtin_elementwise_sinh(f); |
| 989 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 990 |
|
| 991 |
i = __builtin_elementwise_sinh(); |
| 992 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 993 |
|
| 994 |
i = __builtin_elementwise_sinh(i); |
| 995 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 996 |
|
| 997 |
i = __builtin_elementwise_sinh(f, f); |
| 998 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 999 |
|
| 1000 |
u = __builtin_elementwise_sinh(u); |
| 1001 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1002 |
|
| 1003 |
uv = __builtin_elementwise_sinh(uv); |
| 1004 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1005 |
} |
| 1006 |
|
| 1007 |
void test_builtin_elementwise_sqrt(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 1008 |
|
| 1009 |
struct Foo s = __builtin_elementwise_sqrt(f); |
| 1010 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 1011 |
|
| 1012 |
i = __builtin_elementwise_sqrt(); |
| 1013 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1014 |
|
| 1015 |
i = __builtin_elementwise_sqrt(i); |
| 1016 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1017 |
|
| 1018 |
i = __builtin_elementwise_sqrt(f, f); |
| 1019 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 1020 |
|
| 1021 |
u = __builtin_elementwise_sqrt(u); |
| 1022 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1023 |
|
| 1024 |
uv = __builtin_elementwise_sqrt(uv); |
| 1025 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1026 |
} |
| 1027 |
|
| 1028 |
void test_builtin_elementwise_atan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 1029 |
|
| 1030 |
struct Foo s = __builtin_elementwise_atan(f); |
| 1031 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 1032 |
|
| 1033 |
i = __builtin_elementwise_atan(); |
| 1034 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1035 |
|
| 1036 |
i = __builtin_elementwise_atan(i); |
| 1037 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1038 |
|
| 1039 |
i = __builtin_elementwise_atan(f, f); |
| 1040 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 1041 |
|
| 1042 |
u = __builtin_elementwise_atan(u); |
| 1043 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1044 |
|
| 1045 |
uv = __builtin_elementwise_atan(uv); |
| 1046 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1047 |
} |
| 1048 |
|
| 1049 |
void test_builtin_elementwise_atan2(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 1050 |
|
| 1051 |
struct Foo s = __builtin_elementwise_atan2(f, f); |
| 1052 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 1053 |
|
| 1054 |
i = __builtin_elementwise_atan2(); |
| 1055 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 1056 |
|
| 1057 |
i = __builtin_elementwise_atan2(f); |
| 1058 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 1059 |
|
| 1060 |
i = __builtin_elementwise_atan2(i, i); |
| 1061 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1062 |
|
| 1063 |
i = __builtin_elementwise_atan2(f, f, f); |
| 1064 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 1065 |
|
| 1066 |
u = __builtin_elementwise_atan2(u, u); |
| 1067 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1068 |
|
| 1069 |
uv = __builtin_elementwise_atan2(uv, uv); |
| 1070 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1071 |
} |
| 1072 |
|
| 1073 |
void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 1074 |
|
| 1075 |
struct Foo s = __builtin_elementwise_tan(f); |
| 1076 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 1077 |
|
| 1078 |
i = __builtin_elementwise_tan(); |
| 1079 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1080 |
|
| 1081 |
i = __builtin_elementwise_tan(i); |
| 1082 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1083 |
|
| 1084 |
i = __builtin_elementwise_tan(f, f); |
| 1085 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 1086 |
|
| 1087 |
u = __builtin_elementwise_tan(u); |
| 1088 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1089 |
|
| 1090 |
uv = __builtin_elementwise_tan(uv); |
| 1091 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1092 |
} |
| 1093 |
|
| 1094 |
void test_builtin_elementwise_tanh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 1095 |
|
| 1096 |
struct Foo s = __builtin_elementwise_tanh(f); |
| 1097 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 1098 |
|
| 1099 |
i = __builtin_elementwise_tanh(); |
| 1100 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1101 |
|
| 1102 |
i = __builtin_elementwise_tanh(i); |
| 1103 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1104 |
|
| 1105 |
i = __builtin_elementwise_tanh(f, f); |
| 1106 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 1107 |
|
| 1108 |
u = __builtin_elementwise_tanh(u); |
| 1109 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1110 |
|
| 1111 |
uv = __builtin_elementwise_tanh(uv); |
| 1112 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1113 |
} |
| 1114 |
|
| 1115 |
void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 1116 |
|
| 1117 |
struct Foo s = __builtin_elementwise_trunc(f); |
| 1118 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 1119 |
|
| 1120 |
i = __builtin_elementwise_trunc(); |
| 1121 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1122 |
|
| 1123 |
i = __builtin_elementwise_trunc(i); |
| 1124 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1125 |
|
| 1126 |
i = __builtin_elementwise_trunc(f, f); |
| 1127 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 1128 |
|
| 1129 |
u = __builtin_elementwise_trunc(u); |
| 1130 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1131 |
|
| 1132 |
uv = __builtin_elementwise_trunc(uv); |
| 1133 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1134 |
} |
| 1135 |
|
| 1136 |
void test_builtin_elementwise_canonicalize(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) { |
| 1137 |
|
| 1138 |
struct Foo s = __builtin_elementwise_canonicalize(f); |
| 1139 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 1140 |
|
| 1141 |
i = __builtin_elementwise_canonicalize(); |
| 1142 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1143 |
|
| 1144 |
i = __builtin_elementwise_canonicalize(i); |
| 1145 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1146 |
|
| 1147 |
i = __builtin_elementwise_canonicalize(f, f); |
| 1148 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 1149 |
|
| 1150 |
u = __builtin_elementwise_canonicalize(u); |
| 1151 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned int')}} |
| 1152 |
|
| 1153 |
uv = __builtin_elementwise_canonicalize(uv); |
| 1154 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned4' (vector of 4 'unsigned int' values))}} |
| 1155 |
} |
| 1156 |
|
| 1157 |
void test_builtin_elementwise_copysign(int i, short s, double d, float f, float4 v, int3 iv, unsigned3 uv, int *p) { |
| 1158 |
i = __builtin_elementwise_copysign(p, d); |
| 1159 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int *')}} |
| 1160 |
|
| 1161 |
i = __builtin_elementwise_copysign(i, i); |
| 1162 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1163 |
|
| 1164 |
i = __builtin_elementwise_copysign(i); |
| 1165 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 1}} |
| 1166 |
|
| 1167 |
i = __builtin_elementwise_copysign(); |
| 1168 |
// expected-error@-1 {{too few arguments to function call, expected 2, have 0}} |
| 1169 |
|
| 1170 |
i = __builtin_elementwise_copysign(i, i, i); |
| 1171 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 1172 |
|
| 1173 |
i = __builtin_elementwise_copysign(v, iv); |
| 1174 |
// expected-error@-1 {{2nd argument must be a scalar or vector of floating-point types (was 'int3' (vector of 3 'int' values))}} |
| 1175 |
|
| 1176 |
i = __builtin_elementwise_copysign(uv, iv); |
| 1177 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'unsigned3' (vector of 3 'unsigned int' values))}} |
| 1178 |
|
| 1179 |
s = __builtin_elementwise_copysign(i, s); |
| 1180 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1181 |
|
| 1182 |
f = __builtin_elementwise_copysign(f, i); |
| 1183 |
// expected-error@-1 {{2nd argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1184 |
|
| 1185 |
f = __builtin_elementwise_copysign(i, f); |
| 1186 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1187 |
|
| 1188 |
enum e { one, |
| 1189 |
two }; |
| 1190 |
i = __builtin_elementwise_copysign(one, two); |
| 1191 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1192 |
|
| 1193 |
enum f { three }; |
| 1194 |
enum f x = __builtin_elementwise_copysign(one, three); |
| 1195 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1196 |
|
| 1197 |
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}} |
| 1198 |
ext = __builtin_elementwise_copysign(ext, ext); |
| 1199 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_BitInt(32)')}} |
| 1200 |
|
| 1201 |
const float cf32 = 0.0f; |
| 1202 |
f = __builtin_elementwise_copysign(cf32, f); |
| 1203 |
f = __builtin_elementwise_copysign(f, cf32); |
| 1204 |
f = __builtin_elementwise_copysign(cf32, f); |
| 1205 |
|
| 1206 |
f = __builtin_elementwise_copysign(f, float_as_one); // ok (attributes don't match)? |
| 1207 |
f = __builtin_elementwise_copysign(f, waf); // ok (sugar doesn't match)? |
| 1208 |
|
| 1209 |
float A[10]; |
| 1210 |
A = __builtin_elementwise_copysign(A, A); |
| 1211 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'float *')}} |
| 1212 |
|
| 1213 |
float(ii); |
| 1214 |
float j; |
| 1215 |
j = __builtin_elementwise_copysign(f, j); |
| 1216 |
|
| 1217 |
_Complex float c1, c2; |
| 1218 |
c1 = __builtin_elementwise_copysign(c1, c2); |
| 1219 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 1220 |
|
| 1221 |
double f64 = 0.0; |
| 1222 |
double tmp0 = __builtin_elementwise_copysign(f64, f); |
| 1223 |
// expected-error@-1 {{arguments are of different types ('double' vs 'float')}} |
| 1224 |
|
| 1225 |
float tmp1 = __builtin_elementwise_copysign(f, f64); |
| 1226 |
//expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 1227 |
|
| 1228 |
float4 v4f32 = 0.0f; |
| 1229 |
float4 tmp2 = __builtin_elementwise_copysign(v4f32, f); |
| 1230 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float')}} |
| 1231 |
|
| 1232 |
float tmp3 = __builtin_elementwise_copysign(f, v4f32); |
| 1233 |
// expected-error@-1 {{arguments are of different types ('float' vs 'float4' (vector of 4 'float' values))}} |
| 1234 |
|
| 1235 |
float2 v2f32 = 0.0f; |
| 1236 |
double4 v4f64 = 0.0; |
| 1237 |
double4 tmp4 = __builtin_elementwise_copysign(v4f64, v4f32); |
| 1238 |
// expected-error@-1 {{arguments are of different types ('double4' (vector of 4 'double' values) vs 'float4' (vector of 4 'float' values))}} |
| 1239 |
|
| 1240 |
float4 tmp6 = __builtin_elementwise_copysign(v4f32, v4f64); |
| 1241 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}} |
| 1242 |
|
| 1243 |
float4 tmp7 = __builtin_elementwise_copysign(v4f32, v2f32); |
| 1244 |
// expected-error@-1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'float2' (vector of 2 'float' values))}} |
| 1245 |
|
| 1246 |
float2 tmp8 = __builtin_elementwise_copysign(v2f32, v4f32); |
| 1247 |
// expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'float4' (vector of 4 'float' values))}} |
| 1248 |
|
| 1249 |
float2 tmp9 = __builtin_elementwise_copysign(v4f32, v4f32); |
| 1250 |
// expected-error@-1 {{initializing 'float2' (vector of 2 'float' values) with an expression of incompatible type 'float4' (vector of 4 'float' values)}} |
| 1251 |
} |
| 1252 |
|
| 1253 |
void test_builtin_elementwise_fma(int i32, int2 v2i32, short i16, |
| 1254 |
double f64, double2 v2f64, double2 v3f64, |
| 1255 |
float f32, float2 v2f32, float v3f32, float4 v4f32, |
| 1256 |
const float4 c_v4f32, |
| 1257 |
int3 v3i32, int *ptr) { |
| 1258 |
|
| 1259 |
f32 = __builtin_elementwise_fma(); |
| 1260 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 0}} |
| 1261 |
|
| 1262 |
f32 = __builtin_elementwise_fma(f32); |
| 1263 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}} |
| 1264 |
|
| 1265 |
f32 = __builtin_elementwise_fma(f32, f32); |
| 1266 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}} |
| 1267 |
|
| 1268 |
f32 = __builtin_elementwise_fma(f32, f32, f32, f32); |
| 1269 |
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}} |
| 1270 |
|
| 1271 |
f32 = __builtin_elementwise_fma(f64, f32, f32); |
| 1272 |
// expected-error@-1 {{arguments are of different types ('double' vs 'float')}} |
| 1273 |
|
| 1274 |
f32 = __builtin_elementwise_fma(f32, f64, f32); |
| 1275 |
// expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 1276 |
|
| 1277 |
f32 = __builtin_elementwise_fma(f32, f32, f64); |
| 1278 |
// expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 1279 |
|
| 1280 |
f32 = __builtin_elementwise_fma(f32, f32, f64); |
| 1281 |
// expected-error@-1 {{arguments are of different types ('float' vs 'double')}} |
| 1282 |
|
| 1283 |
f64 = __builtin_elementwise_fma(f64, f32, f32); |
| 1284 |
// expected-error@-1 {{arguments are of different types ('double' vs 'float')}} |
| 1285 |
|
| 1286 |
f64 = __builtin_elementwise_fma(f64, f64, f32); |
| 1287 |
// expected-error@-1 {{arguments are of different types ('double' vs 'float')}} |
| 1288 |
|
| 1289 |
f64 = __builtin_elementwise_fma(f64, f32, f64); |
| 1290 |
// expected-error@-1 {{arguments are of different types ('double' vs 'float')}} |
| 1291 |
|
| 1292 |
v2f64 = __builtin_elementwise_fma(v2f32, f64, f64); |
| 1293 |
// expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}} |
| 1294 |
|
| 1295 |
v2f64 = __builtin_elementwise_fma(v2f32, v2f64, f64); |
| 1296 |
// expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double2' (vector of 2 'double' values)}} |
| 1297 |
|
| 1298 |
v2f64 = __builtin_elementwise_fma(v2f32, f64, v2f64); |
| 1299 |
// expected-error@-1 {{arguments are of different types ('float2' (vector of 2 'float' values) vs 'double'}} |
| 1300 |
|
| 1301 |
v2f64 = __builtin_elementwise_fma(f64, v2f32, v2f64); |
| 1302 |
// expected-error@-1 {{arguments are of different types ('double' vs 'float2' (vector of 2 'float' values)}} |
| 1303 |
|
| 1304 |
v2f64 = __builtin_elementwise_fma(f64, v2f64, v2f64); |
| 1305 |
// expected-error@-1 {{arguments are of different types ('double' vs 'double2' (vector of 2 'double' values)}} |
| 1306 |
|
| 1307 |
i32 = __builtin_elementwise_fma(i32, i32, i32); |
| 1308 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1309 |
|
| 1310 |
v2i32 = __builtin_elementwise_fma(v2i32, v2i32, v2i32); |
| 1311 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was 'int2' (vector of 2 'int' values))}} |
| 1312 |
|
| 1313 |
f32 = __builtin_elementwise_fma(f32, f32, i32); |
| 1314 |
// expected-error@-1 {{3rd argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1315 |
|
| 1316 |
f32 = __builtin_elementwise_fma(f32, i32, f32); |
| 1317 |
// expected-error@-1 {{2nd argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1318 |
|
| 1319 |
f32 = __builtin_elementwise_fma(f32, f32, i32); |
| 1320 |
// expected-error@-1 {{3rd argument must be a scalar or vector of floating-point types (was 'int')}} |
| 1321 |
|
| 1322 |
|
| 1323 |
_Complex float c1, c2, c3; |
| 1324 |
c1 = __builtin_elementwise_fma(c1, f32, f32); |
| 1325 |
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 1326 |
|
| 1327 |
c2 = __builtin_elementwise_fma(f32, c2, f32); |
| 1328 |
// expected-error@-1 {{2nd argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 1329 |
|
| 1330 |
c3 = __builtin_elementwise_fma(f32, f32, c3); |
| 1331 |
// expected-error@-1 {{3rd argument must be a scalar or vector of floating-point types (was '_Complex float')}} |
| 1332 |
} |
| 1333 |
|
| 1334 |
void test_builtin_elementwise_fsh(int i32, int2 v2i32, short i16, int3 v3i32, |
| 1335 |
double f64, float f32, float2 v2f32) { |
| 1336 |
i32 = __builtin_elementwise_fshl(); |
| 1337 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 0}} |
| 1338 |
|
| 1339 |
i32 = __builtin_elementwise_fshr(); |
| 1340 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 0}} |
| 1341 |
|
| 1342 |
i32 = __builtin_elementwise_fshl(i32, i32); |
| 1343 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}} |
| 1344 |
|
| 1345 |
i32 = __builtin_elementwise_fshr(i32, i32); |
| 1346 |
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}} |
| 1347 |
|
| 1348 |
i32 = __builtin_elementwise_fshl(i32, i32, i16); |
| 1349 |
// expected-error@-1 {{arguments are of different types ('int' vs 'short')}} |
| 1350 |
|
| 1351 |
i16 = __builtin_elementwise_fshr(i16, i32, i16); |
| 1352 |
// expected-error@-1 {{arguments are of different types ('short' vs 'int')}} |
| 1353 |
|
| 1354 |
f32 = __builtin_elementwise_fshl(f32, f32, f32); |
| 1355 |
// expected-error@-1 {{argument must be a scalar or vector of integer types (was 'float')}} |
| 1356 |
|
| 1357 |
f64 = __builtin_elementwise_fshr(f64, f64, f64); |
| 1358 |
// expected-error@-1 {{argument must be a scalar or vector of integer types (was 'double')}} |
| 1359 |
|
| 1360 |
v2i32 = __builtin_elementwise_fshl(v2i32, v2i32, v2f32); |
| 1361 |
// expected-error@-1 {{argument must be a scalar or vector of integer types (was 'float2' (vector of 2 'float' values))}} |
| 1362 |
|
| 1363 |
v2i32 = __builtin_elementwise_fshr(v2i32, v2i32, v3i32); |
| 1364 |
// expected-error@-1 {{arguments are of different types ('int2' (vector of 2 'int' values) vs 'int3' (vector of 3 'int' values))}} |
| 1365 |
|
| 1366 |
v3i32 = __builtin_elementwise_fshl(v3i32, v3i32, v2i32); |
| 1367 |
// expected-error@-1 {{arguments are of different types ('int3' (vector of 3 'int' values) vs 'int2' (vector of 2 'int' values))}} |
| 1368 |
} |
| 1369 |
|
| 1370 |
// Tests corresponding to GitHub issues #141397 and #155405. |
| 1371 |
// Type mismatch error when 'builtin-elementwise-math' arguments have |
| 1372 |
// different qualifiers, this should be well-formed. |
| 1373 |
typedef struct { |
| 1374 |
float3 b; |
| 1375 |
} struct_float3; |
| 1376 |
|
| 1377 |
float3 foo(float3 a,const struct_float3* hi) { |
| 1378 |
float3 b = __builtin_elementwise_max((float3)(0.0f), a); |
| 1379 |
return __builtin_elementwise_pow(b, hi->b.yyy); |
| 1380 |
} |
| 1381 |
|
| 1382 |
float3 baz(float3 a, const struct_float3* hi) { |
| 1383 |
return __builtin_elementwise_fma(a, a, hi->b); |
| 1384 |
} |
| 1385 |
|
| 1386 |
cfloat4 qux(cfloat4 x, float4 y, float4 z) { |
| 1387 |
float a = __builtin_elementwise_fma(x[0],y[0],z[0]); |
| 1388 |
return __builtin_elementwise_fma(x,y,z); |
| 1389 |
} |
| 1390 |
|
| 1391 |
cfloat4 quux(cfloat4 x, float4 y) { |
| 1392 |
float a = __builtin_elementwise_pow(x[0],y[0]); |
| 1393 |
return __builtin_elementwise_pow(x,y); |
| 1394 |
} |
| 1395 |
|
| 1396 |
void test_builtin_elementwise_clzg(int i32, int2 v2i32, short i16, |
| 1397 |
double f64, double2 v2f64) { |
| 1398 |
f64 = __builtin_elementwise_clzg(f64); |
| 1399 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'double')}} |
| 1400 |
|
| 1401 |
_Complex float c1; |
| 1402 |
c1 = __builtin_elementwise_clzg(c1); |
| 1403 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was '_Complex float')}} |
| 1404 |
|
| 1405 |
v2i32 = __builtin_elementwise_clzg(v2i32, i32); |
| 1406 |
// expected-error@-1 {{arguments are of different types ('int2' (vector of 2 'int' values) vs 'int')}} |
| 1407 |
|
| 1408 |
v2i32 = __builtin_elementwise_clzg(v2i32, f64); |
| 1409 |
// expected-error@-1 {{arguments are of different types ('int2' (vector of 2 'int' values) vs 'double')}} |
| 1410 |
|
| 1411 |
v2i32 = __builtin_elementwise_clzg(); |
| 1412 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1413 |
|
| 1414 |
v2i32 = __builtin_elementwise_clzg(v2i32, v2i32, f64); |
| 1415 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 1416 |
} |
| 1417 |
|
| 1418 |
void test_builtin_elementwise_ctzg(int i32, int2 v2i32, short i16, |
| 1419 |
double f64, double2 v2f64) { |
| 1420 |
f64 = __builtin_elementwise_ctzg(f64); |
| 1421 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was 'double')}} |
| 1422 |
|
| 1423 |
_Complex float c1; |
| 1424 |
c1 = __builtin_elementwise_ctzg(c1); |
| 1425 |
// expected-error@-1 {{1st argument must be a scalar or vector of integer types (was '_Complex float')}} |
| 1426 |
|
| 1427 |
v2i32 = __builtin_elementwise_ctzg(v2i32, i32); |
| 1428 |
// expected-error@-1 {{arguments are of different types ('int2' (vector of 2 'int' values) vs 'int')}} |
| 1429 |
|
| 1430 |
v2i32 = __builtin_elementwise_ctzg(v2i32, f64); |
| 1431 |
// expected-error@-1 {{arguments are of different types ('int2' (vector of 2 'int' values) vs 'double')}} |
| 1432 |
|
| 1433 |
v2i32 = __builtin_elementwise_ctzg(); |
| 1434 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 1435 |
|
| 1436 |
v2i32 = __builtin_elementwise_ctzg(v2i32, v2i32, f64); |
| 1437 |
// expected-error@-1 {{too many arguments to function call, expected 2, have 3}} |
| 1438 |
} |