xref: /llvm-project/clang/test/SemaOpenCLCXX/half.clcpp (revision 94b0aec0f5c6b4f6a27cf3a542f795bbba72e851)
1//RUN: %clang_cc1 %s -triple spir -verify -fsyntax-only
2
3#pragma OPENCL EXTENSION cl_khr_fp16 : disable
4
5typedef half half2 __attribute__((ext_vector_type(2)));
6
7half f(half2 h2) { // expected-error{{declaring function return value of type 'half' is not allowed ; did you forget * ?}}
8    return h2.s0; // expected-error{{loading directly from pointer to type '__private half' requires cl_khr_fp16. Use vector data load builtin functions instead}}
9}
10
11#pragma OPENCL EXTENSION cl_khr_fp16 : enable
12
13half f(half2 h2) {
14    return h2.s0;
15}
16