r345044 - [OpenCL] Add cl_intel_planar_yuv extension

Andrew Savonichev via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 23 09:13:17 PDT 2018


Author: asavonic
Date: Tue Oct 23 09:13:16 2018
New Revision: 345044

URL: http://llvm.org/viewvc/llvm-project?rev=345044&view=rev
Log:
[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


Modified:
    cfe/trunk/lib/Headers/opencl-c.h
    cfe/trunk/test/Headers/opencl-c-header.cl

Modified: cfe/trunk/lib/Headers/opencl-c.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/opencl-c.h?rev=345044&r1=345043&r2=345044&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/opencl-c.h (original)
+++ cfe/trunk/lib/Headers/opencl-c.h Tue Oct 23 09:13:16 2018
@@ -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))
 

Modified: cfe/trunk/test/Headers/opencl-c-header.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/opencl-c-header.cl?rev=345044&r1=345043&r2=345044&view=diff
==============================================================================
--- cfe/trunk/test/Headers/opencl-c-header.cl (original)
+++ cfe/trunk/test/Headers/opencl-c-header.cl Tue Oct 23 09:13:16 2018
@@ -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
 }
 #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 at +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




More information about the cfe-commits mailing list