1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck %s -check-prefix=GFX9
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 < %s | FileCheck %s -check-prefix=GFX12
5 ; We have an indirect call with a known set of callees, which are
6 ; known to not need any special inputs. The ABI still needs to use the
9 ; FIXME: Passing real values for workitem ID, and 0s that can be undef
11 define amdgpu_kernel void @indirect_call_known_no_special_inputs() {
12 ; GFX9-LABEL: indirect_call_known_no_special_inputs:
13 ; GFX9: ; %bb.0: ; %bb
14 ; GFX9-NEXT: s_add_u32 flat_scratch_lo, s10, s15
15 ; GFX9-NEXT: s_addc_u32 flat_scratch_hi, s11, 0
16 ; GFX9-NEXT: s_add_u32 s0, s0, s15
17 ; GFX9-NEXT: s_addc_u32 s1, s1, 0
18 ; GFX9-NEXT: s_mov_b64 s[10:11], s[8:9]
19 ; GFX9-NEXT: s_mov_b64 s[8:9], 0
20 ; GFX9-NEXT: s_load_dword s15, s[8:9], 0x0
21 ; GFX9-NEXT: s_getpc_b64 s[8:9]
22 ; GFX9-NEXT: s_add_u32 s8, s8, wobble@gotpcrel32@lo+4
23 ; GFX9-NEXT: s_addc_u32 s9, s9, wobble@gotpcrel32@hi+12
24 ; GFX9-NEXT: s_getpc_b64 s[16:17]
25 ; GFX9-NEXT: s_add_u32 s16, s16, snork@gotpcrel32@lo+4
26 ; GFX9-NEXT: s_addc_u32 s17, s17, snork@gotpcrel32@hi+12
27 ; GFX9-NEXT: s_load_dwordx2 s[18:19], s[16:17], 0x0
28 ; GFX9-NEXT: s_load_dwordx2 s[20:21], s[8:9], 0x0
29 ; GFX9-NEXT: v_lshlrev_b32_e32 v2, 20, v2
30 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
31 ; GFX9-NEXT: s_and_b32 s8, 1, s15
32 ; GFX9-NEXT: s_cmp_eq_u32 s8, 1
33 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 10, v1
34 ; GFX9-NEXT: s_cselect_b32 s17, s21, s19
35 ; GFX9-NEXT: s_cselect_b32 s16, s20, s18
36 ; GFX9-NEXT: v_or3_b32 v31, v0, v1, v2
37 ; GFX9-NEXT: s_mov_b64 s[8:9], s[6:7]
38 ; GFX9-NEXT: v_mov_b32_e32 v1, 0
39 ; GFX9-NEXT: v_mov_b32_e32 v4, 0
40 ; GFX9-NEXT: s_mov_b32 s32, 0
41 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[16:17]
44 ; GFX12-LABEL: indirect_call_known_no_special_inputs:
45 ; GFX12: ; %bb.0: ; %bb
46 ; GFX12-NEXT: s_getpc_b64 s[6:7]
47 ; GFX12-NEXT: s_sext_i32_i16 s7, s7
48 ; GFX12-NEXT: s_add_co_u32 s6, s6, snork@gotpcrel32@lo+8
49 ; GFX12-NEXT: s_add_co_ci_u32 s7, s7, snork@gotpcrel32@hi+16
50 ; GFX12-NEXT: s_mov_b64 s[10:11], s[4:5]
51 ; GFX12-NEXT: s_mov_b64 s[4:5], 0
52 ; GFX12-NEXT: s_getpc_b64 s[8:9]
53 ; GFX12-NEXT: s_sext_i32_i16 s9, s9
54 ; GFX12-NEXT: s_add_co_u32 s8, s8, wobble@gotpcrel32@lo+8
55 ; GFX12-NEXT: s_add_co_ci_u32 s9, s9, wobble@gotpcrel32@hi+16
56 ; GFX12-NEXT: s_load_u8 s12, s[4:5], 0x0
57 ; GFX12-NEXT: s_load_b64 s[4:5], s[6:7], 0x0
58 ; GFX12-NEXT: s_load_b64 s[6:7], s[8:9], 0x0
59 ; GFX12-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v4, 0
60 ; GFX12-NEXT: v_mov_b32_e32 v31, v0
61 ; GFX12-NEXT: s_mov_b32 s32, 0
62 ; GFX12-NEXT: s_wait_kmcnt 0x0
63 ; GFX12-NEXT: s_and_b32 s8, 1, s12
64 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
65 ; GFX12-NEXT: s_cmp_eq_u32 s8, 1
66 ; GFX12-NEXT: s_mov_b64 s[8:9], s[2:3]
67 ; GFX12-NEXT: s_cselect_b32 s7, s7, s5
68 ; GFX12-NEXT: s_cselect_b32 s6, s6, s4
69 ; GFX12-NEXT: s_mov_b64 s[4:5], s[0:1]
70 ; GFX12-NEXT: s_swappc_b64 s[30:31], s[6:7]
71 ; GFX12-NEXT: s_endpgm
74 %cond = load i1, ptr addrspace(4) null
75 %tmp = select i1 %cond, ptr @wobble, ptr @snork
76 call void %tmp(ptr undef, i32 undef, ptr undef)
80 define void @wobble() {
82 ; GFX9: ; %bb.0: ; %bb
83 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
84 ; GFX9-NEXT: s_setpc_b64 s[30:31]
86 ; GFX12-LABEL: wobble:
87 ; GFX12: ; %bb.0: ; %bb
88 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
89 ; GFX12-NEXT: s_wait_expcnt 0x0
90 ; GFX12-NEXT: s_wait_samplecnt 0x0
91 ; GFX12-NEXT: s_wait_bvhcnt 0x0
92 ; GFX12-NEXT: s_wait_kmcnt 0x0
93 ; GFX12-NEXT: s_setpc_b64 s[30:31]
98 define void @snork() {
100 ; GFX9: ; %bb.0: ; %bb
101 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
102 ; GFX9-NEXT: s_setpc_b64 s[30:31]
104 ; GFX12-LABEL: snork:
105 ; GFX12: ; %bb.0: ; %bb
106 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
107 ; GFX12-NEXT: s_wait_expcnt 0x0
108 ; GFX12-NEXT: s_wait_samplecnt 0x0
109 ; GFX12-NEXT: s_wait_bvhcnt 0x0
110 ; GFX12-NEXT: s_wait_kmcnt 0x0
111 ; GFX12-NEXT: s_setpc_b64 s[30:31]