Author: Kevin Petit Date: 2021-03-30T16:17:46+01:00 New Revision: 9d25ce743a95a9ad03c0a4b3a705f85c2de52398
URL: https://github.com/llvm/llvm-project/commit/9d25ce743a95a9ad03c0a4b3a705f85c2de52398 DIFF: https://github.com/llvm/llvm-project/commit/9d25ce743a95a9ad03c0a4b3a705f85c2de52398.diff LOG: [OpenCL] Fix parsing of opencl-c.h in CL 3.0 Ensure that the cl_khr_3d_image_writes pragma is enabled by making cl_khr_3d_image_writes an optional core feature in CL 3.0 in addition to being an available extension in 1.0 onwards and a core feature in CL 2.0. https://reviews.llvm.org/D99425 Signed-off-by: Kevin Petit <kevin.pe...@arm.com> Added: Modified: clang/include/clang/Basic/OpenCLExtensions.def clang/test/Headers/opencl-c-header.cl clang/test/SemaOpenCL/extension-version.cl Removed: ################################################################################ diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def index c5352dadc0de..5e2977f478f3 100644 --- a/clang/include/clang/Basic/OpenCLExtensions.def +++ b/clang/include/clang/Basic/OpenCLExtensions.def @@ -68,7 +68,7 @@ OPENCL_OPTIONALCOREFEATURE(cl_khr_fp64, true, 100, OCL_C_12P) OPENCL_EXTENSION(cl_khr_fp16, true, 100) OPENCL_EXTENSION(cl_khr_int64_base_atomics, true, 100) OPENCL_EXTENSION(cl_khr_int64_extended_atomics, true, 100) -OPENCL_COREFEATURE(cl_khr_3d_image_writes, true, 100, OCL_C_20) +OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30) // EMBEDDED_PROFILE OPENCL_EXTENSION(cles_khr_int64, true, 110) diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl index 432c5e461d55..f72cea61fcd9 100644 --- a/clang/test/Headers/opencl-c-header.cl +++ b/clang/test/Headers/opencl-c-header.cl @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL1.1 | FileCheck %s // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL1.2 | FileCheck %s // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=clc++ | FileCheck %s --check-prefix=CHECK20 +// RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL3.0 | FileCheck %s // Test including the default header as a module. // The module should be compiled only once and loaded from cache afterwards. @@ -81,7 +82,7 @@ void test_atomics(__generic volatile unsigned int* a) { #endif // Verify that ATOMIC_VAR_INIT is defined. -#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) +#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0) global atomic_int z = ATOMIC_VAR_INIT(99); #endif //__OPENCL_C_VERSION__ // CHECK-MOD: Reading modules diff --git a/clang/test/SemaOpenCL/extension-version.cl b/clang/test/SemaOpenCL/extension-version.cl index 64c8590d9b20..d135970b8b02 100644 --- a/clang/test/SemaOpenCL/extension-version.cl +++ b/clang/test/SemaOpenCL/extension-version.cl @@ -93,12 +93,12 @@ // expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} #endif -//Core feature in CL 2.0 +//Core feature in CL 2.0, optional core feature in CL 3.0 #ifndef cl_khr_3d_image_writes #error "Missing cl_khr_3d_image_writes define" #endif #pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable -#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ == 200) && defined TEST_CORE_FEATURES +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ == 200 || __OPENCL_C_VERSION__ == 300) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}} #endif _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits