1 // RUN
: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown
2 // RUN
: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -DHAVE_BUILTINS
4 constant float f
= 1.0h
; // expected-error{{half precision constant requires cl_khr_fp16}}
6 half half_disabled
(half *p
, // expected-error
{{declaring function return value of type
'half
' is not allowed
}}
7 half h
) // expected-error
{{declaring function parameter of type
'__private half
' is not allowed
}}
9 half a
[2]; // expected-error{{declaring variable of type '__private half[2]' is not allowed
}}
10 half b
; // expected-error{{declaring variable of type '__private half' is not allowed}}
11 *p
; // expected-error{{loading directly from pointer to type '__private half' requires cl_khr_fp16. Use vector data load builtin functions instead}}
12 *p
= 0; // expected-error{{assigning directly to pointer to type 'half' requires cl_khr_fp16. Use vector data store builtin functions instead}}
13 p
[1]; // expected-error{{loading directly from pointer to type '__private half' requires cl_khr_fp16. Use vector data load builtin functions instead}}
14 p[1] = 0; // expected-error{{assigning directly to pointer to type 'half' requires cl_khr_fp16. Use vector data store builtin functions instead}}
17 b
= (half) c
; // expected-error{{casting to type 'half' is not allowed}}
18 c
= (float) 1.0h
; // expected-error{{half precision constant requires cl_khr_fp16}}
19 b
= 1.0h
; // expected-error{{half precision constant requires cl_khr_fp16}}
21 half
*allowed
= &p
[1];
23 half *allowed3 = p + 1;
26 (void)ilogb(*p); // expected-error{{loading directly from pointer to type '__private half' requires cl_khr_fp16. Use vector data load builtin functions instead}}
27 vstore_half(42.0f, 0, p);
33 kernel void half_disabled_kernel(global half *p,
34 half h); // expected-error{{declaring function parameter of type '__private half' is not allowed; did you forget * ?}}
36 // Exactly the same as above but with the cl_khr_fp16 extension enabled.
37 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
38 constant half a = 1.0h;
39 half half_enabled(half *p, half h)
53 half *allowed = &p[1];
55 half
*allowed3
= p
+ 1;
59 vstore_half
(42.0f
, 0, p
);
65 kernel void half_enabled_kernel
(global half
*p
,