vector-assign.c revision 695dbb697d78d4c507e12b0acc6129b9650d4c3e
1// RUN: clang %s -verify -fsyntax-only -flax-vector-conversions 2typedef unsigned int v2u __attribute__ ((vector_size (8))); 3typedef signed int v2s __attribute__ ((vector_size (8))); 4typedef signed int v1s __attribute__ ((vector_size (4))); 5typedef float v2f __attribute__ ((vector_size(8))); 6typedef signed short v4ss __attribute__ ((vector_size (8))); 7 8void f() { 9 v2s v1; 10 v2u v2; 11 v1s v3; 12 v2f v4; 13 v4ss v5; 14 15 v1 = v2; 16 v1 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v2s'}} 17 v1 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v2s'}} 18 v1 = v5; 19 20 v2 = v1; 21 v2 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v2u'}} 22 v2 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v2u'}} 23 v2 = v5; 24 25 v3 = v1; // expected-error {{incompatible types assigning 'v2s' to 'v1s'}} 26 v3 = v2; // expected-error {{incompatible types assigning 'v2u' to 'v1s'}} 27 v3 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v1s'}} 28 v3 = v5; // expected-error {{incompatible types assigning 'v4ss' to 'v1s'}} 29 30 v4 = v1; // expected-error {{incompatible types assigning 'v2s' to 'v2f'}} 31 v4 = v2; // expected-error {{incompatible types assigning 'v2u' to 'v2f'}} 32 v4 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v2f'}} 33 v4 = v5; // expected-error {{incompatible types assigning 'v4ss' to 'v2f'}} 34 35 v5 = v1; 36 v5 = v2; 37 v5 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v4ss'}} 38 v5 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v4ss'}} 39} 40