1 // RUN
: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown
3 #pragma OPENCL EXTENSION cl_khr_fp16
: disable
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;
28 kernel void half_disabled_kernel(global half *p,
29 half h); // expected-error{{declaring function parameter of type '__private half' is not allowed; did you forget * ?}}
31 // Exactly the same as above but with the cl_khr_fp16 extension enabled.
32 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
33 constant half a = 1.0h;
34 half half_enabled(half *p, half h)
48 half *allowed = &p[1];
50 half
*allowed3
= p
+ 1;
55 kernel void half_enabled_kernel
(global half
*p
,