1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
3 # RUN: llc -march=amdgcn -mcpu=gfx1100 -run-pass=release-vgprs -verify-machineinstrs -o - %s | FileCheck %s
6 define amdgpu_ps void @tbuffer_store1() { ret void }
7 define amdgpu_ps void @tbuffer_store2() { ret void }
8 define amdgpu_ps void @flat_store() { ret void }
9 define amdgpu_ps void @global_store() { ret void }
10 define amdgpu_ps void @buffer_store_format() { ret void }
11 define amdgpu_ps void @ds_write_b32() { ret void }
12 define amdgpu_ps void @global_store_dword() { ret void }
13 define amdgpu_ps void @multiple_basic_blocks1() { ret void }
14 define amdgpu_ps void @multiple_basic_blocks2() { ret void }
15 define amdgpu_ps void @multiple_basic_blocks3() { ret void }
16 define amdgpu_ps void @recursive_loop() { ret void }
17 define amdgpu_ps void @recursive_loop_vmem() { ret void }
18 define amdgpu_ps void @image_store() { ret void }
19 define amdgpu_ps void @scratch_store() { ret void }
20 define amdgpu_ps void @buffer_atomic() { ret void }
21 define amdgpu_ps void @flat_atomic() { ret void }
22 define amdgpu_ps void @global_atomic() { ret void }
23 define amdgpu_ps void @image_atomic() { ret void }
30 ; CHECK-LABEL: name: tbuffer_store1
31 ; CHECK: TBUFFER_STORE_FORMAT_XYZW_OFFSET_exact killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, killed renamable $sgpr4, 42, 117, 0, 0, 0, implicit $exec
32 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
33 ; CHECK-NEXT: S_ENDPGM 0
34 TBUFFER_STORE_FORMAT_XYZW_OFFSET_exact killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, killed renamable $sgpr4, 42, 117, 0, 0, 0, implicit $exec
42 ; CHECK-LABEL: name: tbuffer_store2
43 ; CHECK: TBUFFER_STORE_FORMAT_XYZW_OFFEN_exact killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $vgpr4, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 115, 0, 0, 0, implicit $exec :: (dereferenceable store (s128) into custom "BufferResource", align 1, addrspace 4)
44 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
45 ; CHECK-NEXT: S_ENDPGM 0
46 TBUFFER_STORE_FORMAT_XYZW_OFFEN_exact killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $vgpr4, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 115, 0, 0, 0, implicit $exec :: (dereferenceable store (s128) into custom "BufferResource", align 1, addrspace 4)
54 ; CHECK-LABEL: name: flat_store
55 ; CHECK: FLAT_STORE_DWORDX4 $vgpr49_vgpr50, $vgpr26_vgpr27_vgpr28_vgpr29, 0, 0, implicit $exec, implicit $flat_scr
56 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
57 ; CHECK-NEXT: S_ENDPGM 0
58 FLAT_STORE_DWORDX4 $vgpr49_vgpr50, $vgpr26_vgpr27_vgpr28_vgpr29, 0, 0, implicit $exec, implicit $flat_scr
66 ; CHECK-LABEL: name: global_store
67 ; CHECK: GLOBAL_STORE_DWORD undef renamable $vgpr0_vgpr1, killed renamable $vgpr1, 0, 4, implicit $exec
68 ; CHECK-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
69 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
70 ; CHECK-NEXT: S_ENDPGM 0
71 GLOBAL_STORE_DWORD undef renamable $vgpr0_vgpr1, killed renamable $vgpr1, 0, 4, implicit $exec
72 S_WAITCNT_VSCNT undef $sgpr_null, 0
77 name: buffer_store_format
80 ; CHECK-LABEL: name: buffer_store_format
81 ; CHECK: BUFFER_STORE_FORMAT_D16_X_OFFEN_exact killed renamable $vgpr0, killed renamable $vgpr1, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, killed renamable $sgpr4, 0, 0, 0, 0, implicit $exec
82 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
83 ; CHECK-NEXT: S_ENDPGM 0
84 BUFFER_STORE_FORMAT_D16_X_OFFEN_exact killed renamable $vgpr0, killed renamable $vgpr1, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, killed renamable $sgpr4, 0, 0, 0, 0, implicit $exec
92 ; CHECK-LABEL: name: ds_write_b32
93 ; CHECK: renamable $vgpr0 = IMPLICIT_DEF
94 ; CHECK-NEXT: renamable $vgpr1 = IMPLICIT_DEF
95 ; CHECK-NEXT: DS_WRITE_B32_gfx9 killed renamable $vgpr0, killed renamable $vgpr1, 12, 0, implicit $exec
96 ; CHECK-NEXT: S_ENDPGM 0
97 renamable $vgpr0 = IMPLICIT_DEF
98 renamable $vgpr1 = IMPLICIT_DEF
99 DS_WRITE_B32_gfx9 killed renamable $vgpr0, killed renamable $vgpr1, 12, 0, implicit $exec
104 name: global_store_dword
107 liveins: $vgpr0, $sgpr0_sgpr1
109 ; CHECK-LABEL: name: global_store_dword
110 ; CHECK: liveins: $vgpr0, $sgpr0_sgpr1
112 ; CHECK-NEXT: renamable $vgpr0 = V_MAD_I32_I24_e64 killed $vgpr1, killed $vgpr0, killed $sgpr2, 0, implicit $exec
113 ; CHECK-NEXT: GLOBAL_STORE_DWORD_SADDR killed renamable $vgpr2, killed renamable $vgpr0, killed renamable $sgpr0_sgpr1, 0, 0, implicit $exec
114 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
115 ; CHECK-NEXT: S_ENDPGM 0
116 renamable $vgpr0 = V_MAD_I32_I24_e64 killed $vgpr1, killed $vgpr0, killed $sgpr2, 0, implicit $exec
117 GLOBAL_STORE_DWORD_SADDR killed renamable $vgpr2, killed renamable $vgpr0, killed renamable $sgpr0_sgpr1, 0, 0, implicit $exec
122 name: multiple_basic_blocks1
124 ; CHECK-LABEL: name: multiple_basic_blocks1
126 ; CHECK-NEXT: successors: %bb.1(0x80000000)
128 ; CHECK-NEXT: renamable $vgpr0 = BUFFER_LOAD_FORMAT_X_IDXEN killed renamable $vgpr0, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit $exec
129 ; CHECK-NEXT: S_BRANCH %bb.1
132 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
134 ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec
135 ; CHECK-NEXT: S_CMP_LG_U32 killed renamable $sgpr3, renamable $sgpr4, implicit-def $scc
136 ; CHECK-NEXT: S_CBRANCH_SCC1 %bb.1, implicit killed $scc
137 ; CHECK-NEXT: S_BRANCH %bb.2
140 ; CHECK-NEXT: S_ENDPGM 0
144 renamable $vgpr0 = BUFFER_LOAD_FORMAT_X_IDXEN killed renamable $vgpr0, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit $exec
148 successors: %bb.1, %bb.2
150 $vgpr1 = V_ADD_U32_e32 renamable $vgpr0, renamable $vgpr2, implicit $exec
151 S_CMP_LG_U32 killed renamable $sgpr3, renamable $sgpr4, implicit-def $scc
152 S_CBRANCH_SCC1 %bb.1, implicit killed $scc
161 # One block has a VMEM store as the last instruction, we should release the VGPRS
164 name: multiple_basic_blocks2
166 ; CHECK-LABEL: name: multiple_basic_blocks2
168 ; CHECK-NEXT: successors: %bb.2(0x80000000)
170 ; CHECK-NEXT: TBUFFER_STORE_FORMAT_X_OFFSET_exact killed renamable $vgpr0, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 125, 0, 0, 0, implicit $exec
171 ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec
172 ; CHECK-NEXT: S_BRANCH %bb.2
175 ; CHECK-NEXT: successors: %bb.2(0x80000000)
177 ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec
178 ; CHECK-NEXT: TBUFFER_STORE_FORMAT_X_OFFSET_exact killed renamable $vgpr0, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 125, 0, 0, 0, implicit $exec
179 ; CHECK-NEXT: S_BRANCH %bb.2
182 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
183 ; CHECK-NEXT: S_ENDPGM 0
187 TBUFFER_STORE_FORMAT_X_OFFSET_exact killed renamable $vgpr0, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 125, 0, 0, 0, implicit $exec
188 $vgpr1 = V_ADD_U32_e32 renamable $vgpr0, renamable $vgpr2, implicit $exec
194 $vgpr1 = V_ADD_U32_e32 renamable $vgpr0, renamable $vgpr2, implicit $exec
195 TBUFFER_STORE_FORMAT_X_OFFSET_exact killed renamable $vgpr0, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 125, 0, 0, 0, implicit $exec
203 # One parent block has a VMEM store, release VGPRs
205 name: multiple_basic_blocks3
207 ; CHECK-LABEL: name: multiple_basic_blocks3
209 ; CHECK-NEXT: successors: %bb.2(0x80000000)
211 ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec
212 ; CHECK-NEXT: TBUFFER_STORE_FORMAT_X_OFFSET_exact killed renamable $vgpr0, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 125, 0, 0, 0, implicit $exec
213 ; CHECK-NEXT: S_BRANCH %bb.2
216 ; CHECK-NEXT: successors: %bb.2(0x80000000)
218 ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec
219 ; CHECK-NEXT: S_BRANCH %bb.2
222 ; CHECK-NEXT: successors: %bb.4(0x80000000)
224 ; CHECK-NEXT: S_BRANCH %bb.4
227 ; CHECK-NEXT: successors: %bb.4(0x80000000)
229 ; CHECK-NEXT: $vgpr1 = V_ADD_U32_e32 $vgpr0, $vgpr2, implicit $exec
230 ; CHECK-NEXT: S_BRANCH %bb.4
233 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
234 ; CHECK-NEXT: S_ENDPGM 0
238 $vgpr1 = V_ADD_U32_e32 renamable $vgpr0, renamable $vgpr2, implicit $exec
239 TBUFFER_STORE_FORMAT_X_OFFSET_exact killed renamable $vgpr0, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 125, 0, 0, 0, implicit $exec
245 $vgpr1 = V_ADD_U32_e32 renamable $vgpr0, renamable $vgpr2, implicit $exec
256 $vgpr1 = V_ADD_U32_e32 renamable $vgpr0, renamable $vgpr2, implicit $exec
266 ; CHECK-LABEL: name: recursive_loop
268 ; CHECK-NEXT: successors: %bb.1(0x80000000)
270 ; CHECK-NEXT: renamable $vgpr0 = BUFFER_LOAD_FORMAT_X_IDXEN killed renamable $vgpr0, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit $exec
271 ; CHECK-NEXT: S_BRANCH %bb.1
274 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
276 ; CHECK-NEXT: S_CMP_LG_U32 killed renamable $sgpr3, renamable $sgpr4, implicit-def $scc
277 ; CHECK-NEXT: S_CBRANCH_SCC1 %bb.1, implicit killed $scc
278 ; CHECK-NEXT: S_BRANCH %bb.2
281 ; CHECK-NEXT: S_ENDPGM 0
285 renamable $vgpr0 = BUFFER_LOAD_FORMAT_X_IDXEN killed renamable $vgpr0, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit $exec
289 successors: %bb.1, %bb.2
291 S_CMP_LG_U32 killed renamable $sgpr3, renamable $sgpr4, implicit-def $scc
292 S_CBRANCH_SCC1 %bb.1, implicit killed $scc
300 name: recursive_loop_vmem
302 ; CHECK-LABEL: name: recursive_loop_vmem
304 ; CHECK-NEXT: successors: %bb.1(0x80000000)
306 ; CHECK-NEXT: renamable $vgpr0 = BUFFER_LOAD_FORMAT_X_IDXEN killed renamable $vgpr0, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit $exec
307 ; CHECK-NEXT: S_BRANCH %bb.1
310 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
312 ; CHECK-NEXT: TBUFFER_STORE_FORMAT_XYZW_OFFEN_exact killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $vgpr4, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 115, 0, 0, 0, implicit $exec
313 ; CHECK-NEXT: S_CMP_LG_U32 killed renamable $sgpr3, renamable $sgpr4, implicit-def $scc
314 ; CHECK-NEXT: S_CBRANCH_SCC1 %bb.1, implicit killed $scc
315 ; CHECK-NEXT: S_BRANCH %bb.2
318 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
319 ; CHECK-NEXT: S_ENDPGM 0
323 renamable $vgpr0 = BUFFER_LOAD_FORMAT_X_IDXEN killed renamable $vgpr0, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, implicit $exec
327 successors: %bb.1, %bb.2
329 TBUFFER_STORE_FORMAT_XYZW_OFFEN_exact killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $vgpr4, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 115, 0, 0, 0, implicit $exec
330 S_CMP_LG_U32 killed renamable $sgpr3, renamable $sgpr4, implicit-def $scc
331 S_CBRANCH_SCC1 %bb.1, implicit killed $scc
342 ; CHECK-LABEL: name: image_store
343 ; CHECK: IMAGE_STORE_V2_V1_gfx11 killed renamable $vgpr0_vgpr1, killed renamable $vgpr2, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7, 12, 0, 1, 0, 0, -1, 0, 0, 0, implicit $exec :: (dereferenceable store (<2 x s32>) into custom "ImageResource")
344 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
345 ; CHECK-NEXT: S_ENDPGM 0
346 IMAGE_STORE_V2_V1_gfx11 killed renamable $vgpr0_vgpr1, killed renamable $vgpr2, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7, 12, 0, 1, 0, 0, -1, 0, 0, 0, implicit $exec :: (dereferenceable store (<2 x s32>) into custom "ImageResource")
354 ; CHECK-LABEL: name: scratch_store
355 ; CHECK: renamable $sgpr0 = S_AND_B32 killed renamable $sgpr0, -16, implicit-def dead $scc
356 ; CHECK-NEXT: SCRATCH_STORE_DWORD_SADDR killed renamable $vgpr0, killed renamable $sgpr0, 0, 0, implicit $exec, implicit $flat_scr
357 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
358 ; CHECK-NEXT: S_ENDPGM 0
359 renamable $sgpr0 = S_AND_B32 killed renamable $sgpr0, -16, implicit-def dead $scc
360 SCRATCH_STORE_DWORD_SADDR killed renamable $vgpr0, killed renamable $sgpr0, 0, 0, implicit $exec, implicit $flat_scr
368 ; CHECK-LABEL: name: buffer_atomic
369 ; CHECK: BUFFER_ATOMIC_ADD_F32_OFFEN killed renamable $vgpr0, killed renamable $vgpr2, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, implicit $exec :: (volatile dereferenceable load store (s64), align 1, addrspace 4)
370 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
371 ; CHECK-NEXT: S_ENDPGM 0
372 BUFFER_ATOMIC_ADD_F32_OFFEN killed renamable $vgpr0, killed renamable $vgpr2, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, implicit $exec :: (volatile dereferenceable load store (s64), align 1, addrspace 4)
380 ; CHECK-LABEL: name: flat_atomic
381 ; CHECK: renamable $vgpr0_vgpr1 = FLAT_ATOMIC_DEC_X2_RTN killed renamable $vgpr0_vgpr1, killed renamable $vgpr2_vgpr3, 40, 1, implicit $exec, implicit $flat_scr
382 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
383 ; CHECK-NEXT: S_ENDPGM 0
384 renamable $vgpr0_vgpr1 = FLAT_ATOMIC_DEC_X2_RTN killed renamable $vgpr0_vgpr1, killed renamable $vgpr2_vgpr3, 40, 1, implicit $exec, implicit $flat_scr
393 ; CHECK-LABEL: name: global_atomic
394 ; CHECK: renamable $vgpr0_vgpr1 = GLOBAL_ATOMIC_INC_X2_SADDR_RTN killed renamable $vgpr0, killed renamable $vgpr1_vgpr2, killed renamable $sgpr0_sgpr1, 40, 1, implicit $exec
395 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
396 ; CHECK-NEXT: S_ENDPGM 0
397 renamable $vgpr0_vgpr1 = GLOBAL_ATOMIC_INC_X2_SADDR_RTN killed renamable $vgpr0, killed renamable $vgpr1_vgpr2, killed renamable $sgpr0_sgpr1, 40, 1, implicit $exec
405 ; CHECK-LABEL: name: image_atomic
406 ; CHECK: renamable $vgpr0_vgpr1_vgpr2_vgpr3 = IMAGE_ATOMIC_CMPSWAP_V2_V1_gfx11 killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $vgpr4, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7, 15, 0, 1, 1, 0, 0, 0, 0, implicit $exec :: (volatile dereferenceable load store (s64) on custom "ImageResource")
407 ; CHECK-NEXT: S_SENDMSG 3, implicit $exec, implicit $m0
408 ; CHECK-NEXT: S_ENDPGM 0
409 renamable $vgpr0_vgpr1_vgpr2_vgpr3 = IMAGE_ATOMIC_CMPSWAP_V2_V1_gfx11 killed renamable $vgpr0_vgpr1_vgpr2_vgpr3, killed renamable $vgpr4, killed renamable $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7, 15, 0, 1, 1, 0, 0, 0, 0, implicit $exec :: (volatile dereferenceable load store (s64) on custom "ImageResource")