summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenOpenCL/opencl_types.cl22
-rw-r--r--clang/test/PCH/ocl_types.cl18
-rw-r--r--clang/test/PCH/ocl_types.h19
-rw-r--r--clang/test/Parser/opencl-image-access.cl30
4 files changed, 73 insertions, 16 deletions
diff --git a/clang/test/CodeGenOpenCL/opencl_types.cl b/clang/test/CodeGenOpenCL/opencl_types.cl
new file mode 100644
index 00000000000..5bebc5e2881
--- /dev/null
+++ b/clang/test/CodeGenOpenCL/opencl_types.cl
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -O0 | FileCheck %s
+
+void fnc1(image1d_t img) {}
+// CHECK: @fnc1(%opencl.image1d_t*
+
+void fnc1arr(image1d_array_t img) {}
+// CHECK: @fnc1arr(%opencl.image1d_array_t*
+
+void fnc1buff(image1d_buffer_t img) {}
+// CHECK: @fnc1buff(%opencl.image1d_buffer_t*
+
+void fnc2(image2d_t img) {}
+// CHECK: @fnc2(%opencl.image2d_t*
+
+void fnc2arr(image2d_array_t img) {}
+// CHECK: @fnc2arr(%opencl.image2d_array_t*
+
+void fnc3(image3d_t img) {}
+// CHECK: @fnc3(%opencl.image3d_t*
+
+kernel void foo(image1d_t img) {
+}
diff --git a/clang/test/PCH/ocl_types.cl b/clang/test/PCH/ocl_types.cl
new file mode 100644
index 00000000000..d5c4428f981
--- /dev/null
+++ b/clang/test/PCH/ocl_types.cl
@@ -0,0 +1,18 @@
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s
+
+// Test with pch.
+// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print
+
+void foo1(img1d_t img);
+
+void foo2(img1darr_t img);
+
+void foo3(img1dbuff_t img);
+
+void foo4(img2d_t img);
+
+void foo5(img2darr_t img);
+
+void foo6(img3d_t img);
diff --git a/clang/test/PCH/ocl_types.h b/clang/test/PCH/ocl_types.h
new file mode 100644
index 00000000000..6afa016032e
--- /dev/null
+++ b/clang/test/PCH/ocl_types.h
@@ -0,0 +1,19 @@
+/* Used with the ocl_types.cl test */
+
+// image1d_t
+typedef image1d_t img1d_t;
+
+// image1d_array_t
+typedef image1d_array_t img1darr_t;
+
+// image1d_buffer_t
+typedef image1d_buffer_t img1dbuff_t;
+
+// image2d_t
+typedef image2d_t img2d_t;
+
+// image2d_array_t
+typedef image2d_array_t img2darr_t;
+
+// image3d_t
+typedef image3d_t img3d_t;
diff --git a/clang/test/Parser/opencl-image-access.cl b/clang/test/Parser/opencl-image-access.cl
index 313587c1d22..3496d12a3e5 100644
--- a/clang/test/Parser/opencl-image-access.cl
+++ b/clang/test/Parser/opencl-image-access.cl
@@ -1,16 +1,14 @@
-// RUN: %clang_cc1 %s -fsyntax-only
-
-typedef void* image2d_t;
-
-__kernel void f__ro(__read_only image2d_t a) { }
-
-__kernel void f__wo(__write_only image2d_t a) { }
-
-__kernel void f__rw(__read_write image2d_t a) { }
-
-
-__kernel void fro(read_only image2d_t a) { }
-
-__kernel void fwo(write_only image2d_t a) { }
-
-__kernel void frw(read_write image2d_t a) { }
+// RUN: %clang_cc1 %s -fsyntax-only
+
+__kernel void f__ro(__read_only image2d_t a) { }
+
+__kernel void f__wo(__write_only image2d_t a) { }
+
+__kernel void f__rw(__read_write image2d_t a) { }
+
+
+__kernel void fro(read_only image2d_t a) { }
+
+__kernel void fwo(write_only image2d_t a) { }
+
+__kernel void frw(read_write image2d_t a) { }
OpenPOWER on IntegriCloud