| 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 |
| 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_clang_function_pointers |
| 21 |
#error "Missing __cl_clang_function_pointers define" |
| 22 |
#endif |
| 23 |
#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable |
| 24 |
|
| 25 |
#ifndef __cl_clang_variadic_functions |
| 26 |
#error "Missing __cl_clang_variadic_functions define" |
| 27 |
#endif |
| 28 |
#pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable |
| 29 |
|
| 30 |
#ifndef cl_khr_fp16 |
| 31 |
#error "Missing cl_khr_fp16 define" |
| 32 |
#endif |
| 33 |
#pragma OPENCL EXTENSION cl_khr_fp16: enable |
| 34 |
|
| 35 |
#ifndef cl_khr_int64_base_atomics |
| 36 |
#error "Missing cl_khr_int64_base_atomics define" |
| 37 |
#endif |
| 38 |
#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable |
| 39 |
|
| 40 |
#ifndef cl_khr_int64_extended_atomics |
| 41 |
#error "Missing cl_khr_int64_extended_atomics define" |
| 42 |
#endif |
| 43 |
#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable |
| 44 |
|
| 45 |
// Core features in CL 1.1 |
| 46 |
|
| 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 |
| 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}} |
| 53 |
#endif |
| 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 |
| 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}} |
| 61 |
#endif |
| 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 |
| 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}} |
| 69 |
#endif |
| 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 |
| 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}} |
| 77 |
#endif |
| 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 |
| 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}} |
| 85 |
#endif |
| 86 |
|
| 87 |
// Core feature in CL 1.2 |
| 88 |
#ifndef cl_khr_fp64 |
| 89 |
#error "Missing cl_khr_fp64 define" |
| 90 |
#endif |
| 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}} |
| 94 |
#endif |
| 95 |
|
| 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" |
| 99 |
#endif |
| 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}} |
| 103 |
#endif |
| 104 |
|
| 105 |
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) |
| 106 |
#ifndef cles_khr_int64 |
| 107 |
#error "Missing cles_khr_int64 define" |
| 108 |
#endif |
| 109 |
#else |
| 110 |
// expected-warning@+2{{unsupported OpenCL extension 'cles_khr_int64' - ignoring}} |
| 111 |
#endif |
| 112 |
#pragma OPENCL EXTENSION cles_khr_int64 : enable |
| 113 |
|
| 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" |
| 117 |
#endif |
| 118 |
#else |
| 119 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}} |
| 120 |
#endif |
| 121 |
#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable |
| 122 |
|
| 123 |
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
| 124 |
#ifndef cl_khr_mipmap_image |
| 125 |
#error "Missing cl_khr_mipmap_image define" |
| 126 |
#endif |
| 127 |
#else |
| 128 |
#ifdef cl_khr_mipmap_image |
| 129 |
#error "Incorrect cl_khr_mipmap_image define" |
| 130 |
#endif |
| 131 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}} |
| 132 |
#endif |
| 133 |
#pragma OPENCL EXTENSION cl_khr_mipmap_image : enable |
| 134 |
|
| 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" |
| 138 |
#endif |
| 139 |
#else |
| 140 |
#ifdef cl_khr_mipmap_image_writes |
| 141 |
#error "Incorrect cl_khr_mipmap_image_writes define" |
| 142 |
#endif |
| 143 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image_writes' - ignoring}} |
| 144 |
#endif |
| 145 |
#pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : enable |
| 146 |
|
| 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" |
| 150 |
#endif |
| 151 |
#else |
| 152 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} |
| 153 |
#endif |
| 154 |
#pragma OPENCL EXTENSION cl_khr_srgb_image_writes : enable |
| 155 |
|
| 156 |
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) |
| 157 |
#ifndef cl_khr_subgroups |
| 158 |
#error "Missing cl_khr_subgroups define" |
| 159 |
#endif |
| 160 |
#else |
| 161 |
#ifdef cl_khr_subgroups |
| 162 |
#error "Incorrect cl_khr_subgroups define" |
| 163 |
#endif |
| 164 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} |
| 165 |
#endif |
| 166 |
#pragma OPENCL EXTENSION cl_khr_subgroups : enable |
| 167 |
|
| 168 |
#ifndef cl_amd_media_ops |
| 169 |
#error "Missing cl_amd_media_ops define" |
| 170 |
#endif |
| 171 |
#pragma OPENCL EXTENSION cl_amd_media_ops: enable |
| 172 |
|
| 173 |
#ifndef cl_amd_media_ops2 |
| 174 |
#error "Missing cl_amd_media_ops2 define" |
| 175 |
#endif |
| 176 |
#pragma OPENCL EXTENSION cl_amd_media_ops2 : enable |
| 177 |
|
| 178 |
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
| 179 |
#ifndef cl_khr_depth_images |
| 180 |
#error "Missing cl_khr_depth_images define" |
| 181 |
#endif |
| 182 |
#else |
| 183 |
#ifdef cl_khr_depth_images |
| 184 |
#error "Incorrect cl_khr_depth_images define" |
| 185 |
#endif |
| 186 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_depth_images' - ignoring}} |
| 187 |
#endif |
| 188 |
#pragma OPENCL EXTENSION cl_khr_depth_images : enable |
| 189 |
|
| 190 |
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
| 191 |
#ifndef cl_intel_subgroups |
| 192 |
#error "Missing cl_intel_subgroups define" |
| 193 |
#endif |
| 194 |
#else |
| 195 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups' - ignoring}} |
| 196 |
#endif |
| 197 |
#pragma OPENCL EXTENSION cl_intel_subgroups : enable |
| 198 |
|
| 199 |
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) |
| 200 |
#ifndef cl_intel_subgroups_short |
| 201 |
#error "Missing cl_intel_subgroups_short define" |
| 202 |
#endif |
| 203 |
#else |
| 204 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups_short' - ignoring}} |
| 205 |
#endif |
| 206 |
#pragma OPENCL EXTENSION cl_intel_subgroups_short : enable |
| 207 |
|
| 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" |
| 211 |
#endif |
| 212 |
#else |
| 213 |
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_device_side_avc_motion_estimation' - ignoring}} |
| 214 |
#endif |
| 215 |
#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable |
| 216 |
|
| 217 |
// Check that pragmas for the OpenCL 3.0 features are rejected. |
| 218 |
|
| 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}} |
| 243 |
|
| 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}} |