1*67e74705SXin Li // RUN: %clang_cc1 %s -verify -fsyntax-only -Wvector-conversion 2*67e74705SXin Li typedef unsigned int v2u __attribute__ ((vector_size (8))); 3*67e74705SXin Li typedef signed int v2s __attribute__ ((vector_size (8))); 4*67e74705SXin Li typedef signed int v1s __attribute__ ((vector_size (4))); 5*67e74705SXin Li typedef float v2f __attribute__ ((vector_size(8))); 6*67e74705SXin Li typedef signed short v4ss __attribute__ ((vector_size (8))); 7*67e74705SXin Li test1()8*67e74705SXin Livoid test1() { 9*67e74705SXin Li v2s v1; 10*67e74705SXin Li v2u v2; 11*67e74705SXin Li v1s v3; 12*67e74705SXin Li v2f v4; 13*67e74705SXin Li v4ss v5; 14*67e74705SXin Li 15*67e74705SXin Li v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2u' (vector of 2 'unsigned int' values)}} 16*67e74705SXin Li v1 = v3; // expected-error {{assigning to 'v2s' (vector of 2 'int' values) from incompatible type 'v1s' (vector of 1 'int' value)}} 17*67e74705SXin Li v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2f' (vector of 2 'float' values)}} 18*67e74705SXin Li v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v4ss' (vector of 4 'short' values)}} 19*67e74705SXin Li 20*67e74705SXin Li v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2s' (vector of 2 'int' values)}} 21*67e74705SXin Li v2 = v3; // expected-error {{assigning to 'v2u' (vector of 2 'unsigned int' values) from incompatible type 'v1s' (vector of 1 'int' value)}} 22*67e74705SXin Li v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2f' (vector of 2 'float' values)}} 23*67e74705SXin Li v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v4ss' (vector of 4 'short' values)}} 24*67e74705SXin Li 25*67e74705SXin Li v3 = v1; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2s' (vector of 2 'int' values)}} 26*67e74705SXin Li v3 = v2; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2u' (vector of 2 'unsigned int' values)}} 27*67e74705SXin Li v3 = v4; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2f' (vector of 2 'float' values)}} 28*67e74705SXin Li v3 = v5; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v4ss'}} 29*67e74705SXin Li 30*67e74705SXin Li v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2s' (vector of 2 'int' values)}} 31*67e74705SXin Li v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2u' (vector of 2 'unsigned int' values)}} 32*67e74705SXin Li v4 = v3; // expected-error {{assigning to 'v2f' (vector of 2 'float' values) from incompatible type 'v1s' (vector of 1 'int' value)}} 33*67e74705SXin Li v4 = v5; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v4ss' (vector of 4 'short' values)}} 34*67e74705SXin Li 35*67e74705SXin Li v5 = v1; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2s' (vector of 2 'int' values)}} 36*67e74705SXin Li v5 = v2; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2u' (vector of 2 'unsigned int' values)}} 37*67e74705SXin Li v5 = v3; // expected-error {{assigning to 'v4ss' (vector of 4 'short' values) from incompatible type 'v1s' (vector of 1 'int' value)}} 38*67e74705SXin Li v5 = v4; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2f'}} 39*67e74705SXin Li } 40*67e74705SXin Li 41*67e74705SXin Li // PR2263 test2(float a,int b)42*67e74705SXin Lifloat test2(__attribute__((vector_size(16))) float a, int b) { 43*67e74705SXin Li return a[b]; 44*67e74705SXin Li } 45*67e74705SXin Li 46*67e74705SXin Li // PR4838 47*67e74705SXin Li typedef long long __attribute__((__vector_size__(2 * sizeof(long long)))) 48*67e74705SXin Li longlongvec; 49*67e74705SXin Li 50*67e74705SXin Li void test3a(longlongvec *); // expected-note{{passing argument to parameter here}} test3(const unsigned * src)51*67e74705SXin Livoid test3(const unsigned *src) { 52*67e74705SXin Li test3a(src); // expected-warning {{incompatible pointer types passing 'const unsigned int *' to parameter of type 'longlongvec *'}} 53*67e74705SXin Li } 54