Debian Codegraph @

clang/test/Sema/vector-bool-assign.cpp

raw
1 // RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s
2
3 using v8i = int [[clang::ext_vector_type(8)]];
4 using v8b = bool [[clang::ext_vector_type(8)]];
5 using v4f = float [[clang::ext_vector_type(4)]];
6 using v4b = bool [[clang::ext_vector_type(4)]];
7
8 void foo(v8b);
9
10 v8b integral(v8i v) {
11 v8b m1 = __builtin_convertvector(v, int [[clang::ext_vector_type(8)]]);
12 v8b m2 = __builtin_convertvector(v, unsigned [[clang::ext_vector_type(8)]]);
13 v8b m3 = __builtin_convertvector(v, long [[clang::ext_vector_type(8)]]);
14 v8b m4 = __builtin_convertvector(v, unsigned long [[clang::ext_vector_type(8)]]);
15 v8b m5 = __builtin_convertvector(v, char [[clang::ext_vector_type(8)]]);
16 v8b m6 = __builtin_convertvector(v, unsigned char [[clang::ext_vector_type(8)]]);
17 foo(v);
18 return v;
19 }
20
21 v4b non_integral(v4f vf) {
22 return vf; // expected-error{{cannot initialize return object of type 'v4b' (vector of 4 'bool' values) with an lvalue of type 'v4f' (vector of 4 'float' values)}}
23 }
24
25 v4b size_mismatch(v8i v) {
26 return v; // expected-error{{cannot initialize return object of type 'v4b' (vector of 4 'bool' values) with an lvalue of type 'v8i' (vector of 8 'int' values)}}
27 }