brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 115ec50 Raw
28 lines · cpp
1// RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s2 3using v8i = int [[clang::ext_vector_type(8)]];4using v8b = bool [[clang::ext_vector_type(8)]];5using v4f = float [[clang::ext_vector_type(4)]];6using v4b = bool [[clang::ext_vector_type(4)]];7 8void foo(v8b);9 10v8b 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 21v4b 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 25v4b 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}28