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: successors: %bb.1(0x80000000)
15 ; GCN: liveins: $vgpr0_vgpr1
16 ; GCN: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
18 ; GCN: successors: %bb.1(0x40000000), %bb.2(0x40000000)
19 ; GCN: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
20 ; GCN: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
21 ; GCN: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, killed renamable $vgpr2, 0, 0, implicit $exec
22 ; GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
27 %0:vreg_64 = COPY $vgpr0_vgpr1
30 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
31 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
32 S_CBRANCH_EXECZ %bb.1, implicit $exec
40 name: self_loop_multi_def
41 tracksRegLiveness: true
44 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
45 stackPtrOffsetReg: '$sgpr32'
47 ; GCN-LABEL: name: self_loop_multi_def
49 ; GCN: successors: %bb.1(0x80000000)
50 ; GCN: liveins: $vgpr0_vgpr1
51 ; GCN: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
53 ; GCN: successors: %bb.1(0x40000000), %bb.2(0x40000000)
54 ; GCN: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
55 ; GCN: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
56 ; GCN: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, renamable $vgpr2, 0, 0, implicit $exec
57 ; GCN: renamable $vgpr2 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec
58 ; GCN: SI_SPILL_V32_SAVE $vgpr2, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
59 ; GCN: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, renamable $vgpr2, 0, 0, implicit $exec
60 ; GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
65 %0:vreg_64 = COPY $vgpr0_vgpr1
68 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
69 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
70 %1:vgpr_32 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
71 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
72 S_CBRANCH_EXECZ %bb.1, implicit $exec
79 # There's a single def inside the self loop, but it's also a use.
82 name: self_loop_def_use_same_inst
83 tracksRegLiveness: true
86 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
87 stackPtrOffsetReg: '$sgpr32'
89 ; GCN-LABEL: name: self_loop_def_use_same_inst
91 ; GCN: successors: %bb.1(0x80000000)
92 ; GCN: liveins: $vgpr0_vgpr1
93 ; GCN: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
95 ; GCN: successors: %bb.1(0x40000000), %bb.2(0x40000000)
96 ; GCN: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
97 ; GCN: renamable $vgpr2 = V_ADD_U32_e32 1, undef $vgpr0, implicit $exec
98 ; GCN: SI_SPILL_V32_SAVE $vgpr2, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
99 ; GCN: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, renamable $vgpr2, 0, 0, implicit $exec
100 ; GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
104 liveins: $vgpr0_vgpr1
105 %0:vreg_64 = COPY $vgpr0_vgpr1
108 %1:vgpr_32 = V_ADD_U32_e32 1, undef %1, implicit $exec
109 GLOBAL_STORE_DWORD %0, %1, 0, 0, implicit $exec
110 S_CBRANCH_EXECZ %bb.1, implicit $exec
118 name: self_loop_def_after_use
119 tracksRegLiveness: true
121 isEntryFunction: true
122 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
123 stackPtrOffsetReg: '$sgpr32'
125 ; GCN-LABEL: name: self_loop_def_after_use
127 ; GCN: successors: %bb.1(0x80000000)
128 ; GCN: liveins: $vgpr0_vgpr1
129 ; GCN: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
131 ; GCN: successors: %bb.1(0x40000000), %bb.2(0x40000000)
132 ; GCN: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
133 ; GCN: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, undef renamable $vgpr0, 0, 0, implicit $exec
134 ; GCN: renamable $vgpr0 = V_ADD_U32_e64 1, 1, 0, implicit $exec
135 ; GCN: SI_SPILL_V32_SAVE killed $vgpr0, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
136 ; GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
140 liveins: $vgpr0_vgpr1
141 %0:vreg_64 = COPY $vgpr0_vgpr1
144 GLOBAL_STORE_DWORD %0, undef %1, 0, 0, implicit $exec
145 %1:vgpr_32 = V_ADD_U32_e64 1, 1, 0, implicit $exec
146 S_CBRANCH_EXECZ %bb.1, implicit $exec
154 name: self_loop_single_subreg_def_use
155 tracksRegLiveness: true
157 isEntryFunction: true
158 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
159 stackPtrOffsetReg: '$sgpr32'
161 ; GCN-LABEL: name: self_loop_single_subreg_def_use
163 ; GCN: successors: %bb.1(0x80000000)
164 ; GCN: liveins: $vgpr0_vgpr1
165 ; GCN: SI_SPILL_V64_SAVE killed $vgpr0_vgpr1, %stack.0, $sgpr32, 0, implicit $exec :: (store (s64) into %stack.0, align 4, addrspace 5)
167 ; GCN: successors: %bb.1(0x40000000), %bb.2(0x40000000)
168 ; GCN: $vgpr0_vgpr1 = SI_SPILL_V64_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s64) from %stack.0, align 4, addrspace 5)
169 ; GCN: undef renamable $vgpr3 = GLOBAL_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec, implicit-def dead $vgpr2_vgpr3
170 ; GCN: GLOBAL_STORE_DWORD renamable $vgpr0_vgpr1, undef renamable $vgpr1, 0, 0, implicit $exec
171 ; GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
175 liveins: $vgpr0_vgpr1
176 %0:vreg_64 = COPY $vgpr0_vgpr1
179 undef %1.sub1:vreg_64 = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec
180 GLOBAL_STORE_DWORD %0, undef %1.sub1, 0, 0, implicit $exec
181 S_CBRANCH_EXECZ %bb.1, implicit $exec