1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
2 # RUN: llc -run-pass=si-i1-copies -mtriple=amdgcn--amdpal -mcpu=gfx1030 -verify-machineinstrs -o - %s | FileCheck %s
4 # Make sure that kill flag is clear on %23 to %0 copy when %23 is reused.
8 tracksRegLiveness: true
10 ; CHECK-LABEL: name: _amdgpu_cs_main
12 ; CHECK-NEXT: successors: %bb.1(0x80000000)
13 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr1
16 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
17 ; CHECK-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 0
18 ; CHECK-NEXT: [[V_CMP_NE_U32_e64_:%[0-9]+]]:sreg_32 = V_CMP_NE_U32_e64 [[COPY1]], [[S_MOV_B32_]], implicit $exec
19 ; CHECK-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sgpr_32 = S_MOV_B32 0
20 ; CHECK-NEXT: [[V_CMP_GT_F32_e64_:%[0-9]+]]:sreg_32 = nofpexcept V_CMP_GT_F32_e64 0, [[COPY]], 0, killed [[S_MOV_B32_1]], 0, implicit $mode, implicit $exec
21 ; CHECK-NEXT: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 killed [[V_CMP_NE_U32_e64_]], killed [[V_CMP_GT_F32_e64_]], implicit-def dead $scc
22 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[S_AND_B32_]]
23 ; CHECK-NEXT: [[S_MOV_B32_2:%[0-9]+]]:sreg_32 = S_MOV_B32 -1
24 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[COPY2]]
25 ; CHECK-NEXT: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY3]], killed [[S_MOV_B32_2]], implicit-def dead $scc
26 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[S_XOR_B32_]]
27 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:vgpr_32 = COPY [[S_MOV_B32_]], implicit $exec
30 ; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.3(0x40000000)
32 ; CHECK-NEXT: [[PHI:%[0-9]+]]:sreg_32 = PHI [[S_MOV_B32_]], %bb.0, %14, %bb.5
33 ; CHECK-NEXT: [[PHI1:%[0-9]+]]:sreg_32 = PHI [[S_MOV_B32_]], %bb.0, %16, %bb.5
34 ; CHECK-NEXT: [[PHI2:%[0-9]+]]:vgpr_32 = PHI [[COPY5]], %bb.0, %18, %bb.5
35 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:sreg_32 = COPY [[COPY4]]
36 ; CHECK-NEXT: [[SI_IF:%[0-9]+]]:sreg_32 = SI_IF [[COPY6]], %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
37 ; CHECK-NEXT: S_BRANCH %bb.2
40 ; CHECK-NEXT: successors: %bb.3(0x80000000)
42 ; CHECK-NEXT: [[V_OR_B32_e64_:%[0-9]+]]:vgpr_32 = V_OR_B32_e64 [[PHI1]], [[PHI2]], implicit $exec
43 ; CHECK-NEXT: [[S_MOV_B32_3:%[0-9]+]]:sreg_32 = S_MOV_B32 -1
44 ; CHECK-NEXT: [[S_OR_B32_:%[0-9]+]]:sreg_32 = S_OR_B32 [[S_AND_B32_]], $exec_lo, implicit-def $scc
47 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.5(0x40000000)
49 ; CHECK-NEXT: [[PHI3:%[0-9]+]]:sreg_32 = PHI [[S_AND_B32_]], %bb.1, [[S_OR_B32_]], %bb.2
50 ; CHECK-NEXT: [[PHI4:%[0-9]+]]:vgpr_32 = PHI [[PHI2]], %bb.1, [[V_OR_B32_e64_]], %bb.2
51 ; CHECK-NEXT: SI_END_CF [[SI_IF]], implicit-def dead $exec, implicit-def dead $scc, implicit $exec
52 ; CHECK-NEXT: [[S_MOV_B32_4:%[0-9]+]]:sreg_32 = S_MOV_B32 -1
53 ; CHECK-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
54 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:sreg_32 = COPY [[PHI3]]
55 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:vgpr_32 = COPY [[DEF]]
56 ; CHECK-NEXT: [[SI_IF1:%[0-9]+]]:sreg_32 = SI_IF [[COPY7]], %bb.5, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
57 ; CHECK-NEXT: S_BRANCH %bb.4
60 ; CHECK-NEXT: successors: %bb.5(0x80000000)
62 ; CHECK-NEXT: [[S_MOV_B32_5:%[0-9]+]]:sreg_32 = S_MOV_B32 1
63 ; CHECK-NEXT: [[S_OR_B32_1:%[0-9]+]]:sreg_32 = S_OR_B32 [[PHI1]], killed [[S_MOV_B32_5]], implicit-def dead $scc
64 ; CHECK-NEXT: [[S_MOV_B32_6:%[0-9]+]]:sreg_32 = S_MOV_B32 0
65 ; CHECK-NEXT: [[S_XOR_B32_1:%[0-9]+]]:sreg_32 = S_XOR_B32 $exec_lo, -1, implicit-def $scc
68 ; CHECK-NEXT: successors: %bb.6(0x04000000), %bb.1(0x7c000000)
70 ; CHECK-NEXT: [[PHI5:%[0-9]+]]:sreg_32 = PHI [[S_MOV_B32_4]], %bb.3, [[S_XOR_B32_1]], %bb.4
71 ; CHECK-NEXT: [[PHI6:%[0-9]+]]:vgpr_32 = PHI [[COPY8]], %bb.3, [[PHI4]], %bb.4
72 ; CHECK-NEXT: [[PHI7:%[0-9]+]]:sreg_32 = PHI [[DEF]], %bb.3, [[S_OR_B32_1]], %bb.4
73 ; CHECK-NEXT: SI_END_CF [[SI_IF1]], implicit-def dead $exec, implicit-def dead $scc, implicit $exec
74 ; CHECK-NEXT: [[COPY9:%[0-9]+]]:sreg_32 = COPY [[PHI5]]
75 ; CHECK-NEXT: [[SI_IF_BREAK:%[0-9]+]]:sreg_32 = SI_IF_BREAK [[COPY9]], [[PHI]], implicit-def dead $scc
76 ; CHECK-NEXT: SI_LOOP [[SI_IF_BREAK]], %bb.1, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
77 ; CHECK-NEXT: S_BRANCH %bb.6
80 ; CHECK-NEXT: [[PHI8:%[0-9]+]]:sreg_32 = PHI [[SI_IF_BREAK]], %bb.5
81 ; CHECK-NEXT: SI_END_CF [[PHI8]], implicit-def dead $exec, implicit-def dead $scc, implicit $exec
82 ; CHECK-NEXT: S_ENDPGM 0
84 successors: %bb.1(0x80000000)
85 liveins: $vgpr0, $vgpr1
87 %0:vgpr_32 = COPY $vgpr1
88 %1:vgpr_32 = COPY $vgpr0
89 %2:sreg_32 = S_MOV_B32 0
90 %3:sreg_32 = V_CMP_NE_U32_e64 %1, %2, implicit $exec
91 %4:sgpr_32 = S_MOV_B32 0
92 %5:sreg_32 = nofpexcept V_CMP_GT_F32_e64 0, %0, 0, killed %4, 0, implicit $mode, implicit $exec
93 %6:sreg_32 = S_AND_B32 killed %3, killed %5, implicit-def dead $scc
94 %7:vreg_1 = COPY killed %6
95 %8:sreg_32 = S_MOV_B32 -1
97 %10:sreg_32 = S_XOR_B32 %9, killed %8, implicit-def dead $scc
99 %12:vgpr_32 = COPY %2, implicit $exec
102 successors: %bb.2(0x40000000), %bb.3(0x40000000)
104 %13:sreg_32 = PHI %2, %bb.0, %14, %bb.5
105 %15:sreg_32 = PHI %2, %bb.0, %16, %bb.5
106 %17:vgpr_32 = PHI %12, %bb.0, %18, %bb.5
107 %19:sreg_32 = COPY %11
108 %20:sreg_32 = SI_IF %19, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
112 successors: %bb.3(0x80000000)
114 %21:vgpr_32 = V_OR_B32_e64 %15, %17, implicit $exec
115 %22:sreg_32 = S_MOV_B32 -1
116 %23:vreg_1 = COPY %22, implicit $exec
119 successors: %bb.4(0x40000000), %bb.5(0x40000000)
121 %24:vgpr_32 = PHI %17, %bb.1, %21, %bb.2
122 %25:vreg_1 = PHI %7, %bb.1, %23, %bb.2
123 SI_END_CF %20, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
124 %26:sreg_32 = S_MOV_B32 -1
125 %27:sreg_32 = IMPLICIT_DEF
126 %28:sreg_32 = COPY %25
127 %29:vgpr_32 = COPY %27
128 %30:vreg_1 = COPY %26, implicit $exec
129 %31:sreg_32 = SI_IF %28, %bb.5, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
133 successors: %bb.5(0x80000000)
135 %32:sreg_32 = S_MOV_B32 1
136 %33:sreg_32 = S_OR_B32 %15, killed %32, implicit-def dead $scc
137 %34:sreg_32 = S_MOV_B32 0
138 %35:vreg_1 = COPY %34, implicit $exec
141 successors: %bb.6(0x04000000), %bb.1(0x7c000000)
143 %18:vgpr_32 = PHI %29, %bb.3, %24, %bb.4
144 %16:sreg_32 = PHI %27, %bb.3, %33, %bb.4
145 %36:vreg_1 = PHI %30, %bb.3, %35, %bb.4
146 SI_END_CF %31, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
147 %37:sreg_32 = COPY %36
148 %14:sreg_32 = SI_IF_BREAK %37, %13, implicit-def dead $scc
149 SI_LOOP %14, %bb.1, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
153 %38:sreg_32 = PHI %14, %bb.5
154 SI_END_CF %38, implicit-def dead $exec, implicit-def dead $scc, implicit $exec