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