1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=amdgpu-regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s
3 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=amdgpu-regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s
11 liveins: $sgpr0, $sgpr1
12 ; CHECK-LABEL: name: and_s1_sgpr_sgpr
13 ; CHECK: liveins: $sgpr0, $sgpr1
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
16 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
17 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
18 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
19 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
20 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
21 ; CHECK-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
22 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[AND]](s32)
23 %0:_(s32) = COPY $sgpr0
24 %1:_(s32) = COPY $sgpr1
27 %4:_(s1) = G_AND %2, %3
36 liveins: $sgpr0, $sgpr1
37 ; CHECK-LABEL: name: and_s1_scc_scc
38 ; CHECK: liveins: $sgpr0, $sgpr1
40 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
41 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
42 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
43 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
44 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
45 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
46 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
47 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
48 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
49 ; CHECK-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
50 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[AND]](s32)
51 %0:_(s32) = COPY $sgpr0
52 %1:_(s32) = COPY $sgpr1
53 %2:_(s32) = G_CONSTANT i32 0
54 %3:_(s1) = G_ICMP intpred(eq), %0, %2
55 %4:_(s1) = G_ICMP intpred(eq), %1, %2
56 %5:_(s1) = G_AND %3, %4
60 name: and_s1_vgpr_vgpr
65 liveins: $vgpr0, $vgpr1
66 ; CHECK-LABEL: name: and_s1_vgpr_vgpr
67 ; CHECK: liveins: $vgpr0, $vgpr1
69 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
70 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
71 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
72 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
73 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
74 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
75 ; CHECK-NEXT: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
76 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
77 %0:_(s32) = COPY $vgpr0
78 %1:_(s32) = COPY $vgpr1
81 %4:_(s1) = G_AND %2, %3
90 liveins: $vgpr0, $vgpr1
91 ; CHECK-LABEL: name: and_s1_vcc_vcc
92 ; CHECK: liveins: $vgpr0, $vgpr1
94 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
95 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
96 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
97 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
98 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY2]]
99 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
100 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]]
101 ; CHECK-NEXT: [[AND:%[0-9]+]]:vcc(s1) = G_AND [[ICMP]], [[ICMP1]]
102 %0:_(s32) = COPY $vgpr0
103 %1:_(s32) = COPY $vgpr1
104 %2:_(s32) = G_CONSTANT i32 0
105 %3:_(s1) = G_ICMP intpred(eq), %0, %2
106 %4:_(s1) = G_ICMP intpred(eq), %1, %2
107 %5:_(s1) = G_AND %3, %4
111 name: and_s1_sgpr_vgpr
116 liveins: $sgpr0, $vgpr0
117 ; CHECK-LABEL: name: and_s1_sgpr_vgpr
118 ; CHECK: liveins: $sgpr0, $vgpr0
120 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
121 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
122 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
123 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
124 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
125 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
126 ; CHECK-NEXT: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
127 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
128 %0:_(s32) = COPY $sgpr0
129 %1:_(s32) = COPY $vgpr0
130 %2:_(s1) = G_TRUNC %0
131 %3:_(s1) = G_TRUNC %1
132 %4:_(s1) = G_AND %2, %3
136 name: and_s1_vgpr_sgpr
141 liveins: $vgpr0, $vgpr0
142 ; CHECK-LABEL: name: and_s1_vgpr_sgpr
143 ; CHECK: liveins: $vgpr0, $vgpr0
145 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
146 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
147 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
148 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
149 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
150 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
151 ; CHECK-NEXT: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
152 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
153 %0:_(s32) = COPY $vgpr0
154 %1:_(s32) = COPY $sgpr0
155 %2:_(s1) = G_TRUNC %0
156 %3:_(s1) = G_TRUNC %1
157 %4:_(s1) = G_AND %2, %3
160 # FIXME: Should just change the result bank of the scc compare.
167 liveins: $sgpr0, $vgpr0
168 ; CHECK-LABEL: name: and_s1_scc_vcc
169 ; CHECK: liveins: $sgpr0, $vgpr0
171 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
172 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
173 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
174 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
175 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
176 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
177 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY2]]
178 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
179 ; CHECK-NEXT: [[AND:%[0-9]+]]:vcc(s1) = G_AND [[COPY3]], [[ICMP1]]
180 %0:_(s32) = COPY $sgpr0
181 %1:_(s32) = COPY $vgpr0
182 %2:_(s32) = G_CONSTANT i32 0
183 %3:_(s1) = G_ICMP intpred(eq), %0, %2
184 %4:_(s1) = G_ICMP intpred(eq), %1, %2
185 %5:_(s1) = G_AND %3, %4
194 liveins: $vgpr0, $vgpr1
195 ; CHECK-LABEL: name: and_s1_vcc_scc
196 ; CHECK: liveins: $vgpr0, $vgpr1
198 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
199 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
200 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
201 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
202 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY2]]
203 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
204 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]]
205 ; CHECK-NEXT: [[AND:%[0-9]+]]:vcc(s1) = G_AND [[ICMP]], [[ICMP1]]
206 %0:_(s32) = COPY $vgpr0
207 %1:_(s32) = COPY $vgpr1
208 %2:_(s32) = G_CONSTANT i32 0
209 %3:_(s1) = G_ICMP intpred(eq), %0, %2
210 %4:_(s1) = G_ICMP intpred(eq), %1, %2
211 %5:_(s1) = G_AND %3, %4
215 # Test with a known result bank
217 # name: and_s1_vcc_sgpr_sgpr
222 # liveins: $sgpr0, $sgpr1
224 # %0:_(s32) = COPY $sgpr0
225 # %1:_(s32) = COPY $sgpr1
226 # %2:_(s1) = G_TRUNC %0
227 # %3:_(s1) = G_TRUNC %1
228 # %4:vcc(s1) = G_AND %2, %3
232 # name: and_s1_vcc_vgpr_vgpr
237 # liveins: $vgpr0, $vgpr1
239 # %0:_(s32) = COPY $vgpr0
240 # %1:_(s32) = COPY $vgpr1
241 # %2:_(s1) = G_TRUNC %0
242 # %3:_(s1) = G_TRUNC %1
243 # %4:vcc(s1) = G_AND %2, %3
247 # name: and_s1_vcc_vgpr_sgpr
252 # liveins: $vgpr0, $sgpr0
253 # %0:_(s32) = COPY $vgpr0
254 # %1:_(s32) = COPY $sgpr0
255 # %2:_(s1) = G_TRUNC %0
256 # %3:_(s1) = G_TRUNC %1
257 # %4:vcc(s1) = G_AND %2, %3
261 # name: and_s1_vcc_sgpr_vgpr
266 # liveins: $vgpr0, $sgpr0
267 # %0:_(s32) = COPY $sgpr0
268 # %1:_(s32) = COPY $vgpr0
269 # %2:_(s1) = G_TRUNC %0
270 # %3:_(s1) = G_TRUNC %1
271 # %4:vcc(s1) = G_AND %2, %3
275 name: and_s1_vgpr_sgpr_sgpr
280 liveins: $sgpr0, $sgpr1
281 ; CHECK-LABEL: name: and_s1_vgpr_sgpr_sgpr
282 ; CHECK: liveins: $sgpr0, $sgpr1
284 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
285 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
286 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
287 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
288 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
289 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
290 ; CHECK-NEXT: [[AND:%[0-9]+]]:vgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
291 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[AND]](s32)
292 %0:_(s32) = COPY $sgpr0
293 %1:_(s32) = COPY $sgpr1
294 %2:_(s1) = G_TRUNC %0
295 %3:_(s1) = G_TRUNC %1
296 %4:vgpr(s1) = G_AND %2, %3
300 name: and_s1_sgpr_sgpr_sgpr
305 liveins: $sgpr0, $sgpr1
306 ; CHECK-LABEL: name: and_s1_sgpr_sgpr_sgpr
307 ; CHECK: liveins: $sgpr0, $sgpr1
309 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
310 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
311 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
312 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
313 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
314 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
315 ; CHECK-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[ANYEXT]], [[ANYEXT1]]
316 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[AND]](s32)
317 %0:_(s32) = COPY $sgpr0
318 %1:_(s32) = COPY $sgpr1
319 %2:_(s1) = G_TRUNC %0
320 %3:_(s1) = G_TRUNC %1
321 %4:sgpr(s1) = G_AND %2, %3