summaryrefslogtreecommitdiff
path: root/test/CodeGenOpenCL/spir_version.cl
diff options
context:
space:
mode:
authorXiuli Pan <xiulipan@outlook.com>2016-03-24 03:57:17 +0000
committerXiuli Pan <xiulipan@outlook.com>2016-03-24 03:57:17 +0000
commit5d9cb1cbfa0130361ba868fe326f1e5875457d02 (patch)
treeec882a8c167a158715c36ff3b1e5d3c86200f8d1 /test/CodeGenOpenCL/spir_version.cl
parentb6db19bdeb9c8b229ce7b18fa5c2b9192de95354 (diff)
downloadclang-5d9cb1cbfa0130361ba868fe326f1e5875457d02.tar.gz
[OpenCL] Add ocl and spir version for spir target
Summary: Add opencl.spir.version and opencl.ocl.version metadata for CodeGen to identify OpenCL version. Reviewers: yaxunl, Anastasia Subscribers: cfe-commits, pekka.jaaskelainen Differential Revision: http://reviews.llvm.org/D17596 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenOpenCL/spir_version.cl')
-rw-r--r--test/CodeGenOpenCL/spir_version.cl18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGenOpenCL/spir_version.cl b/test/CodeGenOpenCL/spir_version.cl
new file mode 100644
index 0000000000..215b4d7a40
--- /dev/null
+++ b/test/CodeGenOpenCL/spir_version.cl
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -emit-llvm -o - | FileCheck %s --check-prefix=CL10
+// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -emit-llvm -o - -cl-std=CL1.2 | FileCheck %s --check-prefix=CL12
+// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -emit-llvm -o - -cl-std=CL2.0 | FileCheck %s --check-prefix=CL20
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - | FileCheck %s --check-prefix=CL10
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=CL1.2 | FileCheck %s --check-prefix=CL12
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - -cl-std=CL2.0 | FileCheck %s --check-prefix=CL20
+kernel void foo() {}
+// CL10: !opencl.spir.version = !{[[SPIR:![0-9]+]]}
+// CL10: !opencl.ocl.version = !{[[OCL:![0-9]+]]}
+// CL10: [[SPIR]] = !{i32 2, i32 0}
+// CL10: [[OCL]] = !{i32 1, i32 0}
+// CL12: !opencl.spir.version = !{[[SPIR:![0-9]+]]}
+// CL12: !opencl.ocl.version = !{[[OCL:![0-9]+]]}
+// CL12: [[SPIR]] = !{i32 2, i32 0}
+// CL12: [[OCL]] = !{i32 1, i32 2}
+// CL20: !opencl.spir.version = !{[[SPIR:![0-9]+]]}
+// CL20: !opencl.ocl.version = !{[[SPIR:![0-9]+]]}
+// CL20: [[SPIR]] = !{i32 2, i32 0}