[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / clang / test / SemaOpenCL / half.cl
blob2ea971c085105e1cd93b8fc92b923fa0cceb2340
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}}
16 float c = 1.0f;
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];
22 half *allowed2 = &*p;
23 half *allowed3 = p + 1;
25 return h;
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)
36 half a[2];
37 half b;
38 *p;
39 *p = 0;
40 p[1];
41 p[1] = 0;
43 float c = 1.0f;
44 b = (half) c;
45 c = (float) 1.0h;
46 b = 1.0h;
48 half *allowed = &p[1];
49 half *allowed2 = &*p;
50 half *allowed3 = p + 1;
52 return h;
55 kernel void half_enabled_kernel(global half *p,
56 half h);