1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass=si-i1-copies %s -o - | FileCheck -check-prefix=GCN %s
5 name: kernel_i1_copy_phi_with_phi_incoming_value
6 tracksRegLiveness: true
8 ; GCN-LABEL: name: kernel_i1_copy_phi_with_phi_incoming_value
10 ; GCN-NEXT: successors: %bb.1(0x40000000), %bb.5(0x40000000)
11 ; GCN-NEXT: liveins: $vgpr0, $sgpr4_sgpr5
13 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_64(p4) = COPY $sgpr4_sgpr5
14 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr0
15 ; GCN-NEXT: [[S_LOAD_DWORD_IMM:%[0-9]+]]:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM [[COPY]](p4), 0, 0 :: (dereferenceable invariant load (s32), align 16, addrspace 4)
16 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[S_LOAD_DWORD_IMM]]
17 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]](s32)
18 ; GCN-NEXT: [[V_CMP_LT_I32_e64_:%[0-9]+]]:sreg_64 = V_CMP_LT_I32_e64 [[COPY1]](s32), [[S_LOAD_DWORD_IMM]], implicit $exec
19 ; GCN-NEXT: [[S_MOV_B64_:%[0-9]+]]:sreg_64 = S_MOV_B64 0
20 ; GCN-NEXT: [[SI_IF:%[0-9]+]]:sreg_64 = SI_IF killed [[V_CMP_LT_I32_e64_]], %bb.5, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
21 ; GCN-NEXT: S_BRANCH %bb.1
24 ; GCN-NEXT: successors: %bb.6(0x80000000)
26 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 16
27 ; GCN-NEXT: [[V_ADD_U32_e64_:%[0-9]+]]:vgpr_32 = V_ADD_U32_e64 [[COPY3]], killed [[S_MOV_B32_]], 0, implicit $exec
28 ; GCN-NEXT: [[V_CMP_GE_I32_e64_:%[0-9]+]]:sreg_64 = V_CMP_GE_I32_e64 [[V_ADD_U32_e64_]], [[COPY2]], implicit $exec
29 ; GCN-NEXT: [[S_MOV_B64_1:%[0-9]+]]:sreg_64 = S_MOV_B64 0
30 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_64 = COPY [[V_CMP_GE_I32_e64_]]
31 ; GCN-NEXT: S_BRANCH %bb.6
34 ; GCN-NEXT: successors: %bb.5(0x80000000)
36 ; GCN-NEXT: [[PHI:%[0-9]+]]:sreg_64 = PHI %15, %bb.6
37 ; GCN-NEXT: SI_END_CF [[PHI]], implicit-def dead $exec, implicit-def dead $scc, implicit $exec
38 ; GCN-NEXT: [[S_MOV_B64_2:%[0-9]+]]:sreg_64 = S_MOV_B64 -1
39 ; GCN-NEXT: [[COPY5:%[0-9]+]]:sreg_64 = COPY $exec
40 ; GCN-NEXT: S_BRANCH %bb.5
43 ; GCN-NEXT: successors: %bb.4(0x40000000), %bb.7(0x40000000)
45 ; GCN-NEXT: ATOMIC_FENCE 5, 2
47 ; GCN-NEXT: ATOMIC_FENCE 4, 2
48 ; GCN-NEXT: [[COPY6:%[0-9]+]]:sreg_64 = COPY %18
49 ; GCN-NEXT: [[SI_IF1:%[0-9]+]]:sreg_64 = SI_IF [[COPY6]], %bb.7, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
50 ; GCN-NEXT: S_BRANCH %bb.4
53 ; GCN-NEXT: successors: %bb.7(0x80000000)
55 ; GCN-NEXT: S_BRANCH %bb.7
58 ; GCN-NEXT: successors: %bb.3(0x80000000)
60 ; GCN-NEXT: [[PHI1:%[0-9]+]]:sreg_64 = PHI [[S_MOV_B64_]], %bb.0, [[COPY5]], %bb.2
61 ; GCN-NEXT: SI_END_CF [[SI_IF]], implicit-def dead $exec, implicit-def dead $scc, implicit $exec
62 ; GCN-NEXT: S_BRANCH %bb.3
65 ; GCN-NEXT: successors: %bb.2(0x40000000), %bb.6(0x40000000)
67 ; GCN-NEXT: [[PHI2:%[0-9]+]]:sreg_64 = PHI [[S_MOV_B64_1]], %bb.1, %15, %bb.6
68 ; GCN-NEXT: [[COPY7:%[0-9]+]]:sreg_64 = COPY [[COPY4]]
69 ; GCN-NEXT: [[SI_IF_BREAK:%[0-9]+]]:sreg_64 = SI_IF_BREAK [[COPY7]], [[PHI2]], implicit-def dead $scc
70 ; GCN-NEXT: SI_LOOP [[SI_IF_BREAK]], %bb.6, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
71 ; GCN-NEXT: S_BRANCH %bb.2
74 ; GCN-NEXT: SI_END_CF [[SI_IF1]], implicit-def dead $exec, implicit-def dead $scc, implicit $exec
75 ; GCN-NEXT: S_ENDPGM 0
77 successors: %bb.1, %bb.5
78 liveins: $vgpr0, $sgpr4_sgpr5
80 %1:sgpr_64(p4) = COPY $sgpr4_sgpr5
81 %2:vgpr_32(s32) = COPY $vgpr0
82 %3:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM %1:sgpr_64(p4), 0, 0 :: (dereferenceable invariant load (s32), align 16, addrspace 4)
83 %8:sreg_32 = COPY %3:sreg_32_xm0_xexec
84 %14:vgpr_32 = COPY %2:vgpr_32(s32)
85 %9:sreg_64 = V_CMP_LT_I32_e64 %2:vgpr_32(s32), %3:sreg_32_xm0_xexec, implicit $exec
86 %4:sreg_64 = S_MOV_B64 0
87 %17:vreg_1 = COPY %4:sreg_64, implicit $exec
88 %16:sreg_64 = SI_IF killed %9:sreg_64, %bb.5, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
95 %10:sreg_32 = S_MOV_B32 16
96 %18:vgpr_32 = V_ADD_U32_e64 %14:vgpr_32, killed %10:sreg_32, 0, implicit $exec
97 %11:sreg_64 = V_CMP_GE_I32_e64 %18:vgpr_32, %8:sreg_32, implicit $exec
98 %12:sreg_64 = S_MOV_B64 0
99 %19:vreg_1 = COPY %11:sreg_64
103 ; predecessors: %bb.6
106 %20:sreg_64 = PHI %6:sreg_64, %bb.6
107 SI_END_CF %20:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
108 %15:sreg_64 = S_MOV_B64 -1
109 %21:vreg_1 = COPY %15:sreg_64, implicit $exec
113 ; predecessors: %bb.5
114 successors: %bb.4, %bb.7
116 %22:vreg_1 = PHI %7:vreg_1, %bb.5
120 %23:sreg_64 = COPY %22:vreg_1
121 %24:sreg_64 = SI_IF %23:sreg_64, %bb.7, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
125 ; predecessors: %bb.3
131 ; predecessors: %bb.0, %bb.2
134 %7:vreg_1 = PHI %17:vreg_1, %bb.0, %21:vreg_1, %bb.2
135 SI_END_CF %16:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
139 ; predecessors: %bb.1, %bb.6
140 successors: %bb.2, %bb.6
142 %5:sreg_64 = PHI %12:sreg_64, %bb.1, %6:sreg_64, %bb.6
143 %13:sreg_64 = COPY %19:vreg_1
144 %6:sreg_64 = SI_IF_BREAK %13:sreg_64, %5:sreg_64, implicit-def dead $scc
145 SI_LOOP %6:sreg_64, %bb.6, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
149 ; predecessors: %bb.3, %bb.4
151 SI_END_CF %24:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec