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=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 9 10#if __OPENCL_C_VERSION__ >= 200 && ! defined TEST_CORE_FEATURES 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 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 (__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 (__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 (__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 (__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 (__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#if (__OPENCL_C_VERSION__ < 110) 88// Deprecated abvoe 1.0 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 93#endif 94 95 96// Core feature in CL 1.2 97#ifndef cl_khr_fp64 98#error "Missing cl_khr_fp64 define" 99#endif 100#pragma OPENCL EXTENSION cl_khr_fp64: enable 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}} 103#endif 104 105//Core feature in CL 2.0 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 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}} 112#endif 113 114 115 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) 225#ifndef cl_khr_srgb_image_writes 226#error "Missing cl_khr_srgb_image_writes define" 227#endif 228#else 229// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} 230#endif 231#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable 232 233#if (__OPENCL_C_VERSION__ >= 200) 234#ifndef cl_khr_subgroups 235#error "Missing cl_khr_subgroups define" 236#endif 237#else 238// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} 239#endif 240#pragma OPENCL EXTENSION cl_khr_subgroups: enable 241 242#if (__OPENCL_C_VERSION__ >= 200) 243#ifndef cl_khr_terminate_context 244#error "Missing cl_khr_terminate_context define" 245#endif 246#else 247// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_terminate_context' - ignoring}} 248#endif 249#pragma OPENCL EXTENSION cl_khr_terminate_context: enable 250