llvm-for-llvmta/tools/clang/test/CodeGenOpenCLCXX/address-space-castoperators...

15 lines
564 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=clc++ -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);
}