From: Yaxun Liu Date: Fri, 29 Jul 2016 17:52:34 +0000 (+0000) Subject: [OpenCL] Add extension cl_khr_mipmap_image to clang X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67e6f3b6025e5b17eb332299794899884702f044;p=clang [OpenCL] Add extension cl_khr_mipmap_image to clang Adding extension cl_khr_mipmap_image to clang's OpenCL Extensions and initiated inside AMDGPU Target. Patch by Aaron En Ye Shi. Differential Revision: https://reviews.llvm.org/D22637 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277181 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/OpenCLExtensions.def b/include/clang/Basic/OpenCLExtensions.def index c5776d3bab..491904445f 100644 --- a/include/clang/Basic/OpenCLExtensions.def +++ b/include/clang/Basic/OpenCLExtensions.def @@ -67,6 +67,7 @@ OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U) // OpenCL 2.0. OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U) OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U) +OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U) OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U) OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U) OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U) diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index a9c9ece3d3..e6f3e38260 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -2126,6 +2126,7 @@ public: Opts.cl_khr_fp16 = 1; Opts.cl_khr_int64_base_atomics = 1; Opts.cl_khr_int64_extended_atomics = 1; + Opts.cl_khr_mipmap_image = 1; Opts.cl_khr_3d_image_writes = 1; } } diff --git a/test/Misc/amdgcn.languageOptsOpenCL.cl b/test/Misc/amdgcn.languageOptsOpenCL.cl index 3d1f9b4d98..0bcf8be94a 100644 --- a/test/Misc/amdgcn.languageOptsOpenCL.cl +++ b/test/Misc/amdgcn.languageOptsOpenCL.cl @@ -181,6 +181,18 @@ #pragma OPENCL EXTENSION cl_khr_egl_image: enable // expected-warning@-1{{unsupported OpenCL extension 'cl_khr_egl_image' - ignoring}} +#if (__OPENCL_C_VERSION__ >= 200) +#ifndef cl_khr_mipmap_image +#error "Missing cl_khr_mipmap_image define" +#endif +#else +#ifdef cl_khr_mipmap_image +#error "Incorrect cl_khr_mipmap_image define" +#endif +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable + #ifdef cl_khr_srgb_image_writes #error "Incorrect cl_khr_srgb_image_writes define" #endif diff --git a/test/SemaOpenCL/extension-version.cl b/test/SemaOpenCL/extension-version.cl index ae403aa1d1..7c70664ca7 100644 --- a/test/SemaOpenCL/extension-version.cl +++ b/test/SemaOpenCL/extension-version.cl @@ -221,6 +221,18 @@ #endif #pragma OPENCL EXTENSION cl_khr_egl_image: enable +#if (__OPENCL_C_VERSION__ >= 200) +#ifndef cl_khr_mipmap_image +#error "Missing cl_khr_mipmap_image define" +#endif +#else +#ifdef cl_khr_mipmap_image +#error "Incorrect cl_khr_mipmap_image define" +#endif +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable + #if (__OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_srgb_image_writes #error "Missing cl_khr_srgb_image_writes define"