Anastasia Stulova | 6f7c536 | 2019-03-07 17:06:30 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s |
| 2 | |
| 3 | void 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 | } |