OpenCL: add support for __kernel, kernel keywords and EXTENSION,
FP_CONTRACT pragmas. Patch originally by ARM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125475 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4c15e8f..e16416a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -4,6 +4,7 @@
"CodeGen"
"CodeGenCXX"
"CodeGenObjC"
+ "CodeGenOpenCL"
"Coverage"
"CXX"
"Driver"
diff --git a/test/CodeGenOpenCL/kernel-metadata.cl b/test/CodeGenOpenCL/kernel-metadata.cl
new file mode 100644
index 0000000..3e10a11
--- /dev/null
+++ b/test/CodeGenOpenCL/kernel-metadata.cl
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+void normal_function() {
+}
+
+__kernel void kernel_function() {
+}
+
+// CHECK: !opencl.kernels = !{!0}
+// CHECK: !0 = metadata !{void ()* @kernel_function}
diff --git a/test/Parser/opencl-kernel.cl b/test/Parser/opencl-kernel.cl
new file mode 100644
index 0000000..3abb62b
--- /dev/null
+++ b/test/Parser/opencl-kernel.cl
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+__kernel void test()
+{
+}
+
+kernel void test1()
+{
+}
diff --git a/test/Parser/opencl-pragma.cl b/test/Parser/opencl-pragma.cl
new file mode 100644
index 0000000..5b6c55a
--- /dev/null
+++ b/test/Parser/opencl-pragma.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+
+#pragma OPENCL EXTENSION cl_no_such_extension : disable /* expected-warning {{unknown OpenCL extension 'cl_no_such_extension' - ignoring}} */
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' - ignoring}} */
+
+#pragma OPENCL FP_CONTRACT ON
+#pragma OPENCL FP_CONTRACT OFF
+#pragma OPENCL FP_CONTRACT DEFAULT
+#pragma OPENCL FP_CONTRACT FOO // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}