aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenOpenCL
diff options
context:
space:
mode:
authorGuy Benyei <guy.benyei@intel.com>2012-12-11 21:38:14 +0000
committerGuy Benyei <guy.benyei@intel.com>2012-12-11 21:38:14 +0000
commitbd5da3ca593fbf354fd19c2894eee50694c96788 (patch)
treee716f76929ab8e7a1c3cd4c13724f0b7abf80096 /test/CodeGenOpenCL
parent443c999c967d555f6942834b0924c60226b3e6f2 (diff)
Add SPIR32/SPIR64 targets to Clang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenOpenCL')
-rw-r--r--test/CodeGenOpenCL/spir32_target.cl22
-rw-r--r--test/CodeGenOpenCL/spir64_target.cl21
2 files changed, 43 insertions, 0 deletions
diff --git a/test/CodeGenOpenCL/spir32_target.cl b/test/CodeGenOpenCL/spir32_target.cl
new file mode 100644
index 0000000000..42bffbd719
--- /dev/null
+++ b/test/CodeGenOpenCL/spir32_target.cl
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -emit-llvm -o - | FileCheck %s
+
+// CHECK: target triple = "spir-unknown-unknown"
+
+typedef struct {
+ char c;
+ void *v;
+ void *v2;
+} my_st;
+
+kernel void foo(global long *arg) {
+ int res1[sizeof(my_st) == 12 ? 1 : -1];
+ int res2[sizeof(void *) == 4 ? 1 : -1];
+ int res3[sizeof(arg) == 4 ? 1 : -1];
+
+ my_st *tmp = 0;
+
+ arg[0] = (long)(&tmp->v);
+//CHECK: store i64 4, i64 addrspace(1)*
+ arg[1] = (long)(&tmp->v2);
+//CHECK: store i64 8, i64 addrspace(1)*
+}
diff --git a/test/CodeGenOpenCL/spir64_target.cl b/test/CodeGenOpenCL/spir64_target.cl
new file mode 100644
index 0000000000..93ee86c610
--- /dev/null
+++ b/test/CodeGenOpenCL/spir64_target.cl
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -emit-llvm -o - | FileCheck %s
+
+// CHECK: target triple = "spir64-unknown-unknown"
+
+typedef struct {
+ char c;
+ void *v;
+ void *v2;
+} my_st;
+
+kernel void foo(global long *arg) {
+ int res1[sizeof(my_st) == 24 ? 1 : -1];
+ int res2[sizeof(void *) == 8 ? 1 : -1];
+ int res3[sizeof(arg) == 8 ? 1 : -1];
+
+ my_st *tmp = 0;
+ arg[3] = (long)(&tmp->v);
+//CHECK: store i64 8, i64 addrspace(1)*
+ arg[4] = (long)(&tmp->v2);
+//CHECK: store i64 16, i64 addrspace(1)*
+}