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_clang_function_pointers 18#error "Missing __cl_clang_function_pointers define" 19#endif 20#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable 21 22#ifndef __cl_clang_variadic_functions 23#error "Missing __cl_clang_variadic_functions define" 24#endif 25#pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable 26 27#ifndef __cl_clang_non_portable_kernel_param_types 28#error "Missing __cl_clang_non_portable_kernel_param_types define" 29#endif 30#pragma OPENCL EXTENSION __cl_clang_non_portable_kernel_param_types : enable 31 32#ifndef __cl_clang_bitfields 33#error "Missing __cl_clang_bitfields define" 34#endif 35#pragma OPENCL EXTENSION __cl_clang_bitfields : enable 36 37#ifndef cl_khr_fp16 38#error "Missing cl_khr_fp16 define" 39#endif 40#pragma OPENCL EXTENSION cl_khr_fp16: enable 41 42#ifndef cl_khr_int64_base_atomics 43#error "Missing cl_khr_int64_base_atomics define" 44#endif 45#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable 46 47#ifndef cl_khr_int64_extended_atomics 48#error "Missing cl_khr_int64_extended_atomics define" 49#endif 50#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable 51 52// Core features in CL 1.1 53 54#ifndef cl_khr_byte_addressable_store 55#error "Missing cl_khr_byte_addressable_store define" 56#endif 57#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable 58#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 59// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}} 60#endif 61 62#ifndef cl_khr_global_int32_base_atomics 63#error "Missing cl_khr_global_int32_base_atomics define" 64#endif 65#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable 66#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 67// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}} 68#endif 69 70#ifndef cl_khr_global_int32_extended_atomics 71#error "Missing cl_khr_global_int32_extended_atomics define" 72#endif 73#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable 74#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 75// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} 76#endif 77 78#ifndef cl_khr_local_int32_base_atomics 79#error "Missing cl_khr_local_int32_base_atomics define" 80#endif 81#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable 82#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 83// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}} 84#endif 85 86#ifndef cl_khr_local_int32_extended_atomics 87#error "Missing cl_khr_local_int32_extended_atomics define" 88#endif 89#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable 90#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 91// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} 92#endif 93 94// Core feature in CL 1.2 95#ifndef cl_khr_fp64 96#error "Missing cl_khr_fp64 define" 97#endif 98#pragma OPENCL EXTENSION cl_khr_fp64: enable 99#if (__OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES 100// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} 101#endif 102 103//Core feature in CL 2.0 104#ifndef cl_khr_3d_image_writes 105#error "Missing cl_khr_3d_image_writes define" 106#endif 107#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable 108#if (__OPENCL_C_VERSION__ >= 200) && defined TEST_CORE_FEATURES 109// expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}} 110#endif 111 112#ifdef cl_khr_gl_msaa_sharing 113#error "Incorrect cl_khr_gl_msaa_sharing define" 114#endif 115#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable 116// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}} 117 118#if (__OPENCL_C_VERSION__ >= 200) 119#ifndef cl_khr_mipmap_image 120#error "Missing cl_khr_mipmap_image define" 121#endif 122#else 123#ifdef cl_khr_mipmap_image 124#error "Incorrect cl_khr_mipmap_image define" 125#endif 126// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}} 127#endif 128#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable 129 130#ifdef cl_khr_srgb_image_writes 131#error "Incorrect cl_khr_srgb_image_writes define" 132#endif 133#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable 134// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} 135 136#if (__OPENCL_C_VERSION__ >= 200) 137#ifndef cl_khr_subgroups 138#error "Missing cl_khr_subgroups define" 139#endif 140#else 141#ifdef cl_khr_subgroups 142#error "Incorrect cl_khr_subgroups define" 143#endif 144// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} 145#endif 146#pragma OPENCL EXTENSION cl_khr_subgroups: enable 147 148#ifndef cl_amd_media_ops 149#error "Missing cl_amd_media_ops define" 150#endif 151#pragma OPENCL EXTENSION cl_amd_media_ops: enable 152 153#ifndef cl_amd_media_ops2 154#error "Missing cl_amd_media_ops2 define" 155#endif 156#pragma OPENCL EXTENSION cl_amd_media_ops2: enable 157 158