brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 8f9d7b1 Raw
30 lines · c
1// RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s2 3typedef _Bool bool;4 5typedef __attribute__((ext_vector_type(8))) int v8i;6typedef __attribute__((ext_vector_type(8))) bool v8b;7typedef __attribute__((ext_vector_type(4))) float v4f;8typedef __attribute__((ext_vector_type(4))) bool v4b;9 10void foo(v8b);11 12v8b 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 23v4b 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 27v4b 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}30