From: Andrew Savonichev Date: Tue, 23 Oct 2018 16:13:16 +0000 (+0000) Subject: [OpenCL] Add cl_intel_planar_yuv extension X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29c302124d505a4a9b00f9a80da5b54bdf447db8;p=clang [OpenCL] Add cl_intel_planar_yuv extension Just adding a preprocessor #define for the extension. Patch by Alexey Sotkin and Dmitry Sidorov Phabricator review: https://reviews.llvm.org/D51402 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345044 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/opencl-c.h b/lib/Headers/opencl-c.h index d1d9c1014e..982db65eaa 100644 --- a/lib/Headers/opencl-c.h +++ b/lib/Headers/opencl-c.h @@ -22,6 +22,14 @@ #endif //cl_khr_3d_image_writes #endif //__OPENCL_C_VERSION__ < CL_VERSION_2_0 +#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2 +#ifndef cl_intel_planar_yuv +#define cl_intel_planar_yuv +#endif // cl_intel_planar_yuv +#pragma OPENCL EXTENSION cl_intel_planar_yuv : begin +#pragma OPENCL EXTENSION cl_intel_planar_yuv : end +#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2 + #define __ovld __attribute__((overloadable)) #define __conv __attribute__((convergent)) diff --git a/test/Headers/opencl-c-header.cl b/test/Headers/opencl-c-header.cl index 2c28be19fa..d344f377c4 100644 --- a/test/Headers/opencl-c-header.cl +++ b/test/Headers/opencl-c-header.cl @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s| FileCheck %s -// RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -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 | 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.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 // Test including the default header as a module. // The module should be compiled only once and loaded from cache afterwards. @@ -71,4 +72,16 @@ void test_image3dwo(write_only image3d_t img) { } #endif //__OPENCL_C_VERSION__ +// Verify that non-builtin cl_intel_planar_yuv extension is defined from +// OpenCL 1.2 onwards. +#if (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) +// expected-no-diagnostics +#ifndef cl_intel_planar_yuv +#error "Missing cl_intel_planar_yuv define" +#endif +#else //__OPENCL_C_VERSION__ +// expected-warning@+2{{unknown OpenCL extension 'cl_intel_planar_yuv' - ignoring}} +#endif //__OPENCL_C_VERSION__ +#pragma OPENCL EXTENSION cl_intel_planar_yuv : enable + // CHECK-MOD: Reading modules