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