1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=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: successors: %bb.1(0x80000000)
20 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
21 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
22 ; GCN: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
23 ; GCN: [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
24 ; GCN: $scc = COPY [[COPY2]]
25 ; GCN: S_CBRANCH_SCC1 %bb.1, implicit $scc
28 liveins: $sgpr0, $sgpr1
30 %0:sgpr(s32) = COPY $sgpr0
31 %1:sgpr(s32) = COPY $sgpr1
32 %2:sgpr(s32) = G_ICMP intpred(eq), %0, %1
41 name: brcond_scc_impdef
46 ; GCN-LABEL: name: brcond_scc_impdef
48 ; GCN: successors: %bb.1(0x80000000)
49 ; GCN: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
50 ; GCN: $scc = COPY [[DEF]]
51 ; GCN: S_CBRANCH_SCC1 %bb.1, implicit $scc
54 liveins: $sgpr0, $sgpr1
56 %0:sgpr(s32) = G_IMPLICIT_DEF
70 ; GCN-LABEL: name: brcond_scc_br
72 ; GCN: successors: %bb.1(0x80000000)
73 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
74 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
75 ; GCN: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
76 ; GCN: [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
77 ; GCN: $scc = COPY [[COPY2]]
78 ; GCN: S_CBRANCH_SCC1 %bb.1, implicit $scc
81 ; GCN: successors: %bb.2(0x80000000)
84 liveins: $sgpr0, $sgpr1
86 %0:sgpr(s32) = COPY $sgpr0
87 %1:sgpr(s32) = COPY $sgpr1
88 %2:sgpr(s32) = G_ICMP intpred(eq), %0, %1
102 regBankSelected: true
105 ; GCN-LABEL: name: brcond_vcc
107 ; GCN: successors: %bb.1(0x80000000)
108 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
109 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
110 ; GCN: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64 = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
111 ; GCN: $vcc = COPY [[V_CMP_EQ_U32_e64_]]
112 ; GCN: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
115 liveins: $vgpr0, $vgpr1
117 %0:vgpr(s32) = COPY $vgpr0
118 %1:vgpr(s32) = COPY $vgpr1
119 %2:vcc(s1) = G_ICMP intpred(eq), %0, %1
126 # Don't try to select this.
131 regBankSelected: true
134 ; GCN-LABEL: name: brcond_sgpr
136 ; GCN: successors: %bb.1(0x80000000)
137 ; GCN: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
138 ; GCN: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
139 ; GCN: G_BRCOND [[TRUNC]](s1), %bb.1
142 liveins: $sgpr0, $sgpr1
144 %0:sgpr(s32) = COPY $sgpr0
145 %1:sgpr(s1) = G_TRUNC %0
152 # Don't try to select this.
157 regBankSelected: true
160 ; GCN-LABEL: name: brcond_vgpr
162 ; GCN: successors: %bb.1(0x80000000)
163 ; GCN: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
164 ; GCN: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
165 ; GCN: G_BRCOND [[TRUNC]](s1), %bb.1
168 liveins: $vgpr0, $vgpr1
170 %0:vgpr(s32) = COPY $vgpr0
171 %1:vgpr(s1) = G_TRUNC %0
180 name: brcond_class_intrinsic
182 regBankSelected: true
185 ; GCN-LABEL: name: brcond_class_intrinsic
187 ; GCN: successors: %bb.1(0x80000000)
188 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
189 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
190 ; GCN: [[V_CMP_CLASS_F32_e64_:%[0-9]+]]:sreg_64 = V_CMP_CLASS_F32_e64 0, [[COPY]], [[COPY1]], implicit $exec
191 ; GCN: $vcc = COPY [[V_CMP_CLASS_F32_e64_]]
192 ; GCN: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
195 liveins: $vgpr0, $vgpr1
197 %0:vgpr(s32) = COPY $vgpr0
198 %1:vgpr(s32) = COPY $vgpr1
199 %2:vcc(s1) = G_INTRINSIC intrinsic(@llvm.amdgcn.class), %0:vgpr(s32), %1:vgpr(s32)
200 G_BRCOND %2(s1), %bb.1
208 name: brcond_cmp_logic
210 regBankSelected: true
213 ; GCN-LABEL: name: brcond_cmp_logic
215 ; GCN: successors: %bb.1(0x80000000)
216 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
217 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
218 ; GCN: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
219 ; GCN: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
220 ; GCN: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
221 ; GCN: %5:sreg_64_xexec = nofpexcept V_CMP_EQ_F32_e64 0, [[COPY2]], 0, [[COPY3]], 0, implicit $mode, implicit $exec
222 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[V_CMP_EQ_U32_e64_]], %5, implicit-def dead $scc
223 ; GCN: $vcc = COPY [[S_AND_B64_]]
224 ; GCN: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
227 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
229 %0:vgpr(s32) = COPY $vgpr0
230 %1:vgpr(s32) = COPY $vgpr1
231 %2:vgpr(s32) = COPY $vgpr2
232 %3:vgpr(s32) = COPY $vgpr3
233 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
234 %5:vcc(s1) = G_FCMP floatpred(oeq), %2, %3
235 %6:vcc(s1) = G_AND %4, %5
236 G_BRCOND %6(s1), %bb.1
246 regBankSelected: true
249 ; GCN-LABEL: name: brcond_logic
251 ; GCN: successors: %bb.1(0x80000000)
252 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
253 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
254 ; GCN: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr0
255 ; GCN: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 1, [[COPY2]], implicit-def $scc
256 ; GCN: [[V_CMP_NE_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_NE_U32_e64 0, [[S_AND_B32_]], implicit $exec
257 ; GCN: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
258 ; GCN: [[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
259 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[S_AND_B64_]], $exec, implicit-def $scc
260 ; GCN: $vcc = COPY [[S_AND_B64_1]]
261 ; GCN: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
264 liveins: $sgpr0, $vgpr0, $vgpr1
266 %0:vgpr(s32) = COPY $vgpr0
267 %1:vgpr(s32) = COPY $vgpr1
268 %2:sgpr(s32) = COPY $sgpr0
269 %3:sgpr(s1) = G_TRUNC %2(s32)
270 %4:vcc(s1) = COPY %3(s1)
271 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
272 %6:vcc(s1) = G_AND %5, %4
273 G_BRCOND %6(s1), %bb.1
281 name: brcond_logic_const
283 regBankSelected: true
286 ; GCN-LABEL: name: brcond_logic_const
288 ; GCN: successors: %bb.1(0x80000000)
289 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
290 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
291 ; GCN: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
292 ; GCN: [[S_MOV_B64_:%[0-9]+]]:sreg_64_xexec = S_MOV_B64 -1
293 ; GCN: [[S_XOR_B64_:%[0-9]+]]:sreg_64_xexec = S_XOR_B64 [[V_CMP_EQ_U32_e64_]], [[S_MOV_B64_]], implicit-def dead $scc
294 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[S_XOR_B64_]], $exec, implicit-def $scc
295 ; GCN: $vcc = COPY [[S_AND_B64_]]
296 ; GCN: S_CBRANCH_VCCNZ %bb.1, implicit $vcc
299 liveins: $vgpr0, $vgpr1
301 %0:vgpr(s32) = COPY $vgpr0
302 %1:vgpr(s32) = COPY $vgpr1
303 %2:vcc(s1) = G_ICMP intpred(eq), %0, %1
304 %3:sgpr(s1) = G_CONSTANT i1 true
305 %4:vcc(s1) = COPY %3(s1)
306 %5:vcc(s1) = G_XOR %2, %4
307 G_BRCOND %5(s1), %bb.1