150
|
1 // RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s
|
|
2
|
|
3 #define __private__ __attribute__((address_space(5)))
|
|
4
|
|
5 void func_pchar(__private__ char *x);
|
|
6 void func_pvoid(__private__ void *x);
|
|
7 void func_pint(__private__ int *x);
|
|
8
|
|
9 void test_cast(char *gen_char_ptr, void *gen_void_ptr, int *gen_int_ptr) {
|
|
10 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
11 // CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
12 __private__ char *priv_char_ptr = (__private__ char *)gen_char_ptr;
|
|
13
|
|
14 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
15 // CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
16 priv_char_ptr = (__private__ char *)gen_void_ptr;
|
|
17
|
|
18 // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
|
19 // CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
20 priv_char_ptr = (__private__ char *)gen_int_ptr;
|
|
21
|
|
22 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
23 // CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
24 __private__ void *priv_void_ptr = (__private__ void *)gen_char_ptr;
|
|
25
|
|
26 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
27 // CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
28 priv_void_ptr = (__private__ void *)gen_void_ptr;
|
|
29
|
|
30 // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
|
31 // CHECK-NEXT: store i8 addrspace(5)* %[[cast]]
|
|
32 priv_void_ptr = (__private__ void *)gen_int_ptr;
|
|
33
|
|
34 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i32 addrspace(5)*
|
|
35 // CHECK-NEXT: store i32 addrspace(5)* %[[cast]]
|
|
36 __private__ int *priv_int_ptr = (__private__ int *)gen_void_ptr;
|
|
37
|
|
38 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
39 // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* %[[cast]])
|
|
40 func_pchar((__private__ char *)gen_char_ptr);
|
|
41
|
|
42 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
43 // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* %[[cast]])
|
|
44 func_pchar((__private__ char *)gen_void_ptr);
|
|
45
|
|
46 // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
|
47 // CHECK-NEXT: call void @_Z10func_pcharPU3AS5c(i8 addrspace(5)* %[[cast]])
|
|
48 func_pchar((__private__ char *)gen_int_ptr);
|
|
49
|
|
50 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
51 // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* %[[cast]])
|
|
52 func_pvoid((__private__ void *)gen_char_ptr);
|
|
53
|
|
54 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i8 addrspace(5)*
|
|
55 // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* %[[cast]])
|
|
56 func_pvoid((__private__ void *)gen_void_ptr);
|
|
57
|
|
58 // CHECK: %[[cast:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(5)*
|
|
59 // CHECK-NEXT: call void @_Z10func_pvoidPU3AS5v(i8 addrspace(5)* %[[cast]])
|
|
60 func_pvoid((__private__ void *)gen_int_ptr);
|
|
61
|
|
62 // CHECK: %[[cast:.*]] = addrspacecast i8* %{{.*}} to i32 addrspace(5)*
|
|
63 // CHECK-NEXT: call void @_Z9func_pintPU3AS5i(i32 addrspace(5)* %[[cast]])
|
|
64 func_pint((__private__ int *)gen_void_ptr);
|
|
65 }
|