Clang Project

clang_source_code/test/CodeGenOpenCLCXX/address-space-castoperators.cpp
1// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s
2
3void test_reinterpret_cast(){
4__private float x;
5__private float& y = x; 
6// We don't need bitcast to cast pointer type and
7// address space at the same time.
8//CHECK: addrspacecast float* %x to i32 addrspace(4)*
9//CHECK: [[REG:%[0-9]+]] = load float*, float** %y
10//CHECK: addrspacecast float* [[REG]] to i32 addrspace(4)*
11//CHECK-NOT: bitcast 
12__generic int& rc1 = reinterpret_cast<__generic int&>(x);
13__generic int& rc2 = reinterpret_cast<__generic int&>(y);
14}
15