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