1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -verify-machineinstrs -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=regallocfast -o - %s | FileCheck -check-prefix=GCN %s
5 name: self_loop_single_def_use
6 tracksRegLiveness: true
9 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
10 stackPtrOffsetReg: '$sgpr32'
12 ; GCN-LABEL: name: self_loop_single_def_use
14 ; GCN-NEXT: successors: %bb.1(0x80000000)
15 ; GCN-NEXT: liveins: $vgpr0_vgpr1
17 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
20 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
22 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
23 ; GCN-NEXT: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
24 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, killed renamable $vgpr2, 0, 0, implicit $exec
25 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
28 ; GCN-NEXT: S_ENDPGM 0
31 %0:vreg_64 = COPY $vgpr0_vgpr1
34 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
35 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
36 S_CBRANCH_EXECZ %bb.1, implicit $exec
44 name: self_loop_multi_def
45 tracksRegLiveness: true
48 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
49 stackPtrOffsetReg: '$sgpr32'
51 ; GCN-LABEL: name: self_loop_multi_def
53 ; GCN-NEXT: successors: %bb.1(0x80000000)
54 ; GCN-NEXT: liveins: $vgpr0_vgpr1
56 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
59 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
61 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
62 ; GCN-NEXT: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
63 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, renamable $vgpr2, 0, 0, implicit $exec
64 ; GCN-NEXT: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
65 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, killed renamable $vgpr2, 0, 0, implicit $exec
66 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
69 ; GCN-NEXT: S_ENDPGM 0
73 %0:vreg_64 = COPY $vgpr0_vgpr1
76 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
77 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
78 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
79 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
80 S_CBRANCH_EXECZ %bb.1, implicit $exec
87 # There's a single def inside the self loop, but it's also a use.
90 name: self_loop_def_use_same_inst
91 tracksRegLiveness: true
94 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
95 stackPtrOffsetReg: '$sgpr32'
97 ; GCN-LABEL: name: self_loop_def_use_same_inst
99 ; GCN-NEXT: successors: %bb.1(0x80000000)
100 ; GCN-NEXT: liveins: $vgpr0_vgpr1
102 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
105 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
107 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
108 ; GCN-NEXT: renamable $vgpr2 = V_ADD_U32_e32 1, undef $vgpr0, implicit $exec
109 ; GCN-NEXT: SI_SPILL_V32_SAVE $vgpr2, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
110 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, renamable $vgpr2, 0, 0, implicit $exec
111 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
114 ; GCN-NEXT: S_ENDPGM 0
116 liveins: $vgpr0_vgpr1
117 %0:vreg_64 = COPY $vgpr0_vgpr1
120 %1:vgpr_32 = V_ADD_U32_e32 1, undef %1, implicit $exec
121 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
122 S_CBRANCH_EXECZ %bb.1, implicit $exec
130 name: self_loop_def_after_use
131 tracksRegLiveness: true
133 isEntryFunction: true
134 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
135 stackPtrOffsetReg: '$sgpr32'
137 ; GCN-LABEL: name: self_loop_def_after_use
139 ; GCN-NEXT: successors: %bb.1(0x80000000)
140 ; GCN-NEXT: liveins: $vgpr0_vgpr1
142 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
145 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
147 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
148 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, undef renamable $vgpr0, 0, 0, implicit $exec
149 ; GCN-NEXT: renamable $vgpr0 = V_ADD_U32_e64 1, 1, 0, implicit $exec
150 ; GCN-NEXT: SI_SPILL_V32_SAVE killed $vgpr0, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
151 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
154 ; GCN-NEXT: S_ENDPGM 0
156 liveins: $vgpr0_vgpr1
157 %0:vreg_64 = COPY $vgpr0_vgpr1
160 GLOBAL_STORE_DWORD %0, undef %1, 0, 0, implicit $exec
161 %1:vgpr_32 = V_ADD_U32_e64 1, 1, 0, implicit $exec
162 S_CBRANCH_EXECZ %bb.1, implicit $exec
170 name: self_loop_single_subreg_def_use
171 tracksRegLiveness: true
173 isEntryFunction: true
174 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
175 stackPtrOffsetReg: '$sgpr32'
177 ; GCN-LABEL: name: self_loop_single_subreg_def_use
179 ; GCN-NEXT: successors: %bb.1(0x80000000)
180 ; GCN-NEXT: liveins: $vgpr0_vgpr1
182 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
185 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
187 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
188 ; GCN-NEXT: undef renamable $vgpr3 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec, implicit-def dead $vgpr2_vgpr3
189 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, undef renamable $vgpr1, 0, 0, implicit $exec
190 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
193 ; GCN-NEXT: S_ENDPGM 0
195 liveins: $vgpr0_vgpr1
196 %0:vreg_64 = COPY $vgpr0_vgpr1
199 undef %1.sub1:vreg_64 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
200 GLOBAL_STORE_DWORD %0, undef %1.sub1, 0, 0, implicit $exec
201 S_CBRANCH_EXECZ %bb.1, implicit $exec