xref: /llvm-project/clang/test/Misc/nvptx.languageOptsOpenCL.cl (revision 237c6924bd46ec0e33da71f9616caf9bf9965b23)
19674bd4fSJan Vesely// REQUIRES: nvptx-registered-target
29674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
39674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
49674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
59674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
69674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
79674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
89674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
99674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown
109674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown
119674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
129674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
139674bd4fSJan Vesely// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
149674bd4fSJan Vesely
159674bd4fSJan Vesely// Extensions in all versions
169674bd4fSJan Vesely#ifndef cl_clang_storage_class_specifiers
179674bd4fSJan Vesely#error "Missing cl_clang_storage_class_specifiers define"
189674bd4fSJan Vesely#endif
199674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
204fde2b6aSAnastasia Stulova
214fde2b6aSAnastasia Stulova#ifndef __cl_clang_function_pointers
224fde2b6aSAnastasia Stulova#error "Missing __cl_clang_function_pointers define"
234fde2b6aSAnastasia Stulova#endif
244fde2b6aSAnastasia Stulova#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable
259674bd4fSJan Vesely
260e874fc0SAnastasia Stulova#ifndef __cl_clang_variadic_functions
270e874fc0SAnastasia Stulova#error "Missing __cl_clang_variadic_functions define"
280e874fc0SAnastasia Stulova#endif
290e874fc0SAnastasia Stulova#pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable
300e874fc0SAnastasia Stulova
31e994e74bSAnastasia Stulova#ifndef __cl_clang_non_portable_kernel_param_types
32e994e74bSAnastasia Stulova#error "Missing __cl_clang_non_portable_kernel_param_types define"
33e994e74bSAnastasia Stulova#endif
34e994e74bSAnastasia Stulova#pragma OPENCL EXTENSION __cl_clang_non_portable_kernel_param_types : enable
35e994e74bSAnastasia Stulova
36*237c6924SAnastasia Stulova#ifndef __cl_clang_bitfields
37*237c6924SAnastasia Stulova#error "Missing __cl_clang_bitfields define"
38*237c6924SAnastasia Stulova#endif
39*237c6924SAnastasia Stulova#pragma OPENCL EXTENSION __cl_clang_bitfields : enable
40*237c6924SAnastasia Stulova
419674bd4fSJan Vesely#ifdef cl_khr_fp16
429674bd4fSJan Vesely#error "Incorrect cl_khr_fp16 define"
439674bd4fSJan Vesely#endif
449674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_fp16: enable
459674bd4fSJan Vesely// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_fp16' - ignoring}}
469674bd4fSJan Vesely
479674bd4fSJan Vesely#ifdef cl_khr_int64_base_atomics
489674bd4fSJan Vesely#error "Incorrect cl_khr_int64_base_atomics define"
499674bd4fSJan Vesely#endif
509674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
519674bd4fSJan Vesely// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_base_atomics' - ignoring}}
529674bd4fSJan Vesely
539674bd4fSJan Vesely#ifdef cl_khr_int64_extended_atomics
549674bd4fSJan Vesely#error "Incorrect cl_khr_int64_extended_atomics define"
559674bd4fSJan Vesely#endif
569674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
579674bd4fSJan Vesely// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_extended_atomics' - ignoring}}
589674bd4fSJan Vesely
599674bd4fSJan Vesely// Core features in CL 1.1
609674bd4fSJan Vesely
619674bd4fSJan Vesely#ifndef cl_khr_byte_addressable_store
629674bd4fSJan Vesely#error "Missing cl_khr_byte_addressable_store define"
639674bd4fSJan Vesely#endif
649674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
659674bd4fSJan Vesely#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
669674bd4fSJan Vesely// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}}
679674bd4fSJan Vesely#endif
689674bd4fSJan Vesely
699674bd4fSJan Vesely#ifndef cl_khr_global_int32_base_atomics
709674bd4fSJan Vesely#error "Missing cl_khr_global_int32_base_atomics define"
719674bd4fSJan Vesely#endif
729674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
739674bd4fSJan Vesely#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
749674bd4fSJan Vesely// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
759674bd4fSJan Vesely#endif
769674bd4fSJan Vesely
779674bd4fSJan Vesely#ifndef cl_khr_global_int32_extended_atomics
789674bd4fSJan Vesely#error "Missing cl_khr_global_int32_extended_atomics define"
799674bd4fSJan Vesely#endif
809674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
819674bd4fSJan Vesely#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
829674bd4fSJan Vesely// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
839674bd4fSJan Vesely#endif
849674bd4fSJan Vesely
859674bd4fSJan Vesely#ifndef cl_khr_local_int32_base_atomics
869674bd4fSJan Vesely#error "Missing cl_khr_local_int32_base_atomics define"
879674bd4fSJan Vesely#endif
889674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
899674bd4fSJan Vesely#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
909674bd4fSJan Vesely// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
919674bd4fSJan Vesely#endif
929674bd4fSJan Vesely
939674bd4fSJan Vesely#ifndef cl_khr_local_int32_extended_atomics
949674bd4fSJan Vesely#error "Missing cl_khr_local_int32_extended_atomics define"
959674bd4fSJan Vesely#endif
969674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
979674bd4fSJan Vesely#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
989674bd4fSJan Vesely// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
999674bd4fSJan Vesely#endif
1009674bd4fSJan Vesely
1019674bd4fSJan Vesely// Core feature in CL 1.2
1029674bd4fSJan Vesely#ifndef cl_khr_fp64
1039674bd4fSJan Vesely#error "Missing cl_khr_fp64 define"
1049674bd4fSJan Vesely#endif
1059674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_fp64: enable
1069674bd4fSJan Vesely#if (__OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES
1079674bd4fSJan Vesely// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}}
1089674bd4fSJan Vesely#endif
1099674bd4fSJan Vesely
1109674bd4fSJan Vesely// Core feature in CL 2.0, but not supported on nvptx
1119674bd4fSJan Vesely#ifdef cl_khr_3d_image_writes
1129674bd4fSJan Vesely#error "Incorrect cl_khr_3d_image_writes define"
1139674bd4fSJan Vesely#endif
1149674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
1159674bd4fSJan Vesely// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_3d_image_writes' - ignoring}}
1169674bd4fSJan Vesely
1179674bd4fSJan Vesely#ifdef cl_khr_gl_msaa_sharing
1189674bd4fSJan Vesely#error "Incorrect cl_khr_gl_msaa_sharing define"
1199674bd4fSJan Vesely#endif
1209674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
1219674bd4fSJan Vesely// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}}
1229674bd4fSJan Vesely
1239674bd4fSJan Vesely#ifdef cl_khr_srgb_image_writes
1249674bd4fSJan Vesely#error "Incorrect cl_khr_srgb_image_writes define"
1259674bd4fSJan Vesely#endif
1269674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable
1279674bd4fSJan Vesely// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}}
1289674bd4fSJan Vesely
1299674bd4fSJan Vesely#ifdef cl_khr_subgroups
1309674bd4fSJan Vesely#error "Incorrect cl_khr_subgroups define"
1319674bd4fSJan Vesely#endif
1329674bd4fSJan Vesely#pragma OPENCL EXTENSION cl_khr_subgroups: enable
1339674bd4fSJan Vesely// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}}
1349674bd4fSJan Vesely
135