summaryrefslogtreecommitdiffstats
path: root/test/CodeGenOpenCLCXX/address-space-castoperators.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenOpenCLCXX/address-space-castoperators.cpp')
-rw-r--r--test/CodeGenOpenCLCXX/address-space-castoperators.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/CodeGenOpenCLCXX/address-space-castoperators.cpp b/test/CodeGenOpenCLCXX/address-space-castoperators.cpp
new file mode 100644
index 0000000000..e5c3ee880c
--- /dev/null
+++ b/test/CodeGenOpenCLCXX/address-space-castoperators.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s
+
+void test_reinterpret_cast(){
+__private float x;
+__private float& y = x;
+// We don't need bitcast to cast pointer type and
+// address space at the same time.
+//CHECK: addrspacecast float* %x to i32 addrspace(4)*
+//CHECK: [[REG:%[0-9]+]] = load float*, float** %y
+//CHECK: addrspacecast float* [[REG]] to i32 addrspace(4)*
+//CHECK-NOT: bitcast
+__generic int& rc1 = reinterpret_cast<__generic int&>(x);
+__generic int& rc2 = reinterpret_cast<__generic int&>(y);
+}