1 # RUN: llc -mtriple=amdgcn -mcpu=fiji -run-pass si-pre-emit-peephole -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
2 # RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -run-pass si-pre-emit-peephole -verify-machineinstrs -o - %s | FileCheck -check-prefix=W32 %s
3 # RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -run-pass si-pre-emit-peephole -verify-machineinstrs -o - %s | FileCheck -check-prefix=W32 %s
6 # GCN-LABEL: name: and_execz_mov_vccz
9 # GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
10 name: and_execz_mov_vccz
19 $sgpr0_sgpr1 = S_MOV_B64 -1
20 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
21 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
25 # GCN-LABEL: name: and_execz_imm_vccz
27 # GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
28 name: and_execz_imm_vccz
37 $vcc = S_AND_B64 $exec, -1, implicit-def dead $scc
38 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
42 # GCN-LABEL: name: and_execnz_imm_vccnz
44 # GCN: S_CBRANCH_EXECNZ %bb.1, implicit $exec
45 name: and_execnz_imm_vccnz
54 $vcc = S_AND_B64 $exec, -1, implicit-def dead $scc
55 S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
59 # GCN-LABEL: name: and_execz_imm_vccz_live_scc
60 # GCN: $vcc = S_AND_B64 $exec, -1, implicit-def $scc
61 # GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
62 name: and_execz_imm_vccz_live_scc
71 $vcc = S_AND_B64 $exec, -1, implicit-def $scc
72 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
76 # GCN-LABEL: name: and_execz_mov_vccz_live_scc
78 # GCN: $vcc = S_AND_B64 $exec, -1, implicit-def $scc
79 # GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
80 name: and_execz_mov_vccz_live_scc
89 $sgpr0_sgpr1 = S_MOV_B64 -1
90 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def $scc
91 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
95 # GCN-LABEL: name: and_execz_mov_vccz_live_sreg
96 # GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
97 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
98 name: and_execz_mov_vccz_live_sreg
107 $sgpr0_sgpr1 = S_MOV_B64 -1
108 $vcc = S_AND_B64 $exec, $sgpr0_sgpr1, implicit-def dead $scc
109 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
113 # GCN-LABEL: name: and_execz_mov_vccz_live_sreg_commute
114 # GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
115 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
116 name: and_execz_mov_vccz_live_sreg_commute
125 $sgpr0_sgpr1 = S_MOV_B64 -1
126 $vcc = S_AND_B64 $sgpr0_sgpr1, $exec, implicit-def dead $scc
127 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
131 # GCN-LABEL: name: and_execz_mov_vccz_live_scc_commute
133 # GCN: $vcc = S_AND_B64 $exec, -1, implicit-def $scc
134 # GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
135 name: and_execz_mov_vccz_live_scc_commute
144 $sgpr0_sgpr1 = S_MOV_B64 -1
145 $vcc = S_AND_B64 killed $sgpr0_sgpr1, $exec, implicit-def $scc
146 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
150 # GCN-LABEL: name: and_execz_mov_vccz_commute
153 # GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
154 name: and_execz_mov_vccz_commute
163 $sgpr0_sgpr1 = S_MOV_B64 -1
164 $vcc = S_AND_B64 killed $sgpr0_sgpr1, $exec, implicit-def dead $scc
165 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
169 # GCN-LABEL: name: and_execz_mov_exec_vccz
170 # GCN: $exec = S_MOV_B64 -1
171 # GCN-NEXT: S_ENDPGM 0
172 name: and_execz_mov_exec_vccz
182 $vcc = S_AND_B64 $exec, $exec, implicit-def dead $scc
183 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
187 # GCN-LABEL: name: and_execz_mov_exec_vccnz
188 # GCN: $exec = S_MOV_B64 -1
189 # GCN-NEXT: S_BRANCH %bb.1{{$}}
190 name: and_execz_mov_exec_vccnz
200 $vcc = S_AND_B64 $exec, $exec, implicit-def dead $scc
201 S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
205 # GCN-LABEL: name: and_execz_mov_vccz_reads_sreg_early
206 # GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
207 # GCN-NEXT: $sgpr2 = S_MOV_B32 $sgpr1
208 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
209 name: and_execz_mov_vccz_reads_sreg_early
218 $sgpr0_sgpr1 = S_MOV_B64 -1
219 $sgpr2 = S_MOV_B32 $sgpr1
220 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
221 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
225 # GCN-LABEL: name: and_execz_mov_vccz_reads_sreg_late
226 # GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
227 # GCN-NEXT: $sgpr2 = S_MOV_B32 $sgpr1
228 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
229 name: and_execz_mov_vccz_reads_sreg_late
238 $sgpr0_sgpr1 = S_MOV_B64 -1
239 $vcc = S_AND_B64 $exec, $sgpr0_sgpr1, implicit-def dead $scc
240 $sgpr2 = S_MOV_B32 $sgpr1
241 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
244 # GCN-LABEL: name: and_execz_mov_vccz_reads_writes_sreg_early
245 # GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
246 # GCN-NEXT: $sgpr1 = S_MOV_B32 $sgpr0
247 # GCN-NEXT: $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
248 # GCN-NEXT: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
249 name: and_execz_mov_vccz_reads_writes_sreg_early
258 $sgpr0_sgpr1 = S_MOV_B64 -1
259 $sgpr1 = S_MOV_B32 $sgpr0
260 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
261 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
265 # GCN-LABEL: name: and_execz_mov_vccz_reads_cond
266 # GCN: $vcc = S_AND_B64 $exec, -1, implicit-def dead $scc
267 # GCN-NEXT: $sgpr2 = S_MOV_B32 $vcc_lo
268 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
269 name: and_execz_mov_vccz_reads_cond
278 $sgpr0_sgpr1 = S_MOV_B64 -1
279 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
280 $sgpr2 = S_MOV_B32 $vcc_lo
281 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
285 # GCN-LABEL: name: and_execz_mov_vccz_modifies_sreg
286 # GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
287 # GCN-NEXT: $sgpr0 = S_MOV_B32 0
288 # GCN-NEXT: $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
289 # GCN-NEXT: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
290 name: and_execz_mov_vccz_modifies_sreg
299 $sgpr0_sgpr1 = S_MOV_B64 -1
301 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
302 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
306 # GCN-LABEL: name: and_execz_imm_vccz_liveout_scc
307 # GCN: $vcc = S_AND_B64 $exec, -1, implicit-def $scc
308 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
309 # GCN-NEXT: S_ENDPGM 0, implicit $scc
310 name: and_execz_imm_vccz_liveout_scc
319 $vcc = S_AND_B64 $exec, -1, implicit-def $scc
320 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
321 S_ENDPGM 0, implicit $scc
324 # W32-LABEL: name: and_execz_mov_vccz_w32
327 # W32: S_CBRANCH_EXECZ %bb.1, implicit $exec
328 name: and_execz_mov_vccz_w32
337 $sgpr0 = S_MOV_B32 -1
338 $vcc_lo = S_AND_B32 $exec_lo, killed $sgpr0, implicit-def dead $scc
339 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
343 # GCN-LABEL: name: andn2_execz_mov_vccz
346 # GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
347 name: andn2_execz_mov_vccz
356 $sgpr0_sgpr1 = S_MOV_B64 0
357 $vcc = S_ANDN2_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
358 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
362 # GCN-LABEL: name: andn2_branch_mov_vccz
365 # GCN: S_BRANCH %bb.1
366 name: andn2_branch_mov_vccz
375 $sgpr0_sgpr1 = S_MOV_B64 -1
376 $vcc = S_ANDN2_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
377 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
381 # GCN-LABEL: name: andn2_execnz_mov_vccnz
384 # GCN: S_CBRANCH_EXECNZ %bb.1, implicit $exec
385 name: andn2_execnz_mov_vccnz
394 $sgpr0_sgpr1 = S_MOV_B64 0
395 $vcc = S_ANDN2_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
396 S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
400 # GCN-LABEL: name: andn2_no_branch_mov_vccnz
405 name: andn2_no_branch_mov_vccnz
414 $sgpr0_sgpr1 = S_MOV_B64 -1
415 $vcc = S_ANDN2_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
416 S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
420 # GCN-LABEL: name: and_0_mov
423 # GCN: $vcc = S_MOV_B64 0
424 # GCN-NEXT: S_BRANCH %bb.1
434 $sgpr0_sgpr1 = S_MOV_B64 0
435 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
436 S_CBRANCH_VCCZ %bb.1, implicit $vcc
440 # GCN-LABEL: name: andn2_m1_mov
443 # GCN: $vcc = S_MOV_B64 0
444 # GCN-NEXT: S_BRANCH %bb.1
454 $sgpr0_sgpr1 = S_MOV_B64 -1
455 $vcc = S_ANDN2_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
456 S_CBRANCH_VCCZ %bb.1, implicit $vcc
460 # GCN-LABEL: name: and_m1_mov
463 # GCN: $vcc = S_MOV_B64 $exec
464 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
474 $sgpr0_sgpr1 = S_MOV_B64 -1
475 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
476 S_CBRANCH_VCCZ %bb.1, implicit $vcc
480 # GCN-LABEL: name: andn2_0_mov
483 # GCN: $vcc = S_MOV_B64 $exec
484 # GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
494 $sgpr0_sgpr1 = S_MOV_B64 0
495 $vcc = S_ANDN2_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
496 S_CBRANCH_VCCZ %bb.1, implicit $vcc
500 # GCN-LABEL: name: and_0_scc_req
504 # GCN-NEXT: S_BRANCH %bb.1
514 $sgpr0_sgpr1 = S_MOV_B64 0
515 $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def $scc
516 S_CBRANCH_VCCZ %bb.1, implicit $vcc
520 # GCN-LABEL: name: andn2_m1_scc_req
524 # GCN-NEXT: S_BRANCH %bb.1
525 name: andn2_m1_scc_req
534 $sgpr0_sgpr1 = S_MOV_B64 -1
535 $vcc = S_ANDN2_B64 $exec, killed $sgpr0_sgpr1, implicit-def $scc
536 S_CBRANCH_VCCZ %bb.1, implicit $vcc
540 # GCN-LABEL: name: and_cmp_vccz
541 # GCN: V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
543 # GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
553 V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
554 $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
555 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
559 # GCN-LABEL: name: and_cmp_vccnz
560 # GCN: V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
562 # GCN: S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
572 V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
573 $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
574 S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
578 # GCN-LABEL: name: andn2_cmp_vccz
579 # GCN: V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
580 # GCN: $vcc = S_ANDN2_B64 $exec, $vcc, implicit-def dead $scc
581 # GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
591 V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
592 $vcc = S_ANDN2_B64 $exec, $vcc, implicit-def dead $scc
593 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
597 # GCN-LABEL: name: and_cmpclass_vccz
598 # GCN: V_CMP_CLASS_F32_e32 killed $sgpr0, killed $vgpr0, implicit-def $vcc, implicit $exec
600 # GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
601 name: and_cmpclass_vccz
610 V_CMP_CLASS_F32_e32 killed $sgpr0, killed $vgpr0, implicit-def $vcc, implicit $exec
611 $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
612 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
616 # GCN-LABEL: name: and_cmpx_vccz
617 # GCN: V_CMPX_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit-def $exec, implicit $exec
619 # GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
629 V_CMPX_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit-def $exec, implicit $exec
630 $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
631 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
635 # GCN-LABEL: name: and_or_cmp_vccz
636 # GCN: V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
637 # GCN: $exec = S_OR_B64 $exec, $sgpr0_sgpr1, implicit-def dead $scc
638 # GCN: $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
639 # GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
640 name: and_or_cmp_vccz
649 V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
650 $exec = S_OR_B64 $exec, $sgpr0_sgpr1, implicit-def dead $scc
651 $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
652 S_CBRANCH_VCCZ %bb.1, implicit killed $vcc