summaryrefslogtreecommitdiffstats
path: root/test/Headers
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2017-01-25 12:18:50 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2017-01-25 12:18:50 +0000
commitc98aa2fc0af844a2329e0a486b3f6e6150d4a2fc (patch)
tree96f5329e4c3a3a48492d601b2c26807b65ad5bea /test/Headers
parent2c44f4663c11135e794a30316dee7328979baf5d (diff)
[OpenCL] Diagnose write_only image3d when extension is disabled
Prior to OpenCL 2.0, image3d_t can only be used with the write_only access qualifier when the cl_khr_3d_image_writes extension is enabled, see e.g. OpenCL 1.1 s6.8b. Require the extension for write_only image3d_t types and guard uses of write_only image3d_t in the OpenCL header. Patch by Sven van Haastregt! Review: https://reviews.llvm.org/D28860 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Headers')
-rw-r--r--test/Headers/opencl-c-header.cl25
1 files changed, 19 insertions, 6 deletions
diff --git a/test/Headers/opencl-c-header.cl b/test/Headers/opencl-c-header.cl
index 457a6193d4..fffbd7a8ed 100644
--- a/test/Headers/opencl-c-header.cl
+++ b/test/Headers/opencl-c-header.cl
@@ -1,16 +1,11 @@
// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
-// CHECK: _Z16convert_char_rtec
-// CHECK-NOT: _Z3ctzc
-// CHECK20: _Z3ctzc
-// CHECK20-NOT: _Z16convert_char_rtec
-// CHECK-MOD: Reading modules
-
// Test including the default header as a module.
// The module should be compiled only once and loaded from cache afterwards.
// Change the directory mode to read only to make sure no new modules are created.
// Check time report to make sure module is used.
+// Check that some builtins occur in the generated IR when called.
// ===
// Clear current directory.
@@ -48,6 +43,12 @@
// RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
// RUN: chmod u+w %t
+// Verify that called builtins occur in the generated IR.
+
+// CHECK: _Z16convert_char_rtec
+// CHECK-NOT: _Z3ctzc
+// CHECK20: _Z3ctzc
+// CHECK20-NOT: _Z16convert_char_rtec
char f(char x) {
#if __OPENCL_C_VERSION__ != CL_VERSION_2_0
return convert_char_rte(x);
@@ -59,3 +60,15 @@ char f(char x) {
return ctz(x);
#endif //__OPENCL_C_VERSION__
}
+
+// Verify that a builtin using a write_only image3d_t type is available
+// from OpenCL 2.0 onwards.
+
+// CHECK20: _Z12write_imagef14ocl_image3d_wo
+#if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
+void test_image3dwo(write_only image3d_t img) {
+ write_imagef(img, (0), (0.0f));
+}
+#endif //__OPENCL_C_VERSION__
+
+// CHECK-MOD: Reading modules