1 // RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
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 typedef __fp16 exthalf4
__attribute__((ext_vector_type(4)));
14 void testFP16Vec(int 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 sv0
= hv0
&& hv1
; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
35 // Implicit conversion between half vectors and float vectors are not allowed.
36 hv0
= fv0
; // expected-error{{assigning to}}
37 fv0
= hv0
; // expected-error{{assigning to}}
38 hv0
= (half4
)fv0
; // expected-error{{invalid conversion between}}
39 fv0
= (float4
)hv0
; // expected-error{{invalid conversion between}}
40 hv0
= fv0
+ fv1
; // expected-error{{assigning to}}
41 fv0
= hv0
+ hv1
; // expected-error{{assigning to}}
42 hv0
= hv0
+ fv1
; // expected-error{{cannot convert between vector}}
43 hv0
= c
? 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}}
46 sv0
= hv0
|| fv1
; // expected-error{{cannot convert between vector}} expected-error{{invalid operands to binary expression}}
47 iv0
= hv0
== hv1
; // expected-error{{assigning to}}
49 // FIXME: clang currently disallows using these operators on vectors, which is
51 sv0
= !hv0
; // expected-error{{invalid argument type}}
52 hv0
++; // expected-error{{cannot increment value of type}}
53 ++hv0
; // expected-error{{cannot increment value of type}}
56 void testExtVec(exthalf4 a
) {
57 // Check that the type of "(-a)" is exthalf4.