1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11,GFX11-SDAG %s
3 ; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11,GFX11-GISEL %s
5 define amdgpu_kernel void @test_get_doorbell(ptr addrspace(1) %out) {
6 ; GFX11-SDAG-LABEL: test_get_doorbell:
8 ; GFX11-SDAG-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
9 ; GFX11-SDAG-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(MSG_RTN_GET_DOORBELL)
10 ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0)
11 ; GFX11-SDAG-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
12 ; GFX11-SDAG-NEXT: global_store_b32 v0, v1, s[0:1]
13 ; GFX11-SDAG-NEXT: s_nop 0
14 ; GFX11-SDAG-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
15 ; GFX11-SDAG-NEXT: s_endpgm
17 ; GFX11-GISEL-LABEL: test_get_doorbell:
18 ; GFX11-GISEL: ; %bb.0:
19 ; GFX11-GISEL-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
20 ; GFX11-GISEL-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(MSG_RTN_GET_DOORBELL)
21 ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0)
22 ; GFX11-GISEL-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
23 ; GFX11-GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
24 ; GFX11-GISEL-NEXT: s_nop 0
25 ; GFX11-GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
26 ; GFX11-GISEL-NEXT: s_endpgm
27 %ret = call i32 @llvm.amdgcn.s.sendmsg.rtn.i32(i32 128)
28 store i32 %ret, ptr addrspace(1) %out
32 define amdgpu_kernel void @test_get_ddid(ptr addrspace(1) %out) {
33 ; GFX11-SDAG-LABEL: test_get_ddid:
34 ; GFX11-SDAG: ; %bb.0:
35 ; GFX11-SDAG-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
36 ; GFX11-SDAG-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(MSG_RTN_GET_DDID)
37 ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0)
38 ; GFX11-SDAG-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
39 ; GFX11-SDAG-NEXT: global_store_b32 v0, v1, s[0:1]
40 ; GFX11-SDAG-NEXT: s_nop 0
41 ; GFX11-SDAG-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
42 ; GFX11-SDAG-NEXT: s_endpgm
44 ; GFX11-GISEL-LABEL: test_get_ddid:
45 ; GFX11-GISEL: ; %bb.0:
46 ; GFX11-GISEL-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
47 ; GFX11-GISEL-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(MSG_RTN_GET_DDID)
48 ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0)
49 ; GFX11-GISEL-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
50 ; GFX11-GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
51 ; GFX11-GISEL-NEXT: s_nop 0
52 ; GFX11-GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
53 ; GFX11-GISEL-NEXT: s_endpgm
54 %ret = call i32 @llvm.amdgcn.s.sendmsg.rtn.i32(i32 129)
55 store i32 %ret, ptr addrspace(1) %out
59 define amdgpu_kernel void @test_get_tma(ptr addrspace(1) %out) {
60 ; GFX11-LABEL: test_get_tma:
62 ; GFX11-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
63 ; GFX11-NEXT: s_sendmsg_rtn_b64 s[2:3], sendmsg(MSG_RTN_GET_TMA)
64 ; GFX11-NEXT: v_mov_b32_e32 v2, 0
65 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
66 ; GFX11-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
67 ; GFX11-NEXT: global_store_b64 v2, v[0:1], s[0:1]
69 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
70 ; GFX11-NEXT: s_endpgm
71 %ret = call i64 @llvm.amdgcn.s.sendmsg.rtn.i64(i32 130)
72 store i64 %ret, ptr addrspace(1) %out
76 define amdgpu_kernel void @test_get_realtime(ptr addrspace(1) %out) {
77 ; GFX11-LABEL: test_get_realtime:
79 ; GFX11-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
80 ; GFX11-NEXT: s_sendmsg_rtn_b64 s[2:3], sendmsg(MSG_RTN_GET_REALTIME)
81 ; GFX11-NEXT: v_mov_b32_e32 v2, 0
82 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
83 ; GFX11-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
84 ; GFX11-NEXT: global_store_b64 v2, v[0:1], s[0:1]
86 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
87 ; GFX11-NEXT: s_endpgm
88 %ret = call i64 @llvm.amdgcn.s.sendmsg.rtn.i64(i32 131)
89 store i64 %ret, ptr addrspace(1) %out
93 define amdgpu_kernel void @test_savewave(ptr addrspace(1) %out) {
94 ; GFX11-SDAG-LABEL: test_savewave:
95 ; GFX11-SDAG: ; %bb.0:
96 ; GFX11-SDAG-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
97 ; GFX11-SDAG-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(MSG_RTN_SAVE_WAVE)
98 ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0)
99 ; GFX11-SDAG-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
100 ; GFX11-SDAG-NEXT: global_store_b32 v0, v1, s[0:1]
101 ; GFX11-SDAG-NEXT: s_nop 0
102 ; GFX11-SDAG-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
103 ; GFX11-SDAG-NEXT: s_endpgm
105 ; GFX11-GISEL-LABEL: test_savewave:
106 ; GFX11-GISEL: ; %bb.0:
107 ; GFX11-GISEL-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
108 ; GFX11-GISEL-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(MSG_RTN_SAVE_WAVE)
109 ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0)
110 ; GFX11-GISEL-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
111 ; GFX11-GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
112 ; GFX11-GISEL-NEXT: s_nop 0
113 ; GFX11-GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
114 ; GFX11-GISEL-NEXT: s_endpgm
115 %ret = call i32 @llvm.amdgcn.s.sendmsg.rtn.i32(i32 132)
116 store i32 %ret, ptr addrspace(1) %out
120 define amdgpu_kernel void @test_get_tba(ptr addrspace(1) %out) {
121 ; GFX11-LABEL: test_get_tba:
123 ; GFX11-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
124 ; GFX11-NEXT: s_sendmsg_rtn_b64 s[2:3], sendmsg(MSG_RTN_GET_TBA)
125 ; GFX11-NEXT: v_mov_b32_e32 v2, 0
126 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
127 ; GFX11-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
128 ; GFX11-NEXT: global_store_b64 v2, v[0:1], s[0:1]
129 ; GFX11-NEXT: s_nop 0
130 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
131 ; GFX11-NEXT: s_endpgm
132 %ret = call i64 @llvm.amdgcn.s.sendmsg.rtn.i64(i32 133)
133 store i64 %ret, ptr addrspace(1) %out
137 define amdgpu_kernel void @test_get_0_i32(ptr addrspace(1) %out) {
138 ; GFX11-SDAG-LABEL: test_get_0_i32:
139 ; GFX11-SDAG: ; %bb.0:
140 ; GFX11-SDAG-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
141 ; GFX11-SDAG-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(0, 0, 0)
142 ; GFX11-SDAG-NEXT: s_waitcnt lgkmcnt(0)
143 ; GFX11-SDAG-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
144 ; GFX11-SDAG-NEXT: global_store_b32 v0, v1, s[0:1]
145 ; GFX11-SDAG-NEXT: s_nop 0
146 ; GFX11-SDAG-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
147 ; GFX11-SDAG-NEXT: s_endpgm
149 ; GFX11-GISEL-LABEL: test_get_0_i32:
150 ; GFX11-GISEL: ; %bb.0:
151 ; GFX11-GISEL-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
152 ; GFX11-GISEL-NEXT: s_sendmsg_rtn_b32 s2, sendmsg(0, 0, 0)
153 ; GFX11-GISEL-NEXT: s_waitcnt lgkmcnt(0)
154 ; GFX11-GISEL-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
155 ; GFX11-GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
156 ; GFX11-GISEL-NEXT: s_nop 0
157 ; GFX11-GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
158 ; GFX11-GISEL-NEXT: s_endpgm
159 %ret = call i32 @llvm.amdgcn.s.sendmsg.rtn.i32(i32 0)
160 store i32 %ret, ptr addrspace(1) %out
164 define amdgpu_kernel void @test_get_99999_i64(ptr addrspace(1) %out) {
165 ; GFX11-LABEL: test_get_99999_i64:
167 ; GFX11-NEXT: s_load_b64 s[0:1], s[2:3], 0x24
168 ; GFX11-NEXT: s_sendmsg_rtn_b64 s[2:3], 99999
169 ; GFX11-NEXT: v_mov_b32_e32 v2, 0
170 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
171 ; GFX11-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
172 ; GFX11-NEXT: global_store_b64 v2, v[0:1], s[0:1]
173 ; GFX11-NEXT: s_nop 0
174 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
175 ; GFX11-NEXT: s_endpgm
176 %ret = call i64 @llvm.amdgcn.s.sendmsg.rtn.i64(i32 99999)
177 store i64 %ret, ptr addrspace(1) %out
181 declare i32 @llvm.amdgcn.s.sendmsg.rtn.i32(i32)
182 declare i64 @llvm.amdgcn.s.sendmsg.rtn.i64(i32)