| 1 |
// RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
typedef _Bool bool; |
| 4 |
|
| 5 |
typedef __attribute__((ext_vector_type(8))) int v8i; |
| 6 |
typedef __attribute__((ext_vector_type(8))) bool v8b; |
| 7 |
typedef __attribute__((ext_vector_type(4))) float v4f; |
| 8 |
typedef __attribute__((ext_vector_type(4))) bool v4b; |
| 9 |
|
| 10 |
void foo(v8b); |
| 11 |
|
| 12 |
v8b integral(v8i v) { |
| 13 |
v8b m1 = __builtin_convertvector(v, __attribute__((ext_vector_type(8))) int); |
| 14 |
v8b m2 = __builtin_convertvector(v, __attribute__((ext_vector_type(8))) unsigned); |
| 15 |
v8b m3 = __builtin_convertvector(v, __attribute__((ext_vector_type(8))) long); |
| 16 |
v8b m4 = __builtin_convertvector(v, __attribute__((ext_vector_type(8))) unsigned long); |
| 17 |
v8b m5 = __builtin_convertvector(v, __attribute__((ext_vector_type(8))) char); |
| 18 |
v8b m6 = __builtin_convertvector(v, __attribute__((ext_vector_type(8))) unsigned char); |
| 19 |
foo(v); |
| 20 |
return v; |
| 21 |
} |
| 22 |
|
| 23 |
v4b non_integral(v4f vf) { |
| 24 |
return vf; // expected-error{{returning 'v4f' (vector of 4 'float' values) from a function with incompatible result type 'v4b' (vector of 4 'bool' values}} |
| 25 |
} |
| 26 |
|
| 27 |
v4b size_mismatch(v8i v) { |
| 28 |
return v; // expected-error{{returning 'v8i' (vector of 8 'int' values) from a function with incompatible result type 'v4b' (vector of 4 'bool' values)}} |
| 29 |
} |