Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions clang/lib/Headers/opencl-c-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
#define __opencl_c_read_write_images 1
#endif // defined(__SPIR__)

#endif // (__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300)

// Undefine any feature macros that have been explicitly disabled using
// an __undef_<feature> macro.
#ifdef __undef___opencl_c_work_group_collective_functions
Expand All @@ -99,8 +101,12 @@
#ifdef __undef___opencl_c_read_write_images
#undef __opencl_c_read_write_images
#endif

#endif // (__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300)
#ifdef __undef___opencl_c_integer_dot_product_input_4x8bit
#undef __opencl_c_integer_dot_product_input_4x8bit
#endif
#ifdef __undef___opencl_c_integer_dot_product_input_4x8bit_packed
#undef __opencl_c_integer_dot_product_input_4x8bit_packed
#endif

#if !defined(__opencl_c_generic_address_space)
// Internal feature macro to provide named (global, local, private) address
Expand Down
9 changes: 9 additions & 0 deletions clang/test/SemaOpenCL/features.cl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=clc++1.0 \
// RUN: | FileCheck -match-full-lines %s --check-prefix=NO-FEATURES

// For OpenCL C 2.0, header-only features can be disabled using macros.
// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header \
// RUN: -D__undef___opencl_c_integer_dot_product_input_4x8bit \
// RUN: -D__undef___opencl_c_integer_dot_product_input_4x8bit_packed \
// RUN: | FileCheck %s --check-prefix=NO-HEADERONLY-FEATURES-CL20

// For OpenCL C 3.0, header-only features can be disabled using macros.
// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL3.0 -fdeclare-opencl-builtins -finclude-default-header \
// RUN: -D__undef___opencl_c_work_group_collective_functions=1 \
Expand Down Expand Up @@ -64,6 +70,9 @@
// NO-FEATURES-NOT: #define __opencl_c_read_write_images
// NO-FEATURES-NOT: #define __opencl_c_subgroups

// NO-HEADERONLY-FEATURES-CL20-NOT: #define __opencl_c_integer_dot_product_input_4x8bit
// NO-HEADERONLY-FEATURES-CL20-NOT: #define __opencl_c_integer_dot_product_input_4x8bit_packed

// NO-HEADERONLY-FEATURES-NOT: #define __opencl_c_work_group_collective_functions
// NO-HEADERONLY-FEATURES-NOT: #define __opencl_c_atomic_order_seq_cst
// NO-HEADERONLY-FEATURES-NOT: #define __opencl_c_atomic_scope_device
Expand Down