2018-07-20 19:32:51 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s
|
|
|
|
|
|
|
|
#define __private__ __attribute__((address_space(5)))
|
|
|
|
|
|
|
|
void func_pchar(__private__ char *x);
|
2018-08-03 11:18:56 +08:00
|
|
|
void func_pvoid(__private__ void *x);
|
|
|
|
void func_pint(__private__ int *x);
|
2018-07-20 19:32:51 +08:00
|
|
|
|
2018-08-03 11:18:56 +08:00
|
|
|
void test_cast(char *gen_char_ptr, void *gen_void_ptr, int *gen_int_ptr) {
|
2018-07-20 19:32:51 +08:00
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
2018-08-03 11:18:56 +08:00
|
|
|
__private__ char *priv_char_ptr = (__private__ char *)gen_char_ptr;
|
2018-07-20 19:32:51 +08:00
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
2018-08-03 11:18:56 +08:00
|
|
|
// CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
|
|
priv_char_ptr = (__private__ char *)gen_void_ptr;
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
|
|
priv_char_ptr = (__private__ char *)gen_int_ptr;
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
|
|
__private__ void *priv_void_ptr = (__private__ void *)gen_char_ptr;
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
|
|
priv_void_ptr = (__private__ void *)gen_void_ptr;
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
|
|
priv_void_ptr = (__private__ void *)gen_int_ptr;
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i32 addrspace(5)*
|
|
|
|
// CHECK-NEXT: store i32 addrspace(5)* %[[cast]]
|
|
|
|
__private__ int *priv_int_ptr = (__private__ int *)gen_void_ptr;
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* %[[cast]])
|
|
|
|
func_pchar((__private__ char *)gen_char_ptr);
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* %[[cast]])
|
|
|
|
func_pchar((__private__ char *)gen_void_ptr);
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
2018-07-20 19:32:51 +08:00
|
|
|
// CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* %[[cast]])
|
2018-08-03 11:18:56 +08:00
|
|
|
func_pchar((__private__ char *)gen_int_ptr);
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* %[[cast]])
|
|
|
|
func_pvoid((__private__ void *)gen_char_ptr);
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* %[[cast]])
|
|
|
|
func_pvoid((__private__ void *)gen_void_ptr);
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
|
|
|
// CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* %[[cast]])
|
|
|
|
func_pvoid((__private__ void *)gen_int_ptr);
|
|
|
|
|
|
|
|
// CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i32 addrspace(5)*
|
|
|
|
// CHECK-NEXT: call void @_Z9func_pintPU3AS5i(i32 addrspace(5)* %[[cast]])
|
|
|
|
func_pint((__private__ int *)gen_void_ptr);
|
2018-07-20 19:32:51 +08:00
|
|
|
}
|