1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 \
3 # RUN: -start-before=greedy,0 -stop-after=virtregrewriter,1 -verify-regalloc -o - %s | FileCheck %s
5 # This hit an assert when identifying snippet copy bundles from
6 # running off the end of the block due to using
7 # MachineBasicBlock::iterator instead of
8 # MachineBasicBlock::instr_iterator.
12 define amdgpu_kernel void @kernel() #0 {
17 attributes #0 = { "amdgpu-calls" "amdgpu-waves-per-eu"="10,10" "target-cpu"="gfx900" }
22 tracksRegLiveness: true
27 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
28 stackPtrOffsetReg: '$sgpr32'
31 ; CHECK-LABEL: name: kernel
33 ; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)
34 ; CHECK-NEXT: liveins: $sgpr14, $sgpr15, $sgpr16, $vgpr0, $vgpr1, $vgpr2, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr10_sgpr11
36 ; CHECK-NEXT: renamable $vgpr1 = IMPLICIT_DEF
37 ; CHECK-NEXT: renamable $sgpr34_sgpr35 = IMPLICIT_DEF
38 ; CHECK-NEXT: dead renamable $vgpr0 = IMPLICIT_DEF
39 ; CHECK-NEXT: renamable $sgpr41 = IMPLICIT_DEF
40 ; CHECK-NEXT: renamable $sgpr38_sgpr39 = COPY undef $sgpr8_sgpr9
41 ; CHECK-NEXT: renamable $sgpr36_sgpr37 = IMPLICIT_DEF
42 ; CHECK-NEXT: renamable $sgpr44_sgpr45_sgpr46_sgpr47_sgpr48_sgpr49_sgpr50_sgpr51 = S_LOAD_DWORDX8_IMM renamable $sgpr38_sgpr39, 0, 0 :: (dereferenceable invariant load (s256), align 16, addrspace 4)
43 ; CHECK-NEXT: dead renamable $sgpr4 = S_LOAD_DWORD_IMM renamable $sgpr38_sgpr39, 48, 0 :: (dereferenceable invariant load (s32), align 16, addrspace 4)
44 ; CHECK-NEXT: renamable $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11 = S_LOAD_DWORDX8_IMM renamable $sgpr38_sgpr39, 56, 0 :: (dereferenceable invariant load (s256), align 8, addrspace 4)
45 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 $sgpr4, 0, killed $vgpr1, implicit-def $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11, implicit $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11
46 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 $sgpr5, 1, killed $vgpr1
47 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 $sgpr6, 2, killed $vgpr1
48 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 $sgpr7, 3, killed $vgpr1
49 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 $sgpr8, 4, killed $vgpr1
50 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 $sgpr9, 5, killed $vgpr1
51 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 $sgpr10, 6, killed $vgpr1
52 ; CHECK-NEXT: renamable $vgpr1 = V_WRITELANE_B32 killed $sgpr11, 7, killed $vgpr1, implicit killed $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11
53 ; CHECK-NEXT: SI_SPILL_WWM_V32_SAVE killed $vgpr1, %stack.1, $sgpr32, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
54 ; CHECK-NEXT: dead renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM renamable $sgpr44_sgpr45, 0, 0 :: (invariant load (s64), align 16, addrspace 4)
55 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
56 ; CHECK-NEXT: $vgpr1 = COPY renamable $sgpr51
57 ; CHECK-NEXT: dead $sgpr30_sgpr31 = SI_CALL undef renamable $sgpr4_sgpr5, 0, csr_amdgpu, implicit undef $sgpr15, implicit $vgpr31, implicit $sgpr0_sgpr1_sgpr2_sgpr3
58 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
59 ; CHECK-NEXT: $vcc = COPY renamable $sgpr40_sgpr41
60 ; CHECK-NEXT: S_CBRANCH_VCCZ %bb.2, implicit undef $vcc
63 ; CHECK-NEXT: successors: %bb.3(0x80000000)
64 ; CHECK-NEXT: liveins: $sgpr34_sgpr35, $sgpr36_sgpr37, $sgpr38_sgpr39, $sgpr44_sgpr45_sgpr46_sgpr47_sgpr48_sgpr49_sgpr50_sgpr51:0x000000000000FC00
66 ; CHECK-NEXT: renamable $vgpr1 = SI_SPILL_WWM_V32_RESTORE %stack.1, $sgpr32, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5)
67 ; CHECK-NEXT: $sgpr4 = V_READLANE_B32 $vgpr1, 0, implicit-def $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11
68 ; CHECK-NEXT: $sgpr5 = V_READLANE_B32 $vgpr1, 1
69 ; CHECK-NEXT: $sgpr6 = V_READLANE_B32 $vgpr1, 2
70 ; CHECK-NEXT: $sgpr7 = V_READLANE_B32 $vgpr1, 3
71 ; CHECK-NEXT: $sgpr8 = V_READLANE_B32 $vgpr1, 4
72 ; CHECK-NEXT: $sgpr9 = V_READLANE_B32 $vgpr1, 5
73 ; CHECK-NEXT: $sgpr10 = V_READLANE_B32 $vgpr1, 6
74 ; CHECK-NEXT: $sgpr11 = V_READLANE_B32 $vgpr1, 7
75 ; CHECK-NEXT: $noreg = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
76 ; CHECK-NEXT: $exec = S_MOV_B64 killed $noreg
77 ; CHECK-NEXT: S_BRANCH %bb.3
80 ; CHECK-NEXT: successors: %bb.3(0x80000000)
81 ; CHECK-NEXT: liveins: $sgpr34_sgpr35, $sgpr36_sgpr37, $sgpr38_sgpr39, $sgpr44_sgpr45_sgpr46_sgpr47_sgpr48_sgpr49_sgpr50_sgpr51:0x000000000000FC00
83 ; CHECK-NEXT: renamable $vgpr1 = SI_SPILL_WWM_V32_RESTORE %stack.1, $sgpr32, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5)
84 ; CHECK-NEXT: $sgpr4 = V_READLANE_B32 $vgpr1, 0, implicit-def $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11
85 ; CHECK-NEXT: $sgpr5 = V_READLANE_B32 $vgpr1, 1
86 ; CHECK-NEXT: $sgpr6 = V_READLANE_B32 $vgpr1, 2
87 ; CHECK-NEXT: $sgpr7 = V_READLANE_B32 $vgpr1, 3
88 ; CHECK-NEXT: $sgpr8 = V_READLANE_B32 $vgpr1, 4
89 ; CHECK-NEXT: $sgpr9 = V_READLANE_B32 $vgpr1, 5
90 ; CHECK-NEXT: $sgpr10 = V_READLANE_B32 $vgpr1, 6
91 ; CHECK-NEXT: $sgpr11 = V_READLANE_B32 $vgpr1, 7
92 ; CHECK-NEXT: S_CMP_LG_U64 renamable $sgpr4_sgpr5, 0, implicit-def $scc
93 ; CHECK-NEXT: $noreg = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
94 ; CHECK-NEXT: $exec = S_MOV_B64 killed $noreg
97 ; CHECK-NEXT: successors: %bb.5(0x40000000), %bb.4(0x40000000)
98 ; CHECK-NEXT: liveins: $vgpr1, $sgpr34_sgpr35, $sgpr36_sgpr37, $sgpr38_sgpr39, $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11:0x00000000000003F0, $sgpr44_sgpr45_sgpr46_sgpr47_sgpr48_sgpr49_sgpr50_sgpr51:0x000000000000FC00
100 ; CHECK-NEXT: S_CBRANCH_VCCZ %bb.5, implicit undef $vcc
103 ; CHECK-NEXT: successors: %bb.5(0x80000000)
104 ; CHECK-NEXT: liveins: $vgpr1, $sgpr34_sgpr35, $sgpr36_sgpr37, $sgpr38_sgpr39, $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11:0x00000000000003F0, $sgpr44_sgpr45_sgpr46_sgpr47_sgpr48_sgpr49_sgpr50_sgpr51:0x000000000000FC00
106 ; CHECK-NEXT: S_CMP_EQ_U32 renamable $sgpr8, 0, implicit-def $scc
109 ; CHECK-NEXT: liveins: $vgpr1, $sgpr34_sgpr35, $sgpr36_sgpr37, $sgpr38_sgpr39, $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11:0x00000000000000F0, $sgpr44_sgpr45_sgpr46_sgpr47_sgpr48_sgpr49_sgpr50_sgpr51:0x000000000000FC00
111 ; CHECK-NEXT: dead renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr38_sgpr39, 40, 0 :: (dereferenceable invariant load (s64), addrspace 4)
112 ; CHECK-NEXT: GLOBAL_STORE_DWORD_SADDR undef renamable $vgpr0, undef renamable $vgpr0, killed renamable $sgpr6_sgpr7, 0, 0, implicit $exec :: (store (s32), addrspace 1)
113 ; CHECK-NEXT: GLOBAL_STORE_DWORD_SADDR undef renamable $vgpr0, undef renamable $vgpr0, renamable $sgpr50_sgpr51, 0, 0, implicit $exec :: (store (s32), addrspace 1)
114 ; CHECK-NEXT: dead renamable $vgpr0 = COPY killed renamable $sgpr49
115 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
116 ; CHECK-NEXT: $sgpr6_sgpr7 = COPY killed renamable $sgpr36_sgpr37
117 ; CHECK-NEXT: $sgpr10_sgpr11 = COPY killed renamable $sgpr34_sgpr35
118 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
119 ; CHECK-NEXT: KILL killed renamable $vgpr1
120 ; CHECK-NEXT: S_ENDPGM 0
122 liveins: $vgpr0, $vgpr1, $vgpr2, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr10_sgpr11, $sgpr14, $sgpr15, $sgpr16
124 %0:sgpr_64 = IMPLICIT_DEF
125 %1:vgpr_32 = IMPLICIT_DEF
126 undef %2.sub1:sreg_64 = IMPLICIT_DEF
127 %3:sgpr_64 = COPY undef $sgpr8_sgpr9
128 %4:sgpr_64 = IMPLICIT_DEF
129 %5:sgpr_256 = S_LOAD_DWORDX8_IMM %3, 0, 0 :: (dereferenceable invariant load (s256), align 16, addrspace 4)
130 %6:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %3, 48, 0 :: (dereferenceable invariant load (s32), align 16, addrspace 4)
131 %7:sgpr_256 = S_LOAD_DWORDX8_IMM %3, 56, 0 :: (dereferenceable invariant load (s256), align 8, addrspace 4)
132 %8:sreg_64_xexec = S_LOAD_DWORDX2_IMM %5.sub0_sub1, 0, 0 :: (invariant load (s64), align 16, addrspace 4)
133 ADJCALLSTACKUP 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
134 $vgpr1 = COPY %5.sub7
135 dead $sgpr30_sgpr31 = SI_CALL undef %8, 0, csr_amdgpu, implicit undef $sgpr15, implicit $vgpr31, implicit $sgpr0_sgpr1_sgpr2_sgpr3
136 ADJCALLSTACKDOWN 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
138 S_CBRANCH_VCCZ %bb.2, implicit undef $vcc
144 S_CMP_LG_U64 %7.sub0_sub1, 0, implicit-def $scc
147 S_CBRANCH_VCCZ %bb.5, implicit undef $vcc
150 S_CMP_EQ_U32 %7.sub4, 0, implicit-def $scc
153 %9:sreg_64_xexec = S_LOAD_DWORDX2_IMM %3, 40, 0 :: (dereferenceable invariant load (s64), addrspace 4)
154 GLOBAL_STORE_DWORD_SADDR undef %1, undef %1, %7.sub2_sub3, 0, 0, implicit $exec :: (store (s32), addrspace 1)
155 GLOBAL_STORE_DWORD_SADDR undef %1, undef %1, %5.sub6_sub7, 0, 0, implicit $exec :: (store (s32), addrspace 1)
156 %10:vgpr_32 = COPY %5.sub5
157 ADJCALLSTACKUP 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32
158 $sgpr6_sgpr7 = COPY %4
159 $sgpr10_sgpr11 = COPY %0
160 ADJCALLSTACKDOWN 0, 0, implicit-def dead $scc, implicit-def $sgpr32, implicit $sgpr32