1 # RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra -o - %s | FileCheck -check-prefix=GCN %s
3 # GCN: name: negated_cond_vop2
4 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
5 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, %0, implicit-def dead $scc
6 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
8 name: negated_cond_vop2
11 %0:sreg_64_xexec = IMPLICIT_DEF
12 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
13 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
14 $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
15 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
25 # GCN: name: negated_cond_vop3
26 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
27 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, %0, implicit-def dead $scc
28 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
30 name: negated_cond_vop3
33 %0:sreg_64_xexec = IMPLICIT_DEF
34 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
35 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1, 1, implicit $exec
36 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
37 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
47 # GCN: name: negated_cond_vop2_redef_vcc1
48 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
49 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
50 # GCN-NEXT: V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
51 # GCN-NEXT: $vcc_lo = COPY $sgpr0
52 # GCN-NEXT: $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
53 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
55 name: negated_cond_vop2_redef_vcc1
58 %0:sreg_64_xexec = IMPLICIT_DEF
59 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
60 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
62 $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
63 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
73 # GCN: name: negated_cond_vop2_redef_vcc2
74 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
75 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
76 # GCN-NEXT: V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
77 # GCN-NEXT: $vcc_hi = COPY $sgpr0
78 # GCN-NEXT: $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
79 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
81 name: negated_cond_vop2_redef_vcc2
84 %0:sreg_64_xexec = IMPLICIT_DEF
85 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
86 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
88 $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
89 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
99 # GCN: name: negated_cond_vop3_redef_cmp
100 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
101 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
102 # GCN-NEXT: %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1, 1, implicit $exec
103 # GCN-NEXT: %2.sub1:sreg_64_xexec = COPY $sgpr0
104 # GCN-NEXT: $vcc = S_AND_B64 %2, $exec, implicit-def dead $scc
105 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
107 name: negated_cond_vop3_redef_cmp
110 %0:sreg_64_xexec = IMPLICIT_DEF
111 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
112 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1, 1, implicit $exec
113 %2.sub1 = COPY $sgpr0
114 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
115 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
125 # GCN: name: negated_cond_undef_vcc
126 # GCN: $vcc = S_AND_B64 $exec, undef $vcc, implicit-def dead $scc
127 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
129 name: negated_cond_undef_vcc
132 $vcc = S_AND_B64 $exec, undef $vcc, implicit-def dead $scc
133 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
143 # GCN: name: negated_cond_vop3_imp_vcc
144 # GCN: $vcc = IMPLICIT_DEF
145 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, $vcc, implicit-def dead $scc
146 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
148 name: negated_cond_vop3_imp_vcc
152 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, $vcc, implicit $exec
153 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1, 1, implicit $exec
154 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
155 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
165 # GCN: name: negated_cond_vop2_imp_vcc
166 # GCN: $vcc = IMPLICIT_DEF
167 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, $vcc, implicit-def dead $scc
168 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
170 name: negated_cond_vop2_imp_vcc
174 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, $vcc, implicit $exec
175 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
176 $vcc = S_AND_B64 killed $vcc, $exec, implicit-def dead $scc
177 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
187 # GCN: name: negated_cond_vop3_redef_sel
188 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
189 # GCN-NEXT: dead %3:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
190 # GCN-NEXT: %1:vgpr_32 = COPY $vgpr0
191 # GCN-NEXT: %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1, 1, implicit $exec
192 # GCN-NEXT: $vcc = S_AND_B64 %2, $exec, implicit-def dead $scc
193 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
195 name: negated_cond_vop3_redef_sel
198 %0:sreg_64_xexec = IMPLICIT_DEF
199 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
200 %1:vgpr_32 = COPY $vgpr0
201 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1, 1, implicit $exec
202 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
203 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
213 # GCN: name: negated_cond_vop2_used_sel
214 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
215 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
216 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, %0, implicit-def dead $scc
217 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
219 name: negated_cond_vop2_used_sel
222 %0:sreg_64_xexec = IMPLICIT_DEF
223 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
224 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
225 $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
226 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
234 S_ENDPGM 0, implicit $vgpr0
237 # GCN: name: negated_cond_vop2_used_vcc
238 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
239 # GCN-NEXT: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
240 # GCN-NEXT: V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
241 # GCN-NEXT: $sgpr0_sgpr1 = COPY $vcc
242 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, %0, implicit-def dead $scc
243 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
245 name: negated_cond_vop2_used_vcc
248 %0:sreg_64_xexec = IMPLICIT_DEF
249 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
250 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
251 $sgpr0_sgpr1 = COPY $vcc
252 $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
253 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
260 S_ENDPGM 0, implicit $vgpr0
263 # GCN: name: negated_cond_vop3_sel_wrong_subreg1
264 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
265 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
266 # GCN-NEXT: %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
267 # GCN-NEXT: %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
268 # GCN-NEXT: $vcc = S_AND_B64 %2, $exec, implicit-def dead $scc
269 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
271 name: negated_cond_vop3_sel_wrong_subreg1
274 %0:sreg_64_xexec = IMPLICIT_DEF
275 undef %1.sub1 = IMPLICIT_DEF
276 %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
277 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
278 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
279 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
289 # GCN: name: negated_cond_vop3_sel_wrong_subreg2
290 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
291 # GCN-NEXT: %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
292 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
293 # GCN-NEXT: %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
294 # GCN-NEXT: $vcc = S_AND_B64 %2, $exec, implicit-def dead $scc
295 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
297 name: negated_cond_vop3_sel_wrong_subreg2
300 %0:sreg_64_xexec = IMPLICIT_DEF
301 undef %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
302 %1.sub1 = IMPLICIT_DEF
303 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub1, 1, implicit $exec
304 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
305 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
315 # GCN: name: negated_cond_vop3_sel_right_subreg1
316 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
317 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
318 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, %0, implicit-def dead $scc
319 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
321 name: negated_cond_vop3_sel_right_subreg1
324 %0:sreg_64_xexec = IMPLICIT_DEF
325 undef %1.sub1 = IMPLICIT_DEF
326 %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
327 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub0, 1, implicit $exec
328 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
329 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
339 # GCN: name: negated_cond_vop3_sel_right_subreg2
340 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
341 # GCN-NEXT: %1.sub1:vreg_64 = IMPLICIT_DEF
342 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, %0, implicit-def dead $scc
343 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
345 name: negated_cond_vop3_sel_right_subreg2
348 %0:sreg_64_xexec = IMPLICIT_DEF
349 undef %1.sub0:vreg_64 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
350 %1.sub1 = IMPLICIT_DEF
351 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub0, 1, implicit $exec
352 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
353 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
363 # GCN: name: negated_cond_vop3_sel_subreg_overlap
364 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
365 # GCN-NEXT: %1.sub2:vreg_128 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
366 # GCN-NEXT: %1.sub2_sub3:vreg_128 = IMPLICIT_DEF
367 # GCN-NEXT: %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub2, 1, implicit $exec
368 # GCN-NEXT: $vcc = S_AND_B64 %2, $exec, implicit-def dead $scc
369 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
371 name: negated_cond_vop3_sel_subreg_overlap
374 %0:sreg_64_xexec = IMPLICIT_DEF
375 undef %1.sub2:vreg_128 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
376 %1.sub2_sub3 = IMPLICIT_DEF
377 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1.sub2, 1, implicit $exec
378 $vcc = S_AND_B64 killed %2, $exec, implicit-def dead $scc
379 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
389 # GCN: name: negated_cond_vop2_dominated_blocks
390 # GCN: %0:sreg_64_xexec = IMPLICIT_DEF
391 # GCN: $vcc = S_ANDN2_B64 $exec, %0, implicit-def dead $scc
392 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.3, implicit $vcc
394 name: negated_cond_vop2_dominated_blocks
397 %0:sreg_64_xexec = IMPLICIT_DEF
398 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
401 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
402 $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
403 S_CBRANCH_VCCNZ %bb.3, implicit killed $vcc
413 # GCN: name: negated_cond_vop2_different_blocks_cmp_and
414 # GCN: %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
415 # GCN: $vcc = S_AND_B64 $exec, %2, implicit-def dead $scc
416 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.3, implicit $vcc
418 name: negated_cond_vop2_different_blocks_cmp_and
421 %0:sreg_64_xexec = IMPLICIT_DEF
422 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
423 %2:sreg_64_xexec = V_CMP_NE_U32_e64 %1, 1, implicit $exec
426 $vcc = S_AND_B64 $exec, %2, implicit-def dead $scc
427 S_CBRANCH_VCCNZ %bb.3, implicit killed $vcc
437 # GCN: name: negated_cond_vop2_not_dominated_blocks
438 # GCN: V_CNDMASK_B32_e64 0, 0, 0, 1,
439 # GCN: $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
440 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.4, implicit $vcc
442 name: negated_cond_vop2_not_dominated_blocks
447 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc
451 %0:sreg_64_xexec = IMPLICIT_DEF
452 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0, implicit $exec
455 V_CMP_NE_U32_e32 1, %1, implicit-def $vcc, implicit $exec
456 $vcc = S_AND_B64 $exec, killed $vcc, implicit-def dead $scc
457 S_CBRANCH_VCCNZ %bb.4, implicit killed $vcc
467 # GCN: name: negated_cond_subreg
468 # GCN: %0.sub0_sub1:sgpr_128 = IMPLICIT_DEF
469 # GCN-NEXT: $vcc = S_ANDN2_B64 $exec, %0.sub0_sub1, implicit-def dead $scc
470 # GCN-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
472 name: negated_cond_subreg
475 undef %0.sub0_sub1:sgpr_128 = IMPLICIT_DEF
476 %1:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %0.sub0_sub1, implicit $exec
477 undef %2.sub0_sub1:sgpr_128 = V_CMP_NE_U32_e64 %1, 1, implicit $exec
478 $vcc = S_AND_B64 $exec, %2.sub0_sub1:sgpr_128, implicit-def dead $scc
479 S_CBRANCH_VCCNZ %bb.2, implicit killed $vcc