1 // RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s 2 3 typedef __fp16 half4 __attribute__ ((vector_size (8))); 4 typedef float float4 __attribute__ ((vector_size (16))); 5 typedef short short4 __attribute__ ((vector_size (8))); 6 typedef int int4 __attribute__ ((vector_size (16))); 7 8 half4 hv0, hv1; 9 float4 fv0, fv1; 10 short4 sv0; 11 int4 iv0; 12 testFP16Vec(int c)13void testFP16Vec(int c) { 14 hv0 = hv0 + hv1; 15 hv0 = hv0 - hv1; 16 hv0 = hv0 * hv1; 17 hv0 = hv0 / hv1; 18 hv0 = c ? hv0 : hv1; 19 hv0 += hv1; 20 hv0 -= hv1; 21 hv0 *= hv1; 22 hv0 /= hv1; 23 sv0 = hv0 == hv1; 24 sv0 = hv0 != hv1; 25 sv0 = hv0 < hv1; 26 sv0 = hv0 > hv1; 27 sv0 = hv0 <= hv1; 28 sv0 = hv0 >= hv1; 29 sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}} 30 sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}} 31 hv0, 1; 32 1, hv0; 33 34 // Implicit conversion between half vectors and float vectors are not allowed. 35 hv0 = fv0; // expected-error{{assigning to}} 36 fv0 = hv0; // expected-error{{assigning to}} 37 hv0 = (half4)fv0; // expected-error{{invalid conversion between}} 38 fv0 = (float4)hv0; // expected-error{{invalid conversion between}} 39 hv0 = fv0 + fv1; // expected-error{{assigning to}} 40 fv0 = hv0 + hv1; // expected-error{{assigning to}} 41 hv0 = hv0 + fv1; // expected-error{{cannot convert between vector}} 42 hv0 = c ? hv0 : fv1; // expected-error{{cannot convert between vector}} 43 sv0 = hv0 == fv1; // expected-error{{cannot convert between vector}} 44 sv0 = hv0 < fv1; // expected-error{{cannot convert between vector}} 45 sv0 = hv0 || fv1; // expected-error{{cannot convert between vector}} expected-error{{invalid operands to binary expression}} 46 iv0 = hv0 == hv1; // expected-error{{assigning to}} 47 48 // FIXME: clang currently disallows using these operators on vectors, which is 49 // allowed by gcc. 50 sv0 = !hv0; // expected-error{{invalid argument type}} 51 hv0++; // expected-error{{cannot increment value of type}} 52 ++hv0; // expected-error{{cannot increment value of type}} 53 } 54