diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl index 13266bc7a05..590f27353dd 100644 --- a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl +++ b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl @@ -4,11 +4,14 @@ // Test the -fdeclare-opencl-builtins option. +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + // Provide typedefs when invoking clang without -finclude-default-header. #ifdef NO_HEADER typedef char char2 __attribute__((ext_vector_type(2))); typedef char char4 __attribute__((ext_vector_type(4))); typedef float float4 __attribute__((ext_vector_type(4))); +typedef half half4 __attribute__((ext_vector_type(4))); typedef int int2 __attribute__((ext_vector_type(2))); typedef int int4 __attribute__((ext_vector_type(4))); typedef long long2 __attribute__((ext_vector_type(2))); @@ -46,6 +49,33 @@ char4 test_int(char c, char4 c4) { return max(c4, c); } +kernel void basic_image_readonly(read_only image2d_t image_read_only_image2d) { + int2 i2; + sampler_t sampler; + half4 res; + float4 resf; + + resf = read_imagef(image_read_only_image2d, i2); + res = read_imageh(image_read_only_image2d, i2); + res = read_imageh(image_read_only_image2d, sampler, i2); +} + +kernel void basic_image_readwrite(read_write image3d_t image_read_write_image3d) { + half4 h4; + int4 i4; + + write_imageh(image_read_write_image3d, i4, h4); +} + +kernel void basic_image_writeonly(write_only image1d_buffer_t image_write_only_image1d_buffer) { + half4 h4; + float4 f4; + int i; + + write_imagef(image_write_only_image1d_buffer, i, f4); + write_imageh(image_write_only_image1d_buffer, i, h4); +} + kernel void basic_subgroup(global uint *out) { out[0] = get_sub_group_size(); } |