1 | // RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown |
2 | // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown |
3 | // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown |
4 | // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown |
5 | // RUN: %clang_cc1 -x cl -cl-std=c++ %s -verify -triple spir-unknown-unknown |
6 | // RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES |
7 | // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES |
8 | // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES |
9 | // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES |
10 | // RUN: %clang_cc1 -x cl -cl-std=c++ %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES |
11 | |
12 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) && !defined(TEST_CORE_FEATURES) |
13 | // expected-no-diagnostics |
14 | #endif |
15 | |
16 | // Extensions in all versions |
17 | #ifndef cl_clang_storage_class_specifiers |
18 | #error "Missing cl_clang_storage_class_specifiers define" |
19 | #endif |
20 | #pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable |
21 | |
22 | #ifndef cl_khr_fp16 |
23 | #error "Missing cl_khr_fp16 define" |
24 | #endif |
25 | #pragma OPENCL EXTENSION cl_khr_fp16: enable |
26 | |
27 | #ifndef cl_khr_int64_base_atomics |
28 | #error "Missing cl_khr_int64_base_atomics define" |
29 | #endif |
30 | #pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable |
31 | |
32 | #ifndef cl_khr_int64_extended_atomics |
33 | #error "Missing cl_khr_int64_extended_atomics define" |
34 | #endif |
35 | #pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable |
36 | |
37 | #ifndef cl_khr_gl_sharing |
38 | #error "Missing cl_khr_gl_sharing define" |
39 | #endif |
40 | #pragma OPENCL EXTENSION cl_khr_gl_sharing: enable |
41 | |
42 | #ifndef cl_khr_icd |
43 | #error "Missing cl_khr_icd define" |
44 | #endif |
45 | #pragma OPENCL EXTENSION cl_khr_icd: enable |
46 | |
47 | // Core features in CL 1.1 |
48 | |
49 | #ifndef cl_khr_byte_addressable_store |
50 | #error "Missing cl_khr_byte_addressable_store define" |
51 | #endif |
52 | #pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable |
53 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES |
54 | // expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}} |
55 | #endif |
56 | |
57 | #ifndef cl_khr_global_int32_base_atomics |
58 | #error "Missing cl_khr_global_int32_base_atomics define" |
59 | #endif |
60 | #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable |
61 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES |
62 | // expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}} |
63 | #endif |
64 | |
65 | #ifndef cl_khr_global_int32_extended_atomics |
66 | #error "Missing cl_khr_global_int32_extended_atomics define" |
67 | #endif |
68 | #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable |
69 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES |
70 | // expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} |
71 | #endif |
72 | |
73 | #ifndef cl_khr_local_int32_base_atomics |
74 | #error "Missing cl_khr_local_int32_base_atomics define" |
75 | #endif |
76 | #pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable |
77 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES |
78 | // expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}} |
79 | #endif |
80 | |
81 | #ifndef cl_khr_local_int32_extended_atomics |
82 | #error "Missing cl_khr_local_int32_extended_atomics define" |
83 | #endif |
84 | #pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable |
85 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES |
86 | // expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} |
87 | #endif |
88 | |
89 | #if (defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 110) |
90 | // Deprecated abvoe 1.0 |
91 | #ifndef cl_khr_select_fprounding_mode |
92 | #error "Missing cl_khr_select_fp_rounding_mode define" |
93 | #endif |
94 | #pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable |
95 | #endif |
96 | |
97 | |
98 | // Core feature in CL 1.2 |
99 | #ifndef cl_khr_fp64 |
100 | #error "Missing cl_khr_fp64 define" |
101 | #endif |
102 | #pragma OPENCL EXTENSION cl_khr_fp64 : enable |
103 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES |
104 | // expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} |
105 | #endif |
106 | |
107 | //Core feature in CL 2.0 |
108 | #ifndef cl_khr_3d_image_writes |
109 | #error "Missing cl_khr_3d_image_writes define" |
110 | #endif |
111 | #pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable |
112 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) && defined TEST_CORE_FEATURES |
113 | // expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}} |
114 | #endif |
115 | |
116 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) |
117 | #ifndef cl_khr_gl_event |
118 | #error "Missing cl_khr_gl_event define" |
119 | #endif |
120 | #else |
121 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}} |
122 | #endif |
123 | #pragma OPENCL EXTENSION cl_khr_gl_event : enable |
124 | |
125 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) |
126 | #ifndef cl_khr_d3d10_sharing |
127 | #error "Missing cl_khr_d3d10_sharing define" |
128 | #endif |
129 | #else |
130 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}} |
131 | #endif |
132 | #pragma OPENCL EXTENSION cl_khr_d3d10_sharing : enable |
133 | |
134 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) |
135 | #ifndef cles_khr_int64 |
136 | #error "Missing cles_khr_int64 define" |
137 | #endif |
138 | #else |
139 | // expected-warning@+2{{unsupported OpenCL extension 'cles_khr_int64' - ignoring}} |
140 | #endif |
141 | #pragma OPENCL EXTENSION cles_khr_int64 : enable |
142 | |
143 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
144 | #ifndef cl_khr_context_abort |
145 | #error "Missing cl_context_abort define" |
146 | #endif |
147 | #else |
148 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}} |
149 | #endif |
150 | #pragma OPENCL EXTENSION cl_khr_context_abort : enable |
151 | |
152 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
153 | #ifndef cl_khr_d3d11_sharing |
154 | #error "Missing cl_khr_d3d11_sharing define" |
155 | #endif |
156 | #else |
157 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}} |
158 | #endif |
159 | #pragma OPENCL EXTENSION cl_khr_d3d11_sharing : enable |
160 | |
161 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
162 | #ifndef cl_khr_dx9_media_sharing |
163 | #error "Missing cl_khr_dx9_media_sharing define" |
164 | #endif |
165 | #else |
166 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}} |
167 | #endif |
168 | #pragma OPENCL EXTENSION cl_khr_dx9_media_sharing : enable |
169 | |
170 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
171 | #ifndef cl_khr_image2d_from_buffer |
172 | #error "Missing cl_khr_image2d_from_buffer define" |
173 | #endif |
174 | #else |
175 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}} |
176 | #endif |
177 | #pragma OPENCL EXTENSION cl_khr_image2d_from_buffer : enable |
178 | |
179 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
180 | #ifndef cl_khr_initialize_memory |
181 | #error "Missing cl_khr_initialize_memory define" |
182 | #endif |
183 | #else |
184 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_initialize_memory' - ignoring}} |
185 | #endif |
186 | #pragma OPENCL EXTENSION cl_khr_initialize_memory : enable |
187 | |
188 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
189 | #ifndef cl_khr_gl_depth_images |
190 | #error "Missing cl_khr_gl_depth_images define" |
191 | #endif |
192 | #else |
193 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_depth_images' - ignoring}} |
194 | #endif |
195 | #pragma OPENCL EXTENSION cl_khr_gl_depth_images : enable |
196 | |
197 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
198 | #ifndef cl_khr_gl_msaa_sharing |
199 | #error "Missing cl_khr_gl_msaa_sharing define" |
200 | #endif |
201 | #else |
202 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}} |
203 | #endif |
204 | #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable |
205 | |
206 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
207 | #ifndef cl_khr_spir |
208 | #error "Missing cl_khr_spir define" |
209 | #endif |
210 | #else |
211 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_spir' - ignoring}} |
212 | #endif |
213 | #pragma OPENCL EXTENSION cl_khr_spir : enable |
214 | |
215 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
216 | #ifndef cl_khr_egl_event |
217 | #error "Missing cl_khr_egl_event define" |
218 | #endif |
219 | #else |
220 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_egl_event' - ignoring}} |
221 | #endif |
222 | #pragma OPENCL EXTENSION cl_khr_egl_event : enable |
223 | |
224 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
225 | #ifndef cl_khr_egl_image |
226 | #error "Missing cl_khr_egl_image define" |
227 | #endif |
228 | #else |
229 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_egl_image' - ignoring}} |
230 | #endif |
231 | #pragma OPENCL EXTENSION cl_khr_egl_image : enable |
232 | |
233 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
234 | #ifndef cl_khr_mipmap_image |
235 | #error "Missing cl_khr_mipmap_image define" |
236 | #endif |
237 | #else |
238 | #ifdef cl_khr_mipmap_image |
239 | #error "Incorrect cl_khr_mipmap_image define" |
240 | #endif |
241 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}} |
242 | #endif |
243 | #pragma OPENCL EXTENSION cl_khr_mipmap_image : enable |
244 | |
245 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
246 | #ifndef cl_khr_srgb_image_writes |
247 | #error "Missing cl_khr_srgb_image_writes define" |
248 | #endif |
249 | #else |
250 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} |
251 | #endif |
252 | #pragma OPENCL EXTENSION cl_khr_srgb_image_writes : enable |
253 | |
254 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
255 | #ifndef cl_khr_subgroups |
256 | #error "Missing cl_khr_subgroups define" |
257 | #endif |
258 | #else |
259 | #ifdef cl_khr_subgroups |
260 | #error "Incorrect cl_khr_subgroups define" |
261 | #endif |
262 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} |
263 | #endif |
264 | #pragma OPENCL EXTENSION cl_khr_subgroups : enable |
265 | |
266 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
267 | #ifndef cl_khr_terminate_context |
268 | #error "Missing cl_khr_terminate_context define" |
269 | #endif |
270 | #else |
271 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_terminate_context' - ignoring}} |
272 | #endif |
273 | #pragma OPENCL EXTENSION cl_khr_terminate_context: enable |
274 | |
275 | #ifndef cl_amd_media_ops |
276 | #error "Missing cl_amd_media_ops define" |
277 | #endif |
278 | #pragma OPENCL EXTENSION cl_amd_media_ops: enable |
279 | |
280 | #ifndef cl_amd_media_ops2 |
281 | #error "Missing cl_amd_media_ops2 define" |
282 | #endif |
283 | #pragma OPENCL EXTENSION cl_amd_media_ops2 : enable |
284 | |
285 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
286 | #ifndef cl_khr_depth_images |
287 | #error "Missing cl_khr_depth_images define" |
288 | #endif |
289 | #else |
290 | #ifdef cl_khr_depth_images |
291 | #error "Incorrect cl_khr_depth_images define" |
292 | #endif |
293 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_depth_images' - ignoring}} |
294 | #endif |
295 | #pragma OPENCL EXTENSION cl_khr_depth_images : enable |
296 | |
297 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
298 | #ifndef cl_intel_subgroups |
299 | #error "Missing cl_intel_subgroups define" |
300 | #endif |
301 | #else |
302 | // expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups' - ignoring}} |
303 | #endif |
304 | #pragma OPENCL EXTENSION cl_intel_subgroups : enable |
305 | |
306 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
307 | #ifndef cl_intel_subgroups_short |
308 | #error "Missing cl_intel_subgroups_short define" |
309 | #endif |
310 | #else |
311 | // expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups_short' - ignoring}} |
312 | #endif |
313 | #pragma OPENCL EXTENSION cl_intel_subgroups_short : enable |
314 | |
315 | #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
316 | #ifndef cl_intel_device_side_avc_motion_estimation |
317 | #error "Missing cl_intel_device_side_avc_motion_estimation define" |
318 | #endif |
319 | #else |
320 | // expected-warning@+2{{unsupported OpenCL extension 'cl_intel_device_side_avc_motion_estimation' - ignoring}} |
321 | #endif |
322 | #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable |
323 | |
324 | |