1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple amdgcn-amd-amdhsa -mcpu=gfx1030 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra %s -o - | FileCheck --check-prefix=GCN %s
4 # %8 is defined at the end, but it will be used in bb.2.
5 # Make sure we properly extend its liverange to the beginning of the bb.2.
6 # and to the end of the bb.6
9 name: def_later_than_use
10 tracksRegLiveness: true
12 ; GCN-LABEL: name: def_later_than_use
14 ; GCN-NEXT: successors: %bb.1(0x80000000)
16 ; GCN-NEXT: [[GLOBAL_LOAD_USHORT:%[0-9]+]]:vgpr_32 = GLOBAL_LOAD_USHORT undef %1:vreg_64, 0, 0, implicit $exec
17 ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32_xm0_xexec = IMPLICIT_DEF
20 ; GCN-NEXT: successors: %bb.6(0x04000000), %bb.1(0x7c000000)
22 ; GCN-NEXT: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 $exec_lo, [[DEF]], implicit-def dead $scc
23 ; GCN-NEXT: $vcc_lo = COPY [[S_AND_B32_]]
24 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.6, implicit $vcc
25 ; GCN-NEXT: S_BRANCH %bb.1
28 ; GCN-NEXT: successors: %bb.3(0x80000000)
30 ; GCN-NEXT: $vcc_lo = S_ANDN2_B32 $exec_lo, %8, implicit-def dead $scc
31 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.3, implicit $vcc
32 ; GCN-NEXT: S_BRANCH %bb.3
35 ; GCN-NEXT: successors: %bb.4(0x50000000), %bb.5(0x30000000)
37 ; GCN-NEXT: $exec_lo = S_OR_B32 $exec_lo, %6, implicit-def $scc
38 ; GCN-NEXT: [[V_CMP_NE_U32_e64_:%[0-9]+]]:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, %5, implicit $exec
39 ; GCN-NEXT: $vcc_lo = S_AND_B32 $exec_lo, [[V_CMP_NE_U32_e64_]], implicit-def dead $scc
40 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.5, implicit $vcc
41 ; GCN-NEXT: S_BRANCH %bb.4
44 ; GCN-NEXT: successors: %bb.5(0x80000000)
48 ; GCN-NEXT: S_ENDPGM 0
51 ; GCN-NEXT: successors: %bb.2(0x40000000), %bb.3(0x40000000)
53 ; GCN-NEXT: [[V_CMP_NEQ_F16_e64_:%[0-9]+]]:sreg_32_xm0_xexec = V_CMP_NEQ_F16_e64 0, 0, 0, [[GLOBAL_LOAD_USHORT]], 0, implicit $mode, implicit $exec
54 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, [[V_CMP_NEQ_F16_e64_]], implicit $exec
55 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit undef $scc
56 ; GCN-NEXT: [[S_AND_B32_1:%[0-9]+]]:sreg_32 = S_AND_B32 $exec_lo, [[S_CSELECT_B32_]], implicit-def dead $scc
57 ; GCN-NEXT: $exec_lo = S_MOV_B32_term [[S_AND_B32_1]]
58 ; GCN-NEXT: S_CBRANCH_EXECZ %bb.3, implicit $exec
59 ; GCN-NEXT: S_BRANCH %bb.2
61 successors: %bb.1(0x80000000)
63 %0:vgpr_32 = GLOBAL_LOAD_USHORT undef %1:vreg_64, 0, 0, implicit $exec
64 %2:sreg_32_xm0_xexec = IMPLICIT_DEF
67 successors: %bb.6(0x04000000), %bb.1(0x7c000000)
69 %3:sreg_32 = S_AND_B32 $exec_lo, %2, implicit-def dead $scc
71 S_CBRANCH_VCCNZ %bb.6, implicit killed $vcc
75 successors: %bb.3(0x80000000)
77 %4:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, %5, implicit $exec
78 $vcc_lo = S_AND_B32 $exec_lo, %4, implicit-def dead $scc
79 S_CBRANCH_VCCNZ %bb.3, implicit killed $vcc
83 successors: %bb.4(0x50000000), %bb.5(0x30000000)
85 $exec_lo = S_OR_B32 $exec_lo, %6, implicit-def $scc
86 %7:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, %5, implicit $exec
87 $vcc_lo = S_AND_B32 $exec_lo, %7, implicit-def dead $scc
88 S_CBRANCH_VCCNZ %bb.5, implicit killed $vcc
92 successors: %bb.5(0x80000000)
98 successors: %bb.2(0x40000000), %bb.3(0x40000000)
100 %8:sreg_32_xm0_xexec = V_CMP_NEQ_F16_e64 0, 0, 0, %0, 0, implicit $mode, implicit $exec
101 %5:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %8, implicit $exec
102 %9:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit undef $scc
103 %10:sreg_32 = COPY $exec_lo, implicit-def $exec_lo
104 %6:sreg_32 = S_AND_B32 %10, %9, implicit-def dead $scc
105 $exec_lo = S_MOV_B32_term %6
106 S_CBRANCH_EXECZ %bb.3, implicit $exec