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