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 |
| 5 | |
| 6 | #if __OPENCL_C_VERSION__ >= 200 |
| 7 | // expected-no-diagnostics |
| 8 | #endif |
| 9 | |
| 10 | // Extensions in all versions |
| 11 | #ifndef cl_clang_storage_class_specifiers |
| 12 | #error "Missing cl_clang_storage_class_specifiers define" |
| 13 | #endif |
| 14 | #pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable |
| 15 | |
| 16 | #ifndef cl_khr_fp16 |
| 17 | #error "Missing cl_khr_fp16 define" |
| 18 | #endif |
| 19 | #pragma OPENCL EXTENSION cl_khr_fp16: enable |
| 20 | |
| 21 | #ifndef cl_khr_int64_base_atomics |
| 22 | #error "Missing cl_khr_int64_base_atomics define" |
| 23 | #endif |
| 24 | #pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable |
| 25 | |
| 26 | #ifndef cl_khr_int64_extended_atomics |
| 27 | #error "Missing cl_khr_int64_extended_atomics define" |
| 28 | #endif |
| 29 | #pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable |
| 30 | |
| 31 | #ifndef cl_khr_gl_sharing |
| 32 | #error "Missing cl_khr_gl_sharing define" |
| 33 | #endif |
| 34 | #pragma OPENCL EXTENSION cl_khr_gl_sharing: enable |
| 35 | |
| 36 | #ifndef cl_khr_icd |
| 37 | #error "Missing cl_khr_icd define" |
| 38 | #endif |
| 39 | #pragma OPENCL EXTENSION cl_khr_icd: enable |
| 40 | |
| 41 | // Core features in CL 1.1 |
| 42 | #if (__OPENCL_C_VERSION__ < 110) |
| 43 | #ifndef cl_khr_byte_addressable_store |
| 44 | #error "Missing cl_khr_byte_addressable_store define" |
| 45 | #endif |
| 46 | #pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable |
| 47 | |
| 48 | #ifndef cl_khr_global_int32_base_atomics |
| 49 | #error "Missing cl_khr_global_int32_base_atomics define" |
| 50 | #endif |
| 51 | #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable |
| 52 | |
| 53 | #ifndef cl_khr_global_int32_extended_atomics |
| 54 | #error "Missing cl_khr_global_int32_extended_atomics define" |
| 55 | #endif |
| 56 | #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable |
| 57 | |
| 58 | #ifndef cl_khr_local_int32_base_atomics |
| 59 | #error "Missing cl_khr_local_int32_base_atomics define" |
| 60 | #endif |
| 61 | #pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable |
| 62 | |
| 63 | #ifndef cl_khr_local_int32_extended_atomics |
| 64 | #error "Missing cl_khr_local_int32_extended_atomics define" |
| 65 | #endif |
| 66 | #pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable |
| 67 | |
| 68 | #ifndef cl_khr_select_fprounding_mode |
| 69 | #error "Missing cl_khr_select_fp_rounding_mode define" |
| 70 | #endif |
| 71 | #pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable |
| 72 | |
| 73 | #endif |
| 74 | |
| 75 | // Core feature in CL 1.2 |
| 76 | #if (__OPENCL_C_VERSION__ < 120) |
| 77 | #ifndef cl_khr_fp64 |
| 78 | #error "Missing cl_khr_fp64 define" |
| 79 | #endif |
| 80 | #pragma OPENCL EXTENSION cl_khr_fp64: enable |
| 81 | #endif |
| 82 | |
| 83 | //Core feature in CL 2.0 |
| 84 | #if (__OPENCL_C_VERSION__ < 200) |
| 85 | #ifndef cl_khr_3d_image_writes |
| 86 | #error "Missing cl_khr_3d_image_writes define" |
| 87 | #endif |
| 88 | #pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable |
| 89 | #endif |
| 90 | |
| 91 | |
| 92 | #if (__OPENCL_C_VERSION__ >= 110) |
| 93 | #ifndef cl_khr_gl_event |
| 94 | #error "Missing cl_khr_gl_event define" |
| 95 | #endif |
| 96 | #else |
| 97 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}} |
| 98 | #endif |
| 99 | #pragma OPENCL EXTENSION cl_khr_gl_event: enable |
| 100 | |
| 101 | #if (__OPENCL_C_VERSION__ >= 110) |
| 102 | #ifndef cl_khr_d3d10_sharing |
| 103 | #error "Missing cl_khr_d3d10_sharing define" |
| 104 | #endif |
| 105 | #else |
| 106 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}} |
| 107 | #endif |
| 108 | #pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable |
| 109 | |
| 110 | #if (__OPENCL_C_VERSION__ >= 120) |
| 111 | #ifndef cl_khr_context_abort |
| 112 | #error "Missing cl_context_abort define" |
| 113 | #endif |
| 114 | #else |
| 115 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}} |
| 116 | #endif |
| 117 | #pragma OPENCL EXTENSION cl_khr_context_abort: enable |
| 118 | |
| 119 | #if (__OPENCL_C_VERSION__ >= 120) |
| 120 | #ifndef cl_khr_d3d11_sharing |
| 121 | #error "Missing cl_khr_d3d11_sharing define" |
| 122 | #endif |
| 123 | #else |
| 124 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}} |
| 125 | #endif |
| 126 | #pragma OPENCL EXTENSION cl_khr_d3d11_sharing: enable |
| 127 | |
| 128 | #if (__OPENCL_C_VERSION__ >= 120) |
| 129 | #ifndef cl_khr_dx9_media_sharing |
| 130 | #error "Missing cl_khr_dx9_media_sharing define" |
| 131 | #endif |
| 132 | #else |
| 133 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}} |
| 134 | #endif |
| 135 | #pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable |
| 136 | |
| 137 | #if (__OPENCL_C_VERSION__ >= 120) |
| 138 | #ifndef cl_khr_image2d_from_buffer |
| 139 | #error "Missing cl_khr_image2d_from_buffer define" |
| 140 | #endif |
| 141 | #else |
| 142 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}} |
| 143 | #endif |
| 144 | #pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable |
| 145 | |
| 146 | #if (__OPENCL_C_VERSION__ >= 120) |
| 147 | #ifndef cl_khr_initialize_memory |
| 148 | #error "Missing cl_khr_initialize_memory define" |
| 149 | #endif |
| 150 | #else |
| 151 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_initialize_memory' - ignoring}} |
| 152 | #endif |
| 153 | #pragma OPENCL EXTENSION cl_khr_initialize_memory: enable |
| 154 | |
| 155 | #if (__OPENCL_C_VERSION__ >= 120) |
| 156 | #ifndef cl_khr_gl_depth_images |
| 157 | #error "Missing cl_khr_gl_depth_images define" |
| 158 | #endif |
| 159 | #else |
| 160 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_depth_images' - ignoring}} |
| 161 | #endif |
| 162 | #pragma OPENCL EXTENSION cl_khr_gl_depth_images: enable |
| 163 | |
| 164 | #if (__OPENCL_C_VERSION__ >= 120) |
| 165 | #ifndef cl_khr_gl_msaa_sharing |
| 166 | #error "Missing cl_khr_gl_msaa_sharing define" |
| 167 | #endif |
| 168 | #else |
| 169 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}} |
| 170 | #endif |
| 171 | #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable |
| 172 | |
| 173 | #if (__OPENCL_C_VERSION__ >= 120) |
| 174 | #ifndef cl_khr_spir |
| 175 | #error "Missing cl_khr_spir define" |
| 176 | #endif |
| 177 | #else |
| 178 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_spir' - ignoring}} |
| 179 | #endif |
| 180 | #pragma OPENCL EXTENSION cl_khr_spir: enable |
| 181 | |
| 182 | #if (__OPENCL_C_VERSION__ >= 200) |
| 183 | #ifndef cl_khr_egl_event |
| 184 | #error "Missing cl_khr_egl_event define" |
| 185 | #endif |
| 186 | #else |
| 187 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_egl_event' - ignoring}} |
| 188 | #endif |
| 189 | #pragma OPENCL EXTENSION cl_khr_egl_event: enable |
| 190 | |
| 191 | #if (__OPENCL_C_VERSION__ >= 200) |
| 192 | #ifndef cl_khr_egl_image |
| 193 | #error "Missing cl_khr_egl_image define" |
| 194 | #endif |
| 195 | #else |
| 196 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_egl_image' - ignoring}} |
| 197 | #endif |
| 198 | #pragma OPENCL EXTENSION cl_khr_egl_image: enable |
| 199 | |
| 200 | #if (__OPENCL_C_VERSION__ >= 200) |
| 201 | #ifndef cl_khr_srgb_image_writes |
| 202 | #error "Missing cl_khr_srgb_image_writes define" |
| 203 | #endif |
| 204 | #else |
| 205 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} |
| 206 | #endif |
| 207 | #pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable |
| 208 | |
| 209 | #if (__OPENCL_C_VERSION__ >= 200) |
| 210 | #ifndef cl_khr_subgroups |
| 211 | #error "Missing cl_khr_subgroups define" |
| 212 | #endif |
| 213 | #else |
| 214 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} |
| 215 | #endif |
| 216 | #pragma OPENCL EXTENSION cl_khr_subgroups: enable |
| 217 | |
| 218 | #if (__OPENCL_C_VERSION__ >= 200) |
| 219 | #ifndef cl_khr_terminate_context |
| 220 | #error "Missing cl_khr_terminate_context define" |
| 221 | #endif |
| 222 | #else |
| 223 | // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_terminate_context' - ignoring}} |
| 224 | #endif |
| 225 | #pragma OPENCL EXTENSION cl_khr_terminate_context: enable |