1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -run-pass=instruction-select -global-isel-abort=2 -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2> %t | FileCheck -check-prefixes=GCN %s
3 # RUN: FileCheck -check-prefix=ERR %s < %t
6 # ERR: remark: <unknown>:0:0: cannot select: G_BRCOND %1:sgpr(s1), %bb.1 (in function: brcond_sgpr)
7 # ERR-NEXT: remark: <unknown>:0:0: cannot select: G_BRCOND %1:vgpr(s1), %bb.1 (in function: brcond_vgpr)
17 ; GCN-LABEL: name: brcond_scc
19 ; GCN-NEXT: successors: %bb.1(0x80000000)
20 ; GCN-NEXT: liveins: $sgpr0, $sgpr1
22 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
23 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
24 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
25 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
26 ; GCN-NEXT: $scc = COPY [[COPY2]]
27 ; GCN-NEXT: S_CBRANCH_SCC1 %bb.1, implicit $scc
31 liveins: $sgpr0, $sgpr1
33 %0:sgpr(s32) = COPY $sgpr0
34 %1:sgpr(s32) = COPY $sgpr1
35 %2:sgpr(s32) = G_ICMP intpred(eq), %0, %1
44 name: brcond_scc_impdef
49 ; GCN-LABEL: name: brcond_scc_impdef
51 ; GCN-NEXT: successors: %bb.1(0x80000000)
52 ; GCN-NEXT: liveins: $sgpr0, $sgpr1
54 ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
55 ; GCN-NEXT: $scc = COPY [[DEF]]
56 ; GCN-NEXT: S_CBRANCH_SCC1 %bb.1, implicit $scc
60 liveins: $sgpr0, $sgpr1
62 %0:sgpr(s32) = G_IMPLICIT_DEF
76 ; GCN-LABEL: name: brcond_scc_br
78 ; GCN-NEXT: successors: %bb.1(0x80000000)
79 ; GCN-NEXT: liveins: $sgpr0, $sgpr1
81 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
82 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
83 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
84 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
85 ; GCN-NEXT: $scc = COPY [[COPY2]]
86 ; GCN-NEXT: S_CBRANCH_SCC1 %bb.1, implicit $scc
87 ; GCN-NEXT: S_BRANCH %bb.1
90 ; GCN-NEXT: successors: %bb.2(0x80000000)
94 liveins: $sgpr0, $sgpr1
96 %0:sgpr(s32) = COPY $sgpr0
97 %1:sgpr(s32) = COPY $sgpr1
98 %2:sgpr(s32) = G_ICMP intpred(eq), %0, %1
112 regBankSelected: true
115 ; GCN-LABEL: name: brcond_vcc
117 ; GCN-NEXT: successors: %bb.1(0x80000000)
118 ; GCN-NEXT: liveins: $vgpr0, $vgpr1
120 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
121 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
122 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64 = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
123 ; GCN-NEXT: $vcc = COPY [[V_CMP_EQ_U32_e64_]]
124 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
128 liveins: $vgpr0, $vgpr1
130 %0:vgpr(s32) = COPY $vgpr0
131 %1:vgpr(s32) = COPY $vgpr1
132 %2:vcc(s1) = G_ICMP intpred(eq), %0, %1
139 # Don't try to select this.
144 regBankSelected: true
147 ; GCN-LABEL: name: brcond_sgpr
149 ; GCN-NEXT: successors: %bb.1(0x80000000)
150 ; GCN-NEXT: liveins: $sgpr0, $sgpr1
152 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
153 ; GCN-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
154 ; GCN-NEXT: G_BRCOND [[TRUNC]](s1), %bb.1
158 liveins: $sgpr0, $sgpr1
160 %0:sgpr(s32) = COPY $sgpr0
161 %1:sgpr(s1) = G_TRUNC %0
168 # Don't try to select this.
173 regBankSelected: true
176 ; GCN-LABEL: name: brcond_vgpr
178 ; GCN-NEXT: successors: %bb.1(0x80000000)
179 ; GCN-NEXT: liveins: $vgpr0, $vgpr1
181 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
182 ; GCN-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
183 ; GCN-NEXT: G_BRCOND [[TRUNC]](s1), %bb.1
187 liveins: $vgpr0, $vgpr1
189 %0:vgpr(s32) = COPY $vgpr0
190 %1:vgpr(s1) = G_TRUNC %0
199 name: brcond_class_intrinsic
201 regBankSelected: true
204 ; GCN-LABEL: name: brcond_class_intrinsic
206 ; GCN-NEXT: successors: %bb.1(0x80000000)
207 ; GCN-NEXT: liveins: $vgpr0, $vgpr1
209 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
210 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
211 ; GCN-NEXT: [[V_CMP_CLASS_F32_e64_:%[0-9]+]]:sreg_64 = V_CMP_CLASS_F32_e64 0, [[COPY]], [[COPY1]], implicit $exec
212 ; GCN-NEXT: $vcc = COPY [[V_CMP_CLASS_F32_e64_]]
213 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
217 liveins: $vgpr0, $vgpr1
219 %0:vgpr(s32) = COPY $vgpr0
220 %1:vgpr(s32) = COPY $vgpr1
221 %2:vcc(s1) = G_INTRINSIC intrinsic(@llvm.amdgcn.class), %0:vgpr(s32), %1:vgpr(s32)
222 G_BRCOND %2(s1), %bb.1
230 name: brcond_cmp_logic
232 regBankSelected: true
235 ; GCN-LABEL: name: brcond_cmp_logic
237 ; GCN-NEXT: successors: %bb.1(0x80000000)
238 ; GCN-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
240 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
241 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
242 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
243 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
244 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
245 ; GCN-NEXT: [[V_CMP_EQ_F32_e64_:%[0-9]+]]:sreg_64_xexec = nofpexcept V_CMP_EQ_F32_e64 0, [[COPY2]], 0, [[COPY3]], 0, implicit $mode, implicit $exec
246 ; GCN-NEXT: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[V_CMP_EQ_U32_e64_]], [[V_CMP_EQ_F32_e64_]], implicit-def dead $scc
247 ; GCN-NEXT: $vcc = COPY [[S_AND_B64_]]
248 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
252 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
254 %0:vgpr(s32) = COPY $vgpr0
255 %1:vgpr(s32) = COPY $vgpr1
256 %2:vgpr(s32) = COPY $vgpr2
257 %3:vgpr(s32) = COPY $vgpr3
258 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
259 %5:vcc(s1) = G_FCMP floatpred(oeq), %2, %3
260 %6:vcc(s1) = G_AND %4, %5
261 G_BRCOND %6(s1), %bb.1
271 regBankSelected: true
274 ; GCN-LABEL: name: brcond_logic
276 ; GCN-NEXT: successors: %bb.1(0x80000000)
277 ; GCN-NEXT: liveins: $sgpr0, $vgpr0, $vgpr1
279 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
280 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
281 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr0
282 ; GCN-NEXT: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 1, [[COPY2]], implicit-def dead $scc
283 ; GCN-NEXT: [[V_CMP_NE_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_NE_U32_e64 0, [[S_AND_B32_]], implicit $exec
284 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
285 ; GCN-NEXT: [[S_AND_B64_:%[0-9]+]]:sreg_64_xexec = S_AND_B64 [[V_CMP_EQ_U32_e64_]], [[V_CMP_NE_U32_e64_]], implicit-def dead $scc
286 ; GCN-NEXT: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[S_AND_B64_]], $exec, implicit-def dead $scc
287 ; GCN-NEXT: $vcc = COPY [[S_AND_B64_1]]
288 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
292 liveins: $sgpr0, $vgpr0, $vgpr1
294 %0:vgpr(s32) = COPY $vgpr0
295 %1:vgpr(s32) = COPY $vgpr1
296 %2:sgpr(s32) = COPY $sgpr0
297 %3:sgpr(s1) = G_TRUNC %2(s32)
298 %4:vcc(s1) = COPY %3(s1)
299 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
300 %6:vcc(s1) = G_AND %5, %4
301 G_BRCOND %6(s1), %bb.1
309 name: brcond_logic_const
311 regBankSelected: true
314 ; GCN-LABEL: name: brcond_logic_const
316 ; GCN-NEXT: successors: %bb.1(0x80000000)
317 ; GCN-NEXT: liveins: $vgpr0, $vgpr1
319 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
320 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
321 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
322 ; GCN-NEXT: [[S_MOV_B64_:%[0-9]+]]:sreg_64_xexec = S_MOV_B64 -1
323 ; GCN-NEXT: [[S_XOR_B64_:%[0-9]+]]:sreg_64_xexec = S_XOR_B64 [[V_CMP_EQ_U32_e64_]], [[S_MOV_B64_]], implicit-def dead $scc
324 ; GCN-NEXT: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[S_XOR_B64_]], $exec, implicit-def dead $scc
325 ; GCN-NEXT: $vcc = COPY [[S_AND_B64_]]
326 ; GCN-NEXT: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
330 liveins: $vgpr0, $vgpr1
332 %0:vgpr(s32) = COPY $vgpr0
333 %1:vgpr(s32) = COPY $vgpr1
334 %2:vcc(s1) = G_ICMP intpred(eq), %0, %1
335 %3:sgpr(s1) = G_CONSTANT i1 true
336 %4:vcc(s1) = COPY %3(s1)
337 %5:vcc(s1) = G_XOR %2, %4
338 G_BRCOND %5(s1), %bb.1