1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -run-pass=si-pre-emit-peephole -amdgpu-skip-threshold=1000000 -o - %s | FileCheck %s
5 name: skip_branch_taildup_endpgm
9 ; CHECK-LABEL: name: skip_branch_taildup_endpgm
11 ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.1(0x40000000)
12 ; CHECK-NEXT: liveins: $vgpr0, $sgpr4_sgpr5, $sgpr7
14 ; CHECK-NEXT: renamable $sgpr0_sgpr1 = S_LOAD_DWORDX2_IMM renamable $sgpr4_sgpr5, 4, 0 :: (dereferenceable invariant load (s64), align 16, addrspace 4)
15 ; CHECK-NEXT: renamable $vgpr0 = V_LSHLREV_B32_e32 2, killed $vgpr0, implicit $exec
16 ; CHECK-NEXT: S_WAITCNT 127
17 ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit $exec
18 ; CHECK-NEXT: renamable $vgpr0 = V_ADD_CO_U32_e32 $sgpr0, killed $vgpr0, implicit-def $vcc, implicit $exec
19 ; CHECK-NEXT: renamable $vgpr1 = V_ADDC_U32_e32 0, killed $vgpr1, implicit-def $vcc, implicit killed $vcc, implicit $exec
20 ; CHECK-NEXT: renamable $vgpr0 = FLAT_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32), addrspace 1)
21 ; CHECK-NEXT: renamable $sgpr0_sgpr1 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (s64), align 16, addrspace 4)
22 ; CHECK-NEXT: S_WAITCNT 112
23 ; CHECK-NEXT: V_CMP_NE_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
24 ; CHECK-NEXT: $sgpr2_sgpr3 = S_AND_SAVEEXEC_B64 $vcc, implicit-def $exec, implicit-def $scc, implicit $exec
25 ; CHECK-NEXT: renamable $sgpr2_sgpr3 = S_XOR_B64 $exec, killed renamable $sgpr2_sgpr3, implicit-def dead $scc
26 ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
27 ; CHECK-NEXT: S_BRANCH %bb.3
30 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.2(0x40000000)
31 ; CHECK-NEXT: liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
33 ; CHECK-NEXT: renamable $sgpr2_sgpr3 = S_OR_SAVEEXEC_B64 killed renamable $sgpr2_sgpr3, implicit-def $exec, implicit-def $scc, implicit $exec
34 ; CHECK-NEXT: $exec = S_XOR_B64 $exec, renamable $sgpr2_sgpr3, implicit-def $scc
35 ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
36 ; CHECK-NEXT: S_BRANCH %bb.4
39 ; CHECK-NEXT: liveins: $sgpr2_sgpr3
41 ; CHECK-NEXT: $exec = S_OR_B64 $exec, killed renamable $sgpr2_sgpr3, implicit-def $scc
42 ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
43 ; CHECK-NEXT: S_ENDPGM 0
46 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.2(0x40000000)
47 ; CHECK-NEXT: liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
49 ; CHECK-NEXT: renamable $vgpr2 = V_MOV_B32_e32 15, implicit $exec
50 ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $sgpr0_sgpr1
51 ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit $sgpr0_sgpr1, implicit $exec
52 ; CHECK-NEXT: renamable $sgpr2_sgpr3 = S_OR_SAVEEXEC_B64 killed renamable $sgpr2_sgpr3, implicit-def $exec, implicit-def $scc, implicit $exec
53 ; CHECK-NEXT: $exec = S_XOR_B64 $exec, renamable $sgpr2_sgpr3, implicit-def $scc
54 ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
55 ; CHECK-NEXT: S_BRANCH %bb.4
58 ; CHECK-NEXT: liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
60 ; CHECK-NEXT: renamable $vgpr2 = V_MOV_B32_e32 8, implicit $exec
61 ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $sgpr0_sgpr1
62 ; CHECK-NEXT: $vgpr1 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit killed $sgpr0_sgpr1, implicit $exec
63 ; CHECK-NEXT: $exec = S_OR_B64 $exec, killed renamable $sgpr2_sgpr3, implicit-def $scc
64 ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
65 ; CHECK-NEXT: S_ENDPGM 0
67 successors: %bb.1, %bb.2
68 liveins: $vgpr0, $sgpr4_sgpr5, $sgpr7
70 renamable $sgpr0_sgpr1 = S_LOAD_DWORDX2_IMM renamable $sgpr4_sgpr5, 4, 0 :: (dereferenceable invariant load (s64), align 16, addrspace 4)
71 renamable $vgpr0 = V_LSHLREV_B32_e32 2, killed $vgpr0, implicit $exec
73 $vgpr1 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit $exec
74 renamable $vgpr0 = V_ADD_CO_U32_e32 $sgpr0, killed $vgpr0, implicit-def $vcc, implicit $exec
75 renamable $vgpr1 = V_ADDC_U32_e32 0, killed $vgpr1, implicit-def $vcc, implicit killed $vcc, implicit $exec
76 renamable $vgpr0 = FLAT_LOAD_DWORD renamable $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32), addrspace 1)
77 renamable $sgpr0_sgpr1 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (s64), align 16, addrspace 4)
79 V_CMP_NE_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
80 $sgpr2_sgpr3 = S_AND_SAVEEXEC_B64 $vcc, implicit-def $exec, implicit-def $scc, implicit $exec
81 renamable $sgpr2_sgpr3 = S_XOR_B64 $exec, killed renamable $sgpr2_sgpr3, implicit-def dead $scc
82 S_CBRANCH_EXECZ %bb.2, implicit $exec
86 successors: %bb.3, %bb.4
87 liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
89 renamable $sgpr2_sgpr3 = S_OR_SAVEEXEC_B64 killed renamable $sgpr2_sgpr3, implicit-def $exec, implicit-def $scc, implicit $exec
90 $exec = S_XOR_B64 $exec, renamable $sgpr2_sgpr3, implicit-def $scc
91 S_CBRANCH_EXECZ %bb.4, implicit $exec
97 $exec = S_OR_B64 $exec, killed renamable $sgpr2_sgpr3, implicit-def $scc
98 renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
102 successors: %bb.3, %bb.4
103 liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
105 renamable $vgpr2 = V_MOV_B32_e32 15, implicit $exec
106 $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $sgpr0_sgpr1
107 $vgpr1 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit $sgpr0_sgpr1, implicit $exec
108 renamable $sgpr2_sgpr3 = S_OR_SAVEEXEC_B64 killed renamable $sgpr2_sgpr3, implicit-def $exec, implicit-def $scc, implicit $exec
109 $exec = S_XOR_B64 $exec, renamable $sgpr2_sgpr3, implicit-def $scc
110 S_CBRANCH_EXECZ %bb.4, implicit $exec
114 liveins: $sgpr0_sgpr1, $sgpr2_sgpr3
116 renamable $vgpr2 = V_MOV_B32_e32 8, implicit $exec
117 $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $sgpr0_sgpr1
118 $vgpr1 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit killed $sgpr0_sgpr1, implicit $exec
119 $exec = S_OR_B64 $exec, killed renamable $sgpr2_sgpr3, implicit-def $scc
120 renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
126 name: skip_branch_taildup_ret
128 ; CHECK-LABEL: name: skip_branch_taildup_ret
130 ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.1(0x40000000)
131 ; CHECK-NEXT: liveins: $vgpr0, $sgpr30_sgpr31, $vgpr1_vgpr2
133 ; CHECK-NEXT: S_WAITCNT 0
134 ; CHECK-NEXT: V_CMP_NE_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
135 ; CHECK-NEXT: $sgpr6_sgpr7 = S_AND_SAVEEXEC_B64 $vcc, implicit-def $exec, implicit-def $scc, implicit $exec
136 ; CHECK-NEXT: renamable $sgpr6_sgpr7 = S_XOR_B64 $exec, killed renamable $sgpr6_sgpr7, implicit-def dead $scc
137 ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
138 ; CHECK-NEXT: S_BRANCH %bb.3
141 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.2(0x40000000)
142 ; CHECK-NEXT: liveins: $sgpr6_sgpr7, $sgpr30_sgpr31, $vgpr1_vgpr2
144 ; CHECK-NEXT: renamable $sgpr6_sgpr7 = S_OR_SAVEEXEC_B64 killed renamable $sgpr6_sgpr7, implicit-def $exec, implicit-def $scc, implicit $exec
145 ; CHECK-NEXT: $exec = S_XOR_B64 $exec, renamable $sgpr6_sgpr7, implicit-def $scc
146 ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
147 ; CHECK-NEXT: S_BRANCH %bb.4
150 ; CHECK-NEXT: liveins: $sgpr6_sgpr7, $sgpr30_sgpr31
152 ; CHECK-NEXT: $exec = S_OR_B64 $exec, killed renamable $sgpr6_sgpr7, implicit-def $scc
153 ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
154 ; CHECK-NEXT: S_SETPC_B64_return $sgpr30_sgpr31
157 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.2(0x40000000)
158 ; CHECK-NEXT: liveins: $sgpr6_sgpr7, $sgpr30_sgpr31, $vgpr1_vgpr2
160 ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 15, implicit $exec
161 ; CHECK-NEXT: renamable $sgpr6_sgpr7 = S_OR_SAVEEXEC_B64 killed renamable $sgpr6_sgpr7, implicit-def $exec, implicit-def $scc, implicit $exec
162 ; CHECK-NEXT: $exec = S_XOR_B64 $exec, renamable $sgpr6_sgpr7, implicit-def $scc
163 ; CHECK-NEXT: S_CBRANCH_EXECZ %bb.2, implicit $exec
164 ; CHECK-NEXT: S_BRANCH %bb.4
167 ; CHECK-NEXT: liveins: $sgpr6_sgpr7, $sgpr30_sgpr31, $vgpr1_vgpr2
169 ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 8, implicit $exec
170 ; CHECK-NEXT: $exec = S_OR_B64 $exec, killed renamable $sgpr6_sgpr7, implicit-def $scc
171 ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
172 ; CHECK-NEXT: S_SETPC_B64_return $sgpr30_sgpr31
174 successors: %bb.1, %bb.2
175 liveins: $vgpr0, $sgpr30_sgpr31, $vgpr1_vgpr2
178 V_CMP_NE_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
179 $sgpr6_sgpr7 = S_AND_SAVEEXEC_B64 $vcc, implicit-def $exec, implicit-def $scc, implicit $exec
180 renamable $sgpr6_sgpr7 = S_XOR_B64 $exec, killed renamable $sgpr6_sgpr7, implicit-def dead $scc
181 S_CBRANCH_EXECZ %bb.2, implicit $exec
185 successors: %bb.3, %bb.4
186 liveins: $sgpr6_sgpr7, $sgpr30_sgpr31, $vgpr1_vgpr2
188 renamable $sgpr6_sgpr7 = S_OR_SAVEEXEC_B64 killed renamable $sgpr6_sgpr7, implicit-def $exec, implicit-def $scc, implicit $exec
189 $exec = S_XOR_B64 $exec, renamable $sgpr6_sgpr7, implicit-def $scc
190 S_CBRANCH_EXECZ %bb.4, implicit $exec
194 liveins: $sgpr6_sgpr7, $sgpr30_sgpr31
196 $exec = S_OR_B64 $exec, killed renamable $sgpr6_sgpr7, implicit-def $scc
197 renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
198 S_SETPC_B64_return $sgpr30_sgpr31
201 successors: %bb.3, %bb.4
202 liveins: $sgpr6_sgpr7, $sgpr30_sgpr31, $vgpr1_vgpr2
204 renamable $vgpr0 = V_MOV_B32_e32 15, implicit $exec
205 renamable $sgpr6_sgpr7 = S_OR_SAVEEXEC_B64 killed renamable $sgpr6_sgpr7, implicit-def $exec, implicit-def $scc, implicit $exec
206 $exec = S_XOR_B64 $exec, renamable $sgpr6_sgpr7, implicit-def $scc
207 S_CBRANCH_EXECZ %bb.4, implicit $exec
211 liveins: $sgpr6_sgpr7, $sgpr30_sgpr31, $vgpr1_vgpr2
213 renamable $vgpr0 = V_MOV_B32_e32 8, implicit $exec
214 $exec = S_OR_B64 $exec, killed renamable $sgpr6_sgpr7, implicit-def $scc
215 renamable $vgpr0 = V_MOV_B32_e32 32, implicit $exec
216 S_SETPC_B64_return $sgpr30_sgpr31