1// REQUIRES: amdgpu-registered-target 2// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple amdgcn-unknown-unknown 3// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple amdgcn-unknown-unknown 4// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple amdgcn-unknown-unknown 5// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple amdgcn-unknown-unknown 6// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES 7// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES 8// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES 9// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES 10 11// Extensions in all versions 12#ifndef cl_clang_storage_class_specifiers 13#error "Missing cl_clang_storage_class_specifiers define" 14#endif 15#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable 16 17#ifndef cl_khr_fp16 18#error "Missing cl_khr_fp16 define" 19#endif 20#pragma OPENCL EXTENSION cl_khr_fp16: enable 21 22#ifndef cl_khr_int64_base_atomics 23#error "Missing cl_khr_int64_base_atomics define" 24#endif 25#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable 26 27#ifndef cl_khr_int64_extended_atomics 28#error "Missing cl_khr_int64_extended_atomics define" 29#endif 30#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable 31 32// Core features in CL 1.1 33 34#ifndef cl_khr_byte_addressable_store 35#error "Missing cl_khr_byte_addressable_store define" 36#endif 37#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable 38#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 39// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}} 40#endif 41 42#ifndef cl_khr_global_int32_base_atomics 43#error "Missing cl_khr_global_int32_base_atomics define" 44#endif 45#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable 46#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 47// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}} 48#endif 49 50#ifndef cl_khr_global_int32_extended_atomics 51#error "Missing cl_khr_global_int32_extended_atomics define" 52#endif 53#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable 54#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 55// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} 56#endif 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#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 63// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}} 64#endif 65 66#ifndef cl_khr_local_int32_extended_atomics 67#error "Missing cl_khr_local_int32_extended_atomics define" 68#endif 69#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable 70#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 71// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} 72#endif 73 74// Core feature in CL 1.2 75#ifndef cl_khr_fp64 76#error "Missing cl_khr_fp64 define" 77#endif 78#pragma OPENCL EXTENSION cl_khr_fp64: enable 79#if (__OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES 80// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} 81#endif 82 83//Core feature in CL 2.0 84#ifndef cl_khr_3d_image_writes 85#error "Missing cl_khr_3d_image_writes define" 86#endif 87#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable 88#if (__OPENCL_C_VERSION__ >= 200) && defined TEST_CORE_FEATURES 89// expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}} 90#endif 91 92#ifdef cl_khr_gl_msaa_sharing 93#error "Incorrect cl_khr_gl_msaa_sharing define" 94#endif 95#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable 96// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}} 97 98#if (__OPENCL_C_VERSION__ >= 200) 99#ifndef cl_khr_mipmap_image 100#error "Missing cl_khr_mipmap_image define" 101#endif 102#else 103#ifdef cl_khr_mipmap_image 104#error "Incorrect cl_khr_mipmap_image define" 105#endif 106// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}} 107#endif 108#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable 109 110#ifdef cl_khr_srgb_image_writes 111#error "Incorrect cl_khr_srgb_image_writes define" 112#endif 113#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable 114// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} 115 116#if (__OPENCL_C_VERSION__ >= 200) 117#ifndef cl_khr_subgroups 118#error "Missing cl_khr_subgroups define" 119#endif 120#else 121#ifdef cl_khr_subgroups 122#error "Incorrect cl_khr_subgroups define" 123#endif 124// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} 125#endif 126#pragma OPENCL EXTENSION cl_khr_subgroups: enable 127 128#ifndef cl_amd_media_ops 129#error "Missing cl_amd_media_ops define" 130#endif 131#pragma OPENCL EXTENSION cl_amd_media_ops: enable 132 133#ifndef cl_amd_media_ops2 134#error "Missing cl_amd_media_ops2 define" 135#endif 136#pragma OPENCL EXTENSION cl_amd_media_ops2: enable 137 138