1 # RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra -o - %s | FileCheck -check-prefix=GCN %s
2 # RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra -o - %s | FileCheck -check-prefix=GCN %s
4 # GCN: name: negated_cond_vop2
5 # GCN: %0:sgpr_32 = IMPLICIT_DEF
6 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, %0, implicit-def dead $scc
7 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
9 name: negated_cond_vop2
12 %0:sgpr_32 = IMPLICIT_DEF
13 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
14 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
15 $vcc_lo = S_AND_B32 $exec_lo, killed $vcc_lo, implicit-def dead $scc
16 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
26 # GCN: name: negated_cond_vop3
27 # GCN: %0:sgpr_32 = IMPLICIT_DEF
28 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, %0, implicit-def dead $scc
29 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
31 name: negated_cond_vop3
34 %0:sgpr_32 = IMPLICIT_DEF
35 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
36 %2:sgpr_32 = V_CMP_NE_U32_e64 %1, 1, implicit $exec
37 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
38 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
48 # GCN: name: negated_cond_vop2_redef_vcc1
49 # GCN: %0:sgpr_32 = IMPLICIT_DEF
50 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
51 # GCN-NEXT: V_CMP_NE_U32_e32 1, %1, implicit-def $vcc_lo, implicit $exec
52 # GCN-NEXT: $vcc_lo = COPY $sgpr0
53 # GCN-NEXT: $vcc_lo = S_AND_B32 $exec_lo, $vcc_lo, implicit-def dead $scc
54 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
56 name: negated_cond_vop2_redef_vcc1
59 %0:sgpr_32 = IMPLICIT_DEF
60 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
61 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
63 $vcc_lo = S_AND_B32 $exec_lo, killed $vcc_lo, implicit-def dead $scc
64 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
74 # GCN: name: negated_cond_vop3_redef_cmp
75 # GCN: %0:sgpr_32 = IMPLICIT_DEF
76 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
77 # GCN-NEXT: dead %3:sgpr_32 = V_CMP_NE_U32_e64 %1, 1, implicit $exec
78 # GCN-NEXT: %2:sgpr_32 = COPY $sgpr0
79 # GCN-NEXT: $vcc_lo = S_AND_B32 %2, $exec_lo, implicit-def dead $scc
80 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
82 name: negated_cond_vop3_redef_cmp
85 %0:sgpr_32 = IMPLICIT_DEF
86 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
87 %2:sgpr_32 = V_CMP_NE_U32_e64 %1, 1, implicit $exec
89 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
90 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
100 # GCN: name: negated_cond_undef_vcc
101 # GCN: $vcc_lo = S_AND_B32 $exec_lo, undef $vcc_lo, implicit-def dead $scc
102 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
104 name: negated_cond_undef_vcc
107 $vcc_lo = S_AND_B32 $exec_lo, undef $vcc_lo, implicit-def dead $scc
108 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
118 # GCN: name: negated_cond_vop3_imp_vcc
119 # GCN: $vcc_lo = IMPLICIT_DEF
120 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, $vcc_lo, implicit-def dead $scc
121 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
123 name: negated_cond_vop3_imp_vcc
126 $vcc_lo = IMPLICIT_DEF
127 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, $vcc_lo, implicit $exec
128 %2:sgpr_32 = V_CMP_NE_U32_e64 %1, 1, implicit $exec
129 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
130 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
140 # GCN: name: negated_cond_vop2_imp_vcc
141 # GCN: $vcc_lo = IMPLICIT_DEF
142 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, $vcc_lo, implicit-def dead $scc
143 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
145 name: negated_cond_vop2_imp_vcc
148 $vcc_lo = IMPLICIT_DEF
149 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, $vcc_lo, implicit $exec
150 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
151 $vcc_lo = S_AND_B32 killed $vcc_lo, $exec_lo, implicit-def dead $scc
152 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
162 # GCN: name: negated_cond_vop3_redef_sel
163 # GCN: %0:sgpr_32 = IMPLICIT_DEF
164 # GCN-NEXT: dead %3:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
165 # GCN-NEXT: %1:vgpr_32 = COPY $vgpr0
166 # GCN-NEXT: %2:sgpr_32 = V_CMP_NE_U32_e64 %1, 1, implicit $exec
167 # GCN-NEXT: $vcc_lo = S_AND_B32 %2, $exec_lo, implicit-def dead $scc
168 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
170 name: negated_cond_vop3_redef_sel
173 %0:sgpr_32 = IMPLICIT_DEF
174 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
175 %1:vgpr_32 = COPY $vgpr0
176 %2:sgpr_32 = V_CMP_NE_U32_e64 %1, 1, implicit $exec
177 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
178 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
188 # GCN: name: negated_cond_vop2_used_sel
189 # GCN: %0:sgpr_32 = IMPLICIT_DEF
190 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
191 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, %0, implicit-def dead $scc
192 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
194 name: negated_cond_vop2_used_sel
197 %0:sgpr_32 = IMPLICIT_DEF
198 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
199 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
200 $vcc_lo = S_AND_B32 $exec_lo, killed $vcc_lo, implicit-def dead $scc
201 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
209 S_ENDPGM 0, implicit $vgpr0
212 # GCN: name: negated_cond_vop2_used_vcc
213 # GCN: %0:sgpr_32 = IMPLICIT_DEF
214 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
215 # GCN-NEXT: V_CMP_NE_U32_e32 1, %1, implicit-def $vcc_lo, implicit $exec
216 # GCN-NEXT: $sgpr0_sgpr1 = COPY $vcc
217 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, %0, implicit-def dead $scc
218 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
220 name: negated_cond_vop2_used_vcc
223 %0:sgpr_32 = IMPLICIT_DEF
224 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
225 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
226 $sgpr0_sgpr1 = COPY $vcc
227 $vcc_lo = S_AND_B32 $exec_lo, killed $vcc_lo, implicit-def dead $scc
228 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
238 # GCN: name: negated_cond_vop3_sel_wrong_subreg1
239 # GCN: %0:sgpr_32 = IMPLICIT_DEF
240 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
241 # GCN-NEXT: %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
242 # GCN-NEXT: %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
243 # GCN-NEXT: $vcc_lo = S_AND_B32 %2, $exec_lo, implicit-def dead $scc
244 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
246 name: negated_cond_vop3_sel_wrong_subreg1
249 %0:sgpr_32 = IMPLICIT_DEF
250 undef %1.sub1 = IMPLICIT_DEF
251 %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
252 %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
253 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
254 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
264 # GCN: name: negated_cond_vop3_sel_wrong_subreg2
265 # GCN: %0:sgpr_32 = IMPLICIT_DEF
266 # GCN-NEXT: %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
267 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
268 # GCN-NEXT: %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
269 # GCN-NEXT: $vcc_lo = S_AND_B32 %2, $exec_lo, implicit-def dead $scc
270 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
272 name: negated_cond_vop3_sel_wrong_subreg2
275 %0:sgpr_32 = IMPLICIT_DEF
276 undef %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
277 %1.sub1 = IMPLICIT_DEF
278 %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
279 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
280 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
290 # GCN: name: negated_cond_vop3_sel_right_subreg1
291 # GCN: %0:sgpr_32 = IMPLICIT_DEF
292 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
293 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, %0, implicit-def dead $scc
294 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
296 name: negated_cond_vop3_sel_right_subreg1
299 %0:sgpr_32 = IMPLICIT_DEF
300 undef %1.sub1 = IMPLICIT_DEF
301 %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
302 %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub0, 1, implicit $exec
303 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
304 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
314 # GCN: name: negated_cond_vop3_sel_right_subreg2
315 # GCN: %0:sgpr_32 = IMPLICIT_DEF
316 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
317 # GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, %0, implicit-def dead $scc
318 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
320 name: negated_cond_vop3_sel_right_subreg2
323 %0:sgpr_32 = IMPLICIT_DEF
324 undef %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
325 %1.sub1 = IMPLICIT_DEF
326 %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub0, 1, implicit $exec
327 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
328 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
338 # GCN: name: negated_cond_vop3_sel_subreg_overlap
339 # GCN: %0:sgpr_32 = IMPLICIT_DEF
340 # GCN-NEXT: %1.sub2:vreg_128 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
341 # GCN-NEXT: %1.sub2_sub3:vreg_128 = IMPLICIT_DEF
342 # GCN-NEXT: %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub2, 1, implicit $exec
343 # GCN-NEXT: $vcc_lo = S_AND_B32 %2, $exec_lo, implicit-def dead $scc
344 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo
346 name: negated_cond_vop3_sel_subreg_overlap
349 %0:sgpr_32 = IMPLICIT_DEF
350 undef %1.sub2:vreg_128 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
351 %1.sub2_sub3 = IMPLICIT_DEF
352 %2:sgpr_32 = V_CMP_NE_U32_e64 %1.sub2, 1, implicit $exec
353 $vcc_lo = S_AND_B32 killed %2, $exec_lo, implicit-def dead $scc
354 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc