1 # RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass greedy,amdgpu-regbanks-reassign,virtregrewriter -o - %s | FileCheck -check-prefix=GCN %s
3 # GCN-LABEL: v1_vs_v5{{$}}
4 # GCN: V_AND_B32_e32 killed $vgpr3, killed $vgpr1,
7 tracksRegLiveness: true
9 - { id: 0, class: vgpr_32, preferred-register: '$vgpr1' }
10 - { id: 1, class: vgpr_32, preferred-register: '$vgpr5' }
11 - { id: 2, class: vgpr_32 }
16 %2 = V_AND_B32_e32 %1, %0, implicit $exec
20 # GCN-LABEL: v0_1_vs_v4{{$}}
21 # GCN: GLOBAL_STORE_DWORD killed renamable $vgpr0_vgpr1, killed renamable $vgpr3,
24 tracksRegLiveness: true
26 - { id: 0, class: vgpr_32, preferred-register: '$vgpr4' }
27 - { id: 1, class: vreg_64, preferred-register: '$vgpr0_vgpr1' }
32 GLOBAL_STORE_DWORD %1, %0, 0, 0, 0, 0, implicit $exec
36 # GCN-LABEL: v1_2_vs_v4_5{{$}}
37 # GCN: GLOBAL_STORE_DWORDX2 killed renamable $vgpr2_vgpr3, killed renamable $vgpr4_vgpr5,
40 tracksRegLiveness: true
42 - { id: 0, class: vreg_64, preferred-register: '$vgpr4_vgpr5' }
43 - { id: 1, class: vreg_64, preferred-register: '$vgpr1_vgpr2' }
48 GLOBAL_STORE_DWORDX2 %1, %0, 0, 0, 0, 0, implicit $exec
52 # GCN-LABEL: s11_vs_vcc{{$}}
53 # GCN: $vgpr0, $vcc_lo = V_ADDC_U32_e64 killed $sgpr14, killed $vgpr0, killed $vcc_lo, 0
56 tracksRegLiveness: true
58 - { id: 0, class: sgpr_32, preferred-register: '$sgpr11' }
59 - { id: 1, class: vgpr_32 }
60 - { id: 2, class: vgpr_32 }
65 $vcc_lo = IMPLICIT_DEF
66 %2, $vcc_lo = V_ADDC_U32_e64 killed %0, killed %1, killed $vcc_lo, 0, implicit $exec
70 # GCN-LABEL: s0_vs_s16{{$}}
71 # GCN: S_AND_B32 killed renamable $sgpr14, $sgpr0,
74 tracksRegLiveness: true
76 - { id: 0, class: sgpr_32, preferred-register: '$sgpr16' }
77 - { id: 1, class: sgpr_32 }
82 %1 = S_AND_B32 %0, $sgpr0, implicit-def $scc
86 # GCN-LABEL: s1_vs_s16{{$}}
87 # GCN: S_AND_B32 killed renamable $sgpr14, $sgpr1,
90 tracksRegLiveness: true
92 - { id: 0, class: sgpr_32, preferred-register: '$sgpr16' }
93 - { id: 1, class: sgpr_32 }
98 %1 = S_AND_B32 %0, $sgpr1, implicit-def $scc
102 # GCN-LABEL: s12_vs_null{{$}}
103 # GCN: S_AND_B32 $sgpr_null, killed renamable $sgpr14,
106 tracksRegLiveness: true
108 - { id: 0, class: sgpr_32, preferred-register: '$sgpr12' }
109 - { id: 1, class: sgpr_32 }
113 %1 = S_AND_B32 $sgpr_null, %0, implicit-def $scc
117 # GCN-LABEL: s13_vs_m0{{$}}
118 # GCN: S_AND_B32 $m0, killed renamable $sgpr14,
121 tracksRegLiveness: true
123 - { id: 0, class: sgpr_32, preferred-register: '$sgpr13' }
124 - { id: 1, class: sgpr_32 }
128 %1 = S_AND_B32 $m0, %0, implicit-def $scc
132 # GCN-LABEL: s12_13_vs_s28_s29{{$}}
133 # GCN: S_AND_B64 $sgpr28_sgpr29, killed renamable $sgpr14_sgpr15,
135 name: s12_13_vs_s28_s29
136 tracksRegLiveness: true
138 - { id: 0, class: sreg_64, preferred-register: '$sgpr12_sgpr13' }
139 - { id: 1, class: sreg_64 }
143 $sgpr28_sgpr29 = IMPLICIT_DEF
144 %1 = S_AND_B64 $sgpr28_sgpr29, %0, implicit-def $scc
148 # GCN-LABEL: livein{{$}}
149 # GCN: V_AND_B32_e32 killed $vgpr4, killed $vgpr0,
152 tracksRegLiveness: true
154 - { id: 0, class: vgpr_32, preferred-register: '$vgpr0' }
155 - { id: 1, class: vgpr_32, preferred-register: '$vgpr4' }
156 - { id: 2, class: vgpr_32 }
158 - { reg: '$vgpr0', virtual-reg: '' }
159 - { reg: '$vgpr4', virtual-reg: '' }
162 liveins: $vgpr0, $vgpr4
166 %2 = V_AND_B32_e32 %1, %0, implicit $exec
170 # GCN-LABEL: liveout{{$}}
171 # GCN: V_AND_B32_e32 $vgpr4, $vgpr0,
174 tracksRegLiveness: true
176 - { id: 0, class: vgpr_32, preferred-register: '$vgpr0' }
177 - { id: 1, class: vgpr_32, preferred-register: '$vgpr4' }
178 - { id: 2, class: vgpr_32 }
183 %2 = V_AND_B32_e32 %1, %0, implicit $exec
189 # GCN-LABEL: implicit{{$}}
190 # GCN: V_MOV_B32_indirect undef $vgpr4, undef $vgpr0, implicit $exec, implicit-def dead renamable $vgpr0_vgpr1_vgpr2_vgpr3, implicit killed $vgpr4_vgpr5_vgpr6_vgpr7, implicit $m0
193 tracksRegLiveness: true
195 - { id: 0, class: vreg_128 }
196 - { id: 1, class: vreg_128, preferred-register: '$vgpr4_vgpr5_vgpr6_vgpr7' }
200 V_MOV_B32_indirect undef %1.sub0:vreg_128, undef $vgpr0, implicit $exec, implicit-def %0:vreg_128, implicit %1:vreg_128, implicit $m0
204 # GCN-LABEL: occupancy_limit{{$}}
205 # GCN: V_AND_B32_e32 $vgpr4, $vgpr0,
207 name: occupancy_limit
208 tracksRegLiveness: true
210 - { id: 0, class: vgpr_32, preferred-register: '$vgpr0' }
211 - { id: 1, class: vgpr_32, preferred-register: '$vgpr4' }
212 - { id: 2, class: vgpr_32, preferred-register: '$vgpr1' }
213 - { id: 3, class: vreg_64, preferred-register: '$vgpr2_vgpr3' }
214 - { id: 4, class: vgpr_32, preferred-register: '$vgpr5' }
215 - { id: 5, class: vreg_64, preferred-register: '$vgpr6_vgpr7' }
216 - { id: 6, class: vreg_128, preferred-register: '$vgpr8_vgpr9_vgpr10_vgpr11' }
217 - { id: 7, class: vreg_128, preferred-register: '$vgpr12_vgpr13_vgpr14_vgpr15' }
218 - { id: 8, class: vreg_128, preferred-register: '$vgpr16_vgpr17_vgpr18_vgpr19' }
219 - { id: 9, class: vreg_128, preferred-register: '$vgpr20_vgpr21_vgpr22_vgpr23' }
220 - { id: 10, class: vreg_128, preferred-register: '$vgpr24_vgpr25_vgpr26_vgpr27' }
221 - { id: 11, class: vreg_128, preferred-register: '$vgpr28_vgpr29_vgpr30_vgpr31' }
222 - { id: 12, class: vreg_128, preferred-register: '$vgpr32_vgpr33_vgpr34_vgpr35' }
223 - { id: 13, class: vreg_128, preferred-register: '$vgpr36_vgpr37_vgpr38_vgpr39' }
224 - { id: 14, class: vreg_128, preferred-register: '$vgpr40_vgpr41_vgpr42_vgpr43' }
225 - { id: 15, class: vreg_128, preferred-register: '$vgpr44_vgpr45_vgpr46_vgpr47' }
243 %2 = V_AND_B32_e32 %1, %0, implicit $exec
244 GLOBAL_STORE_DWORD %3, %0, 0, 0, 0, 0, implicit $exec
245 GLOBAL_STORE_DWORD %3, %1, 0, 0, 0, 0, implicit $exec
246 GLOBAL_STORE_DWORD %3, %2, 0, 0, 0, 0, implicit $exec
247 GLOBAL_STORE_DWORD %3, %4, 0, 0, 0, 0, implicit $exec
248 GLOBAL_STORE_DWORDX2 %3, %5, 0, 0, 0, 0, implicit $exec
249 GLOBAL_STORE_DWORDX4 %3, %6, 0, 0, 0, 0, implicit $exec
250 GLOBAL_STORE_DWORDX4 %3, %7, 0, 0, 0, 0, implicit $exec
251 GLOBAL_STORE_DWORDX4 %3, %8, 0, 0, 0, 0, implicit $exec
252 GLOBAL_STORE_DWORDX4 %3, %9, 0, 0, 0, 0, implicit $exec
256 # GCN-LABEL: csr{{$}}
257 # GCN: V_AND_B32_e32 $vgpr4, $vgpr0,
260 tracksRegLiveness: true
262 - { id: 0, class: vgpr_32, preferred-register: '$vgpr0' }
263 - { id: 1, class: vgpr_32, preferred-register: '$vgpr4' }
264 - { id: 2, class: vgpr_32, preferred-register: '$vgpr1' }
265 - { id: 3, class: vreg_64, preferred-register: '$vgpr2_vgpr3' }
266 - { id: 4, class: vgpr_32, preferred-register: '$vgpr5' }
267 - { id: 5, class: vreg_64, preferred-register: '$vgpr6_vgpr7' }
268 - { id: 6, class: vreg_128, preferred-register: '$vgpr8_vgpr9_vgpr10_vgpr11' }
269 - { id: 7, class: vreg_128, preferred-register: '$vgpr12_vgpr13_vgpr14_vgpr15' }
270 - { id: 8, class: vreg_128, preferred-register: '$vgpr16_vgpr17_vgpr18_vgpr19' }
271 - { id: 9, class: vreg_128, preferred-register: '$vgpr20_vgpr21_vgpr22_vgpr23' }
272 - { id: 10, class: vreg_128, preferred-register: '$vgpr24_vgpr25_vgpr26_vgpr27' }
273 - { id: 11, class: vreg_128, preferred-register: '$vgpr28_vgpr29_vgpr30_vgpr31' }
274 - { id: 12, class: vgpr_32, preferred-register: '$vgpr33' }
289 %2 = V_AND_B32_e32 %1, %0, implicit $exec
290 GLOBAL_STORE_DWORD %3, %0, 0, 0, 0, 0, implicit $exec
291 GLOBAL_STORE_DWORD %3, %1, 0, 0, 0, 0, implicit $exec
292 GLOBAL_STORE_DWORD %3, %2, 0, 0, 0, 0, implicit $exec
293 GLOBAL_STORE_DWORD %3, %4, 0, 0, 0, 0, implicit $exec
294 GLOBAL_STORE_DWORDX2 %3, %5, 0, 0, 0, 0, implicit $exec
295 GLOBAL_STORE_DWORDX4 %3, %6, 0, 0, 0, 0, implicit $exec
296 GLOBAL_STORE_DWORDX4 %3, %7, 0, 0, 0, 0, implicit $exec
297 GLOBAL_STORE_DWORDX4 %3, %8, 0, 0, 0, 0, implicit $exec
298 GLOBAL_STORE_DWORDX4 %3, %9, 0, 0, 0, 0, implicit $exec
299 GLOBAL_STORE_DWORDX4 %3, %10, 0, 0, 0, 0, implicit $exec
300 GLOBAL_STORE_DWORDX4 %3, %11, 0, 0, 0, 0, implicit $exec
301 GLOBAL_STORE_DWORD %3, %12, 0, 0, 0, 0, implicit $exec
305 # Do not touch undefs
306 # GCN-LABEL: s0_vs_s16_undef{{$}}
307 # GCN: S_AND_B32 killed renamable $sgpr16, undef $sgpr0,
309 name: s0_vs_s16_undef
310 tracksRegLiveness: true
312 - { id: 0, class: sgpr_32, preferred-register: '$sgpr16' }
313 - { id: 1, class: sgpr_32 }
317 %1 = S_AND_B32 %0, undef $sgpr0, implicit-def $scc
321 # GCN-LABEL: smem_bundle{{$}}
322 # GCN: S_BUFFER_LOAD_DWORD_SGPR renamable $sgpr0_sgpr1_sgpr2_sgpr3, renamable $sgpr15, 0, 0
323 # GCN: S_BUFFER_LOAD_DWORD_SGPR renamable $sgpr0_sgpr1_sgpr2_sgpr3, renamable $sgpr14, 0, 0
326 tracksRegLiveness: true
328 - { id: 0, class: sgpr_128, preferred-register: '$sgpr0_sgpr1_sgpr2_sgpr3' }
329 - { id: 1, class: sreg_32_xm0_xexec, preferred-register: '$sgpr16' }
330 - { id: 2, class: sreg_32_xm0_xexec, preferred-register: '$sgpr17' }
331 - { id: 3, class: sreg_32_xm0_xexec, preferred-register: '$sgpr4' }
332 - { id: 4, class: sreg_32_xm0_xexec, preferred-register: '$sgpr5' }
338 early-clobber %3, early-clobber %4 = BUNDLE %0, %1, %2 {
339 %3 = S_BUFFER_LOAD_DWORD_SGPR %0, %1, 0, 0
340 %4 = S_BUFFER_LOAD_DWORD_SGPR %0, %2, 0, 0
345 # GCN-LABEL: vreg_512_subs{{$}}
346 # don't care about the assignment: this used to trigger an infinite loop
349 tracksRegLiveness: true
351 - { id: 1, class: vreg_512, preferred-register: '$vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15' }
352 - { id: 2, class: vgpr_32, preferred-register: '$vgpr28' }
357 DS_WRITE2_B32_gfx9 %2, %1.sub0, %1.sub1, 0, 1, 0, implicit $exec
358 DS_WRITE2_B32_gfx9 %2, %1.sub2, %1.sub3, 2, 3, 0, implicit $exec
359 DS_WRITE2_B32_gfx9 %2, %1.sub4, %1.sub5, 4, 5, 0, implicit $exec
360 DS_WRITE2_B32_gfx9 %2, %1.sub6, %1.sub7, 6, 7, 0, implicit $exec
361 DS_WRITE2_B32_gfx9 %2, %1.sub8, %1.sub9, 8, 9, 0, implicit $exec
362 DS_WRITE2_B32_gfx9 %2, %1.sub10, %1.sub11, 10, 11, 0, implicit $exec
363 DS_WRITE2_B32_gfx9 %2, %1.sub12, %1.sub13, 12, 13, 0, implicit $exec
364 DS_WRITE2_B32_gfx9 %2, %1.sub14, %1.sub15, 14, 15, 0, implicit $exec