150
|
1 ; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=fiji < %s | FileCheck %s
|
|
2
|
|
3 declare void @func(i32 addrspace(1)* %out)
|
|
4
|
|
5 declare protected void @protected_func(i32 addrspace(1)* %out)
|
|
6
|
|
7 declare hidden void @hidden_func(i32 addrspace(1)* %out)
|
|
8
|
|
9 ; CHECK-LABEL: call_func:
|
|
10 ; CHECK: s_getpc_b64 s{{\[}}[[PC_LO:[0-9]+]]:[[PC_HI:[0-9]+]]{{\]}}
|
|
11 ; CHECK: s_add_u32 s[[GOT_ADDR_LO:[0-9]+]], s[[PC_LO]], func@gotpcrel32@lo+4
|
221
|
12 ; CHECK: s_addc_u32 s[[GOT_ADDR_HI:[0-9]+]], s[[PC_HI]], func@gotpcrel32@hi+12
|
150
|
13 ; CHECK: s_load_dwordx2 s{{\[}}[[ADDR_LO:[0-9]+]]:[[ADDR_HI:[0-9]+]]{{\]}}, s{{\[}}[[GOT_ADDR_LO]]:[[GOT_ADDR_HI]]{{\]}}, 0x0
|
|
14 ; CHECK: s_swappc_b64 s{{\[}}{{[0-9]+:[0-9]+}}{{\]}}, s{{\[}}[[ADDR_LO]]:[[ADDR_HI]]{{\]}}
|
|
15 define amdgpu_kernel void @call_func(i32 addrspace(1)* %out) {
|
|
16 call void @func(i32 addrspace(1)* %out)
|
|
17 ret void
|
|
18 }
|
|
19
|
|
20 ; CHECK-LABEL: call_protected_func:
|
|
21 ; CHECK: s_getpc_b64 s{{\[}}[[PC_LO:[0-9]+]]:[[PC_HI:[0-9]+]]{{\]}}
|
|
22 ; CHECK: s_add_u32 s[[ADDR_LO:[0-9]+]], s[[PC_LO]], protected_func@rel32@lo+4
|
221
|
23 ; CHECK: s_addc_u32 s[[ADDR_HI:[0-9]+]], s[[PC_HI]], protected_func@rel32@hi+12
|
150
|
24 ; CHECK: s_swappc_b64 s{{\[}}{{[0-9]+:[0-9]+}}{{\]}}, s{{\[}}[[ADDR_LO]]:[[ADDR_HI]]{{\]}}
|
|
25 define amdgpu_kernel void @call_protected_func(i32 addrspace(1)* %out) {
|
|
26 call void @protected_func(i32 addrspace(1)* %out)
|
|
27 ret void
|
|
28 }
|
|
29
|
|
30 ; CHECK-LABEL: call_hidden_func:
|
|
31 ; CHECK: s_getpc_b64 s{{\[}}[[PC_LO:[0-9]+]]:[[PC_HI:[0-9]+]]{{\]}}
|
|
32 ; CHECK: s_add_u32 s[[ADDR_LO:[0-9]+]], s[[PC_LO]], hidden_func@rel32@lo+4
|
221
|
33 ; CHECK: s_addc_u32 s[[ADDR_HI:[0-9]+]], s[[PC_HI]], hidden_func@rel32@hi+12
|
150
|
34 ; CHECK: s_swappc_b64 s{{\[}}{{[0-9]+:[0-9]+}}{{\]}}, s{{\[}}[[ADDR_LO]]:[[ADDR_HI]]{{\]}}
|
|
35 define amdgpu_kernel void @call_hidden_func(i32 addrspace(1)* %out) {
|
|
36 call void @hidden_func(i32 addrspace(1)* %out)
|
|
37 ret void
|
|
38 }
|
|
39
|
|
40 declare i64 @funci()
|
|
41
|
|
42 ; CHECK-LABEL: tail_call_func:
|
|
43 ; CHECK: s_getpc_b64 s{{\[}}[[PC_LO:[0-9]+]]:[[PC_HI:[0-9]+]]{{\]}}
|
|
44 ; CHECK: s_add_u32 s[[GOT_ADDR_LO:[0-9]+]], s[[PC_LO]], funci@gotpcrel32@lo+4
|
221
|
45 ; CHECK: s_addc_u32 s[[GOT_ADDR_HI:[0-9]+]], s[[PC_HI]], funci@gotpcrel32@hi+12
|
150
|
46 ; CHECK: s_load_dwordx2 s{{\[}}[[ADDR_LO:[0-9]+]]:[[ADDR_HI:[0-9]+]]{{\]}}, s{{\[}}[[GOT_ADDR_LO]]:[[GOT_ADDR_HI]]{{\]}}, 0x0
|
|
47 ; CHECK: s_setpc_b64 s{{\[}}[[ADDR_LO]]:[[ADDR_HI]]{{\]}}
|
|
48 define i64 @tail_call_func() {
|
|
49 %ret = tail call i64 @funci()
|
|
50 ret i64 %ret
|
|
51 }
|