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
=clc
++ %s -verify -triple spir-unknown-unknown
6 // RUN
: %clang_cc1 -x cl -cl-std
=CL3.0 %s -verify -triple spir-unknown-unknown
7 // RUN
: %clang_cc1 -x cl -cl-std
=CL %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
8 // RUN
: %clang_cc1 -x cl -cl-std
=CL1.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
9 // RUN
: %clang_cc1 -x cl -cl-std
=CL1.2 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
10 // RUN
: %clang_cc1 -x cl -cl-std
=CL2.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
11 // RUN
: %clang_cc1 -x cl -cl-std
=clc
++ %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
12 // RUN
: %clang_cc1 -x cl -cl-std
=CL3.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
14 // Extensions in all versions
15 #ifndef cl_clang_storage_class_specifiers
16 #error
"Missing cl_clang_storage_class_specifiers define"
18 #pragma OPENCL EXTENSION cl_clang_storage_class_specifiers
: enable
20 #ifndef __cl_clang_function_pointers
21 #error
"Missing __cl_clang_function_pointers define"
23 #pragma OPENCL EXTENSION __cl_clang_function_pointers
: enable
25 #ifndef __cl_clang_variadic_functions
26 #error
"Missing __cl_clang_variadic_functions define"
28 #pragma OPENCL EXTENSION __cl_clang_variadic_functions
: enable
31 #error
"Missing cl_khr_fp16 define"
33 #pragma OPENCL EXTENSION cl_khr_fp16
: enable
35 #ifndef cl_khr_int64_base_atomics
36 #error
"Missing cl_khr_int64_base_atomics define"
38 #pragma OPENCL EXTENSION cl_khr_int64_base_atomics
: enable
40 #ifndef cl_khr_int64_extended_atomics
41 #error
"Missing cl_khr_int64_extended_atomics define"
43 #pragma OPENCL EXTENSION cl_khr_int64_extended_atomics
: enable
45 // Core features in CL
1.1
47 #ifndef cl_khr_byte_addressable_store
48 #error
"Missing cl_khr_byte_addressable_store define"
50 #pragma OPENCL EXTENSION cl_khr_byte_addressable_store
: enable
51 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 110) && defined TEST_CORE_FEATURES
52 // expected-warning
@-
2{{OpenCL extension
'cl_khr_byte_addressable_store
' is core feature or supported optional core feature - ignoring
}}
55 #ifndef cl_khr_global_int32_base_atomics
56 #error
"Missing cl_khr_global_int32_base_atomics define"
58 #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics
: enable
59 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 110) && defined TEST_CORE_FEATURES
60 // expected-warning
@-
2{{OpenCL extension
'cl_khr_global_int32_base_atomics
' is core feature or supported optional core feature - ignoring
}}
63 #ifndef cl_khr_global_int32_extended_atomics
64 #error
"Missing cl_khr_global_int32_extended_atomics define"
66 #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics
: enable
67 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 110) && defined TEST_CORE_FEATURES
68 // expected-warning
@-
2{{OpenCL extension
'cl_khr_global_int32_extended_atomics
' is core feature or supported optional core feature - ignoring
}}
71 #ifndef cl_khr_local_int32_base_atomics
72 #error
"Missing cl_khr_local_int32_base_atomics define"
74 #pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics
: enable
75 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 110) && defined TEST_CORE_FEATURES
76 // expected-warning
@-
2{{OpenCL extension
'cl_khr_local_int32_base_atomics
' is core feature or supported optional core feature - ignoring
}}
79 #ifndef cl_khr_local_int32_extended_atomics
80 #error
"Missing cl_khr_local_int32_extended_atomics define"
82 #pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics
: enable
83 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 110) && defined TEST_CORE_FEATURES
84 // expected-warning
@-
2{{OpenCL extension
'cl_khr_local_int32_extended_atomics
' is core feature or supported optional core feature - ignoring
}}
87 // Core feature in CL
1.2
89 #error
"Missing cl_khr_fp64 define"
91 #pragma OPENCL EXTENSION cl_khr_fp64
: enable
92 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 120) && defined TEST_CORE_FEATURES
93 // expected-warning
@-
2{{OpenCL extension
'cl_khr_fp64
' is core feature or supported optional core feature - ignoring
}}
96 //Core feature in CL
2.0, optional core feature in CL
3.0
97 #ifndef cl_khr_3d_image_writes
98 #error
"Missing cl_khr_3d_image_writes define"
100 #pragma OPENCL EXTENSION cl_khr_3d_image_writes
: enable
101 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
== 200 || __OPENCL_C_VERSION__
== 300) && defined TEST_CORE_FEATURES
102 // expected-warning
@-
2{{OpenCL extension
'cl_khr_3d_image_writes
' is core feature or supported optional core feature - ignoring
}}
105 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 110)
106 #ifndef cles_khr_int64
107 #error
"Missing cles_khr_int64 define"
110 // expected-warning
@+2{{unsupported OpenCL extension
'cles_khr_int64
' - ignoring
}}
112 #pragma OPENCL EXTENSION cles_khr_int64
: enable
114 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 120)
115 #ifndef cl_khr_gl_msaa_sharing
116 #error
"Missing cl_khr_gl_msaa_sharing define"
119 // expected-warning
@+2{{unsupported OpenCL extension
'cl_khr_gl_msaa_sharing
' - ignoring
}}
121 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing
: enable
123 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 200)
124 #ifndef cl_khr_mipmap_image
125 #error
"Missing cl_khr_mipmap_image define"
128 #ifdef cl_khr_mipmap_image
129 #error
"Incorrect cl_khr_mipmap_image define"
131 // expected-warning
@+2{{unsupported OpenCL extension
'cl_khr_mipmap_image
' - ignoring
}}
133 #pragma OPENCL EXTENSION cl_khr_mipmap_image
: enable
135 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 200)
136 #ifndef cl_khr_mipmap_image_writes
137 #error
"Missing cl_khr_mipmap_image_writes define"
140 #ifdef cl_khr_mipmap_image_writes
141 #error
"Incorrect cl_khr_mipmap_image_writes define"
143 // expected-warning
@+2{{unsupported OpenCL extension
'cl_khr_mipmap_image_writes
' - ignoring
}}
145 #pragma OPENCL EXTENSION cl_khr_mipmap_image_writes
: enable
147 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 200)
148 #ifndef cl_khr_srgb_image_writes
149 #error
"Missing cl_khr_srgb_image_writes define"
152 // expected-warning
@+2{{unsupported OpenCL extension
'cl_khr_srgb_image_writes
' - ignoring
}}
154 #pragma OPENCL EXTENSION cl_khr_srgb_image_writes
: enable
156 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 200)
157 #ifndef cl_khr_subgroups
158 #error
"Missing cl_khr_subgroups define"
161 #ifdef cl_khr_subgroups
162 #error
"Incorrect cl_khr_subgroups define"
164 // expected-warning
@+2{{unsupported OpenCL extension
'cl_khr_subgroups
' - ignoring
}}
166 #pragma OPENCL EXTENSION cl_khr_subgroups
: enable
168 #ifndef cl_amd_media_ops
169 #error
"Missing cl_amd_media_ops define"
171 #pragma OPENCL EXTENSION cl_amd_media_ops
: enable
173 #ifndef cl_amd_media_ops2
174 #error
"Missing cl_amd_media_ops2 define"
176 #pragma OPENCL EXTENSION cl_amd_media_ops2
: enable
178 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 120)
179 #ifndef cl_khr_depth_images
180 #error
"Missing cl_khr_depth_images define"
183 #ifdef cl_khr_depth_images
184 #error
"Incorrect cl_khr_depth_images define"
186 // expected-warning
@+2{{unsupported OpenCL extension
'cl_khr_depth_images
' - ignoring
}}
188 #pragma OPENCL EXTENSION cl_khr_depth_images
: enable
190 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 120)
191 #ifndef cl_intel_subgroups
192 #error
"Missing cl_intel_subgroups define"
195 // expected-warning
@+2{{unsupported OpenCL extension
'cl_intel_subgroups
' - ignoring
}}
197 #pragma OPENCL EXTENSION cl_intel_subgroups
: enable
199 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 120)
200 #ifndef cl_intel_subgroups_short
201 #error
"Missing cl_intel_subgroups_short define"
204 // expected-warning
@+2{{unsupported OpenCL extension
'cl_intel_subgroups_short
' - ignoring
}}
206 #pragma OPENCL EXTENSION cl_intel_subgroups_short
: enable
208 #if
(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__
>= 120)
209 #ifndef cl_intel_device_side_avc_motion_estimation
210 #error
"Missing cl_intel_device_side_avc_motion_estimation define"
213 // expected-warning
@+2{{unsupported OpenCL extension
'cl_intel_device_side_avc_motion_estimation
' - ignoring
}}
215 #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation
: enable
217 // Check that pragmas for the OpenCL
3.0 features are rejected.
219 #pragma OPENCL EXTENSION __opencl_c_int64
: disable
220 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_int64
' unknown or does not require pragma - ignoring
}}
221 #pragma OPENCL EXTENSION __opencl_c_3d_image_writes
: disable
222 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_3d_image_writes
' unknown or does not require pragma - ignoring
}}
223 #pragma OPENCL EXTENSION __opencl_c_atomic_order_acq_rel
: disable
224 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_atomic_order_acq_rel
' unknown or does not require pragma - ignoring
}}
225 #pragma OPENCL EXTENSION __opencl_c_atomic_order_seq_cst
: disable
226 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_atomic_order_seq_cst
' unknown or does not require pragma - ignoring
}}
227 #pragma OPENCL EXTENSION __opencl_c_device_enqueue
: disable
228 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_device_enqueue
' unknown or does not require pragma - ignoring
}}
229 #pragma OPENCL EXTENSION __opencl_c_fp64
: disable
230 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_fp64
' unknown or does not require pragma - ignoring
}}
231 #pragma OPENCL EXTENSION __opencl_c_generic_address_space
: disable
232 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_generic_address_space
' unknown or does not require pragma - ignoring
}}
233 #pragma OPENCL EXTENSION __opencl_c_images
: disable
234 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_images
' unknown or does not require pragma - ignoring
}}
235 #pragma OPENCL EXTENSION __opencl_c_pipes
: disable
236 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_pipes
' unknown or does not require pragma - ignoring
}}
237 #pragma OPENCL EXTENSION __opencl_c_program_scope_global_variables
: disable
238 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_program_scope_global_variables
' unknown or does not require pragma - ignoring
}}
239 #pragma OPENCL EXTENSION __opencl_c_read_write_images
: disable
240 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_read_write_images
' unknown or does not require pragma - ignoring
}}
241 #pragma OPENCL EXTENSION __opencl_c_subgroups
: disable
242 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_subgroups
' unknown or does not require pragma - ignoring
}}
244 #pragma OPENCL EXTENSION __opencl_c_int64
: enable
245 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_int64
' unknown or does not require pragma - ignoring
}}
246 #pragma OPENCL EXTENSION __opencl_c_3d_image_writes
: enable
247 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_3d_image_writes
' unknown or does not require pragma - ignoring
}}
248 #pragma OPENCL EXTENSION __opencl_c_atomic_order_acq_rel
: enable
249 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_atomic_order_acq_rel
' unknown or does not require pragma - ignoring
}}
250 #pragma OPENCL EXTENSION __opencl_c_atomic_order_seq_cst
: enable
251 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_atomic_order_seq_cst
' unknown or does not require pragma - ignoring
}}
252 #pragma OPENCL EXTENSION __opencl_c_device_enqueue
: enable
253 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_device_enqueue
' unknown or does not require pragma - ignoring
}}
254 #pragma OPENCL EXTENSION __opencl_c_fp64
: enable
255 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_fp64
' unknown or does not require pragma - ignoring
}}
256 #pragma OPENCL EXTENSION __opencl_c_generic_address_space
: enable
257 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_generic_address_space
' unknown or does not require pragma - ignoring
}}
258 #pragma OPENCL EXTENSION __opencl_c_images
: enable
259 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_images
' unknown or does not require pragma - ignoring
}}
260 #pragma OPENCL EXTENSION __opencl_c_pipes
: enable
261 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_pipes
' unknown or does not require pragma - ignoring
}}
262 #pragma OPENCL EXTENSION __opencl_c_program_scope_global_variables
: enable
263 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_program_scope_global_variables
' unknown or does not require pragma - ignoring
}}
264 #pragma OPENCL EXTENSION __opencl_c_read_write_images
: enable
265 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_read_write_images
' unknown or does not require pragma - ignoring
}}
266 #pragma OPENCL EXTENSION __opencl_c_subgroups
: enable
267 //expected-warning
@-
1{{OpenCL extension
'__opencl_c_subgroups
' unknown or does not require pragma - ignoring
}}