xref: /llvm-project/clang/test/SemaOpenCL/unsupported-image.cl (revision ca3bebd8440f9f88f1457dad9c12933b73d9590f)
1// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -cl-std=CL3.0 -cl-ext=-__opencl_c_images,-__opencl_c_read_write_images,-cl_khr_3d_image_writes,-__opencl_c_3d_image_writes %s
2// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -cl-std=CL3.0 -cl-ext=+__opencl_c_images,+__opencl_c_read_write_images,+cl_khr_3d_image_writes,+__opencl_c_3d_image_writes %s
3// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -cl-std=CL3.0 -cl-ext=+__opencl_c_images,+__opencl_c_read_write_images,-cl_khr_3d_image_writes,-__opencl_c_3d_image_writes %s
4// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -cl-std=clc++2021 -cl-ext=-__opencl_c_images,-__opencl_c_read_write_images,-cl_khr_3d_image_writes,-__opencl_c_3d_image_writes %s
5// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -cl-std=clc++2021 -cl-ext=+__opencl_c_images,+__opencl_c_read_write_images,+cl_khr_3d_image_writes,+__opencl_c_3d_image_writes %s
6// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -cl-std=clc++2021 -cl-ext=+__opencl_c_images,+__opencl_c_read_write_images,-cl_khr_3d_image_writes,-__opencl_c_3d_image_writes %s
7
8#if defined(__opencl_c_images) && defined(__opencl_c_3d_image_writes)
9//expected-no-diagnostics
10#endif
11
12void test1(image1d_t i) {}
13#if !defined(__opencl_c_images)
14// expected-error@-2{{use of type '__read_only image1d_t' requires __opencl_c_images support}}
15#endif
16
17void test2(image2d_t i) {}
18#if !defined(__opencl_c_images)
19// expected-error@-2{{use of type '__read_only image2d_t' requires __opencl_c_images support}}
20#endif
21
22void test3(image1d_array_t i) {}
23#if !defined(__opencl_c_images)
24// expected-error@-2{{use of type '__read_only image1d_array_t' requires __opencl_c_images support}}
25#endif
26
27void test4(image2d_array_t i) {}
28#if !defined(__opencl_c_images)
29// expected-error@-2{{use of type '__read_only image2d_array_t' requires __opencl_c_images support}}
30#endif
31
32void test5(image2d_depth_t i) {}
33#if !defined(__opencl_c_images)
34// expected-error@-2{{use of type '__read_only image2d_depth_t' requires __opencl_c_images support}}
35#endif
36
37void test6(image1d_buffer_t i) {}
38#if !defined(__opencl_c_images)
39// expected-error@-2{{use of type '__read_only image1d_buffer_t' requires __opencl_c_images support}}
40#endif
41
42void test7(image2d_msaa_t i) {}
43#if !defined(__opencl_c_images)
44// expected-error@-2{{use of type '__read_only image2d_msaa_t' requires __opencl_c_images support}}
45#endif
46
47void test8(image2d_array_msaa_t i) {}
48#if !defined(__opencl_c_images)
49// expected-error@-2{{use of type '__read_only image2d_array_msaa_t' requires __opencl_c_images support}}
50#endif
51
52void test9(image2d_msaa_depth_t i) {}
53#if !defined(__opencl_c_images)
54// expected-error@-2{{use of type '__read_only image2d_msaa_depth_t' requires __opencl_c_images support}}
55#endif
56
57void test10(image2d_array_msaa_depth_t i) {}
58#if !defined(__opencl_c_images)
59// expected-error@-2{{use of type '__read_only image2d_array_msaa_depth_t' requires __opencl_c_images support}}
60#endif
61
62void test11(sampler_t s) {}
63#if !defined(__opencl_c_images)
64// expected-error@-2{{use of type 'sampler_t' requires __opencl_c_images support}}
65#endif
66
67void test12(write_only image3d_t i) {}
68#if !defined(__opencl_c_images)
69// expected-error@-2{{use of type '__write_only image3d_t' requires __opencl_c_images support}}
70#elif !defined(__opencl_c_3d_image_writes)
71// expected-error@-4{{use of type '__write_only image3d_t' requires cl_khr_3d_image_writes and __opencl_c_3d_image_writes support}}
72#endif
73