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
3 # RUN: llc -verify-machineinstrs -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -passes=regallocfast -o - %s | FileCheck -check-prefix=GCN %s
6 name: self_loop_single_def_use
7 tracksRegLiveness: true
10 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
11 stackPtrOffsetReg: '$sgpr32'
13 ; GCN-LABEL: name: self_loop_single_def_use
15 ; GCN-NEXT: successors: %bb.1(0x80000000)
16 ; GCN-NEXT: liveins: $vgpr0_vgpr1
18 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
21 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
23 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
24 ; GCN-NEXT: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
25 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, killed renamable $vgpr2, 0, 0, implicit $exec
26 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
29 ; GCN-NEXT: S_ENDPGM 0
32 %0:vreg_64 = COPY $vgpr0_vgpr1
35 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
36 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
37 S_CBRANCH_EXECZ %bb.1, implicit $exec
45 name: self_loop_multi_def
46 tracksRegLiveness: true
49 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
50 stackPtrOffsetReg: '$sgpr32'
52 ; GCN-LABEL: name: self_loop_multi_def
54 ; GCN-NEXT: successors: %bb.1(0x80000000)
55 ; GCN-NEXT: liveins: $vgpr0_vgpr1
57 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
60 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
62 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
63 ; GCN-NEXT: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
64 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, renamable $vgpr2, 0, 0, implicit $exec
65 ; GCN-NEXT: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
66 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, killed renamable $vgpr2, 0, 0, implicit $exec
67 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
70 ; GCN-NEXT: S_ENDPGM 0
74 %0:vreg_64 = COPY $vgpr0_vgpr1
77 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
78 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
79 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
80 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
81 S_CBRANCH_EXECZ %bb.1, implicit $exec
88 # There's a single def inside the self loop, but it's also a use.
91 name: self_loop_def_use_same_inst
92 tracksRegLiveness: true
95 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
96 stackPtrOffsetReg: '$sgpr32'
98 ; GCN-LABEL: name: self_loop_def_use_same_inst
100 ; GCN-NEXT: successors: %bb.1(0x80000000)
101 ; GCN-NEXT: liveins: $vgpr0_vgpr1
103 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
106 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
108 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
109 ; GCN-NEXT: renamable $vgpr2 = V_ADD_U32_e32 1, undef $vgpr0, implicit $exec
110 ; GCN-NEXT: SI_SPILL_V32_SAVE $vgpr2, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
111 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, renamable $vgpr2, 0, 0, implicit $exec
112 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
115 ; GCN-NEXT: S_ENDPGM 0
117 liveins: $vgpr0_vgpr1
118 %0:vreg_64 = COPY $vgpr0_vgpr1
121 %1:vgpr_32 = V_ADD_U32_e32 1, undef %1, implicit $exec
122 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
123 S_CBRANCH_EXECZ %bb.1, implicit $exec
131 name: self_loop_def_after_use
132 tracksRegLiveness: true
134 isEntryFunction: true
135 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
136 stackPtrOffsetReg: '$sgpr32'
138 ; GCN-LABEL: name: self_loop_def_after_use
140 ; GCN-NEXT: successors: %bb.1(0x80000000)
141 ; GCN-NEXT: liveins: $vgpr0_vgpr1
143 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
146 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
148 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
149 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, undef renamable $vgpr0, 0, 0, implicit $exec
150 ; GCN-NEXT: renamable $vgpr0 = V_ADD_U32_e64 1, 1, 0, implicit $exec
151 ; GCN-NEXT: SI_SPILL_V32_SAVE killed $vgpr0, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
152 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
155 ; GCN-NEXT: S_ENDPGM 0
157 liveins: $vgpr0_vgpr1
158 %0:vreg_64 = COPY $vgpr0_vgpr1
161 GLOBAL_STORE_DWORD %0, undef %1, 0, 0, implicit $exec
162 %1:vgpr_32 = V_ADD_U32_e64 1, 1, 0, implicit $exec
163 S_CBRANCH_EXECZ %bb.1, implicit $exec
171 name: self_loop_single_subreg_def_use
172 tracksRegLiveness: true
174 isEntryFunction: true
175 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
176 stackPtrOffsetReg: '$sgpr32'
178 ; GCN-LABEL: name: self_loop_single_subreg_def_use
180 ; GCN-NEXT: successors: %bb.1(0x80000000)
181 ; GCN-NEXT: liveins: $vgpr0_vgpr1
183 ; GCN-NEXT: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
186 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
188 ; GCN-NEXT: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
189 ; GCN-NEXT: undef renamable $vgpr3 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec, implicit-def dead $vgpr2_vgpr3
190 ; GCN-NEXT: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, undef renamable $vgpr1, 0, 0, implicit $exec
191 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
194 ; GCN-NEXT: S_ENDPGM 0
196 liveins: $vgpr0_vgpr1
197 %0:vreg_64 = COPY $vgpr0_vgpr1
200 undef %1.sub1:vreg_64 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
201 GLOBAL_STORE_DWORD %0, undef %1.sub1, 0, 0, implicit $exec
202 S_CBRANCH_EXECZ %bb.1, implicit $exec