1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -mattr=+m -run-pass=regbankselect \
3 # RUN: -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s \
4 # RUN: -o - | FileCheck -check-prefix=RV32I %s
9 tracksRegLiveness: true
14 ; RV32I-LABEL: name: add_i32
15 ; RV32I: liveins: $x10, $x11
17 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
18 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
19 ; RV32I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[COPY]], [[COPY1]]
20 ; RV32I-NEXT: $x10 = COPY [[ADD]](s32)
21 ; RV32I-NEXT: PseudoRET implicit $x10
24 %2:_(s32) = G_ADD %0, %1
26 PseudoRET implicit $x10
32 tracksRegLiveness: true
37 ; RV32I-LABEL: name: sub_i32
38 ; RV32I: liveins: $x10, $x11
40 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
41 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
42 ; RV32I-NEXT: [[SUB:%[0-9]+]]:gprb(s32) = G_SUB [[COPY]], [[COPY1]]
43 ; RV32I-NEXT: $x10 = COPY [[SUB]](s32)
44 ; RV32I-NEXT: PseudoRET implicit $x10
47 %2:_(s32) = G_SUB %0, %1
49 PseudoRET implicit $x10
55 tracksRegLiveness: true
60 ; RV32I-LABEL: name: shl_i32
61 ; RV32I: liveins: $x10, $x11
63 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
64 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
65 ; RV32I-NEXT: [[SHL:%[0-9]+]]:gprb(s32) = G_SHL [[COPY]], [[COPY1]](s32)
66 ; RV32I-NEXT: $x10 = COPY [[SHL]](s32)
67 ; RV32I-NEXT: PseudoRET implicit $x10
70 %2:_(s32) = G_SHL %0, %1
72 PseudoRET implicit $x10
78 tracksRegLiveness: true
83 ; RV32I-LABEL: name: ashr_i32
84 ; RV32I: liveins: $x10, $x11
86 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
87 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
88 ; RV32I-NEXT: [[ASHR:%[0-9]+]]:gprb(s32) = G_ASHR [[COPY]], [[COPY1]](s32)
89 ; RV32I-NEXT: $x10 = COPY [[ASHR]](s32)
90 ; RV32I-NEXT: PseudoRET implicit $x10
93 %2:_(s32) = G_ASHR %0, %1
95 PseudoRET implicit $x10
101 tracksRegLiveness: true
106 ; RV32I-LABEL: name: lshr_i32
107 ; RV32I: liveins: $x10, $x11
109 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
110 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
111 ; RV32I-NEXT: [[LSHR:%[0-9]+]]:gprb(s32) = G_LSHR [[COPY]], [[COPY1]](s32)
112 ; RV32I-NEXT: $x10 = COPY [[LSHR]](s32)
113 ; RV32I-NEXT: PseudoRET implicit $x10
114 %0:_(s32) = COPY $x10
115 %1:_(s32) = COPY $x11
116 %2:_(s32) = G_LSHR %0, %1
118 PseudoRET implicit $x10
124 tracksRegLiveness: true
129 ; RV32I-LABEL: name: and_i32
130 ; RV32I: liveins: $x10, $x11
132 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
133 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
134 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[COPY1]]
135 ; RV32I-NEXT: $x10 = COPY [[AND]](s32)
136 ; RV32I-NEXT: PseudoRET implicit $x10
137 %0:_(s32) = COPY $x10
138 %1:_(s32) = COPY $x11
139 %2:_(s32) = G_AND %0, %1
141 PseudoRET implicit $x10
147 tracksRegLiveness: true
152 ; RV32I-LABEL: name: or_i32
153 ; RV32I: liveins: $x10, $x11
155 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
156 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
157 ; RV32I-NEXT: [[OR:%[0-9]+]]:gprb(s32) = G_OR [[COPY]], [[COPY1]]
158 ; RV32I-NEXT: $x10 = COPY [[OR]](s32)
159 ; RV32I-NEXT: PseudoRET implicit $x10
160 %0:_(s32) = COPY $x10
161 %1:_(s32) = COPY $x11
162 %2:_(s32) = G_OR %0, %1
164 PseudoRET implicit $x10
170 tracksRegLiveness: true
175 ; RV32I-LABEL: name: xor_i32
176 ; RV32I: liveins: $x10, $x11
178 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
179 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
180 ; RV32I-NEXT: [[XOR:%[0-9]+]]:gprb(s32) = G_XOR [[COPY]], [[COPY1]]
181 ; RV32I-NEXT: $x10 = COPY [[XOR]](s32)
182 ; RV32I-NEXT: PseudoRET implicit $x10
183 %0:_(s32) = COPY $x10
184 %1:_(s32) = COPY $x11
185 %2:_(s32) = G_XOR %0, %1
187 PseudoRET implicit $x10
193 tracksRegLiveness: true
198 ; RV32I-LABEL: name: mul_i32
199 ; RV32I: liveins: $x10, $x11
201 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
202 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
203 ; RV32I-NEXT: [[MUL:%[0-9]+]]:gprb(s32) = G_MUL [[COPY]], [[COPY1]]
204 ; RV32I-NEXT: $x10 = COPY [[MUL]](s32)
205 ; RV32I-NEXT: PseudoRET implicit $x10
206 %0:_(s32) = COPY $x10
207 %1:_(s32) = COPY $x11
208 %2:_(s32) = G_MUL %0, %1
210 PseudoRET implicit $x10
216 tracksRegLiveness: true
221 ; RV32I-LABEL: name: sdiv_i32
222 ; RV32I: liveins: $x10, $x11
224 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
225 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
226 ; RV32I-NEXT: [[SDIV:%[0-9]+]]:gprb(s32) = G_SDIV [[COPY]], [[COPY1]]
227 ; RV32I-NEXT: $x10 = COPY [[SDIV]](s32)
228 ; RV32I-NEXT: PseudoRET implicit $x10
229 %0:_(s32) = COPY $x10
230 %1:_(s32) = COPY $x11
231 %2:_(s32) = G_SDIV %0, %1
233 PseudoRET implicit $x10
239 tracksRegLiveness: true
244 ; RV32I-LABEL: name: srem_i32
245 ; RV32I: liveins: $x10, $x11
247 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
248 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
249 ; RV32I-NEXT: [[SREM:%[0-9]+]]:gprb(s32) = G_SREM [[COPY]], [[COPY1]]
250 ; RV32I-NEXT: $x10 = COPY [[SREM]](s32)
251 ; RV32I-NEXT: PseudoRET implicit $x10
252 %0:_(s32) = COPY $x10
253 %1:_(s32) = COPY $x11
254 %2:_(s32) = G_SREM %0, %1
256 PseudoRET implicit $x10
262 tracksRegLiveness: true
267 ; RV32I-LABEL: name: smulh_i32
268 ; RV32I: liveins: $x10, $x11
270 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
271 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
272 ; RV32I-NEXT: [[SMULH:%[0-9]+]]:gprb(s32) = G_SMULH [[COPY]], [[COPY1]]
273 ; RV32I-NEXT: $x10 = COPY [[SMULH]](s32)
274 ; RV32I-NEXT: PseudoRET implicit $x10
275 %0:_(s32) = COPY $x10
276 %1:_(s32) = COPY $x11
277 %2:_(s32) = G_SMULH %0, %1
279 PseudoRET implicit $x10
285 tracksRegLiveness: true
290 ; RV32I-LABEL: name: udiv_i32
291 ; RV32I: liveins: $x10, $x11
293 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
294 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
295 ; RV32I-NEXT: [[UDIV:%[0-9]+]]:gprb(s32) = G_UDIV [[COPY]], [[COPY1]]
296 ; RV32I-NEXT: $x10 = COPY [[UDIV]](s32)
297 ; RV32I-NEXT: PseudoRET implicit $x10
298 %0:_(s32) = COPY $x10
299 %1:_(s32) = COPY $x11
300 %2:_(s32) = G_UDIV %0, %1
302 PseudoRET implicit $x10
308 tracksRegLiveness: true
313 ; RV32I-LABEL: name: urem_i32
314 ; RV32I: liveins: $x10, $x11
316 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
317 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
318 ; RV32I-NEXT: [[UREM:%[0-9]+]]:gprb(s32) = G_UREM [[COPY]], [[COPY1]]
319 ; RV32I-NEXT: $x10 = COPY [[UREM]](s32)
320 ; RV32I-NEXT: PseudoRET implicit $x10
321 %0:_(s32) = COPY $x10
322 %1:_(s32) = COPY $x11
323 %2:_(s32) = G_UREM %0, %1
325 PseudoRET implicit $x10
331 tracksRegLiveness: true
336 ; RV32I-LABEL: name: umulh_i32
337 ; RV32I: liveins: $x10, $x11
339 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
340 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
341 ; RV32I-NEXT: [[UMULH:%[0-9]+]]:gprb(s32) = G_UMULH [[COPY]], [[COPY1]]
342 ; RV32I-NEXT: $x10 = COPY [[UMULH]](s32)
343 ; RV32I-NEXT: PseudoRET implicit $x10
344 %0:_(s32) = COPY $x10
345 %1:_(s32) = COPY $x11
346 %2:_(s32) = G_UMULH %0, %1
348 PseudoRET implicit $x10
354 tracksRegLiveness: true
359 ; RV32I-LABEL: name: icmp_i32
360 ; RV32I: liveins: $x10, $x11
362 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
363 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
364 ; RV32I-NEXT: [[ICMP:%[0-9]+]]:gprb(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
365 ; RV32I-NEXT: $x10 = COPY [[ICMP]](s32)
366 ; RV32I-NEXT: PseudoRET implicit $x10
367 %0:_(s32) = COPY $x10
368 %1:_(s32) = COPY $x11
369 %2:_(s32) = G_ICMP intpred(eq), %0(s32), %1
371 PseudoRET implicit $x10
377 tracksRegLiveness: true
382 ; RV32I-LABEL: name: icmp_ptr
383 ; RV32I: liveins: $x10, $x11
385 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
386 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(p0) = COPY $x11
387 ; RV32I-NEXT: [[ICMP:%[0-9]+]]:gprb(s32) = G_ICMP intpred(eq), [[COPY]](p0), [[COPY1]]
388 ; RV32I-NEXT: $x10 = COPY [[ICMP]](s32)
389 ; RV32I-NEXT: PseudoRET implicit $x10
392 %2:_(s32) = G_ICMP intpred(eq), %0(p0), %1
394 PseudoRET implicit $x10
400 tracksRegLiveness: true
405 ; RV32I-LABEL: name: gep
406 ; RV32I: liveins: $x10, $x11
408 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
409 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
410 ; RV32I-NEXT: [[PTR_ADD:%[0-9]+]]:gprb(p0) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
411 ; RV32I-NEXT: $x10 = COPY [[PTR_ADD]](p0)
412 ; RV32I-NEXT: PseudoRET implicit $x10
414 %1:_(s32) = COPY $x11
415 %2:_(p0) = G_PTR_ADD %0, %1(s32)
417 PseudoRET implicit $x10
423 tracksRegLiveness: true
428 ; RV32I-LABEL: name: ptrtoint
429 ; RV32I: liveins: $x10
431 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(p0) = COPY $x10
432 ; RV32I-NEXT: [[PTRTOINT:%[0-9]+]]:gprb(s32) = G_PTRTOINT [[COPY]](p0)
433 ; RV32I-NEXT: $x10 = COPY [[PTRTOINT]](s32)
434 ; RV32I-NEXT: PseudoRET implicit $x10
436 %1:_(s32) = G_PTRTOINT %0(p0)
438 PseudoRET implicit $x10
444 tracksRegLiveness: true
449 ; RV32I-LABEL: name: inttoprt
450 ; RV32I: liveins: $x10
452 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
453 ; RV32I-NEXT: [[INTTOPTR:%[0-9]+]]:gprb(p0) = G_INTTOPTR [[COPY]](s32)
454 ; RV32I-NEXT: $x10 = COPY [[INTTOPTR]](p0)
455 ; RV32I-NEXT: PseudoRET implicit $x10
456 %0:_(s32) = COPY $x10
457 %1:_(p0) = G_INTTOPTR %0(s32)
459 PseudoRET implicit $x10