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// Core features in CL 1.1 44 45#ifndef cl_khr_byte_addressable_store 46#error "Missing cl_khr_byte_addressable_store define" 47#endif 48#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable 49#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 50// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}} 51#endif 52 53#ifndef cl_khr_global_int32_base_atomics 54#error "Missing cl_khr_global_int32_base_atomics define" 55#endif 56#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable 57#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 58// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}} 59#endif 60 61#ifndef cl_khr_global_int32_extended_atomics 62#error "Missing cl_khr_global_int32_extended_atomics define" 63#endif 64#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable 65#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 66// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} 67#endif 68 69#ifndef cl_khr_local_int32_base_atomics 70#error "Missing cl_khr_local_int32_base_atomics define" 71#endif 72#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable 73#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 74// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}} 75#endif 76 77#ifndef cl_khr_local_int32_extended_atomics 78#error "Missing cl_khr_local_int32_extended_atomics define" 79#endif 80#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable 81#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES 82// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} 83#endif 84 85// Core feature in CL 1.2 86#ifndef cl_khr_fp64 87#error "Missing cl_khr_fp64 define" 88#endif 89#pragma OPENCL EXTENSION cl_khr_fp64: enable 90#if (__OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES 91// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} 92#endif 93 94// Core feature in CL 2.0, but not supported on nvptx 95#ifdef cl_khr_3d_image_writes 96#error "Incorrect cl_khr_3d_image_writes define" 97#endif 98#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable 99// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_3d_image_writes' - ignoring}} 100 101#ifdef cl_khr_gl_msaa_sharing 102#error "Incorrect cl_khr_gl_msaa_sharing define" 103#endif 104#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable 105// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}} 106 107#ifdef cl_khr_srgb_image_writes 108#error "Incorrect cl_khr_srgb_image_writes define" 109#endif 110#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable 111// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} 112 113#ifdef cl_khr_subgroups 114#error "Incorrect cl_khr_subgroups define" 115#endif 116#pragma OPENCL EXTENSION cl_khr_subgroups: enable 117// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} 118 119