1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=instruction-select -simplify-mir -verify-machineinstrs %s -o - \
3 # RUN: | FileCheck -check-prefix=RV64I %s
9 tracksRegLiveness: true
14 ; RV64I-LABEL: name: sll_i32
15 ; RV64I: liveins: $x10, $x11
17 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
18 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
19 ; RV64I-NEXT: [[SLLW:%[0-9]+]]:gpr = SLLW [[COPY]], [[COPY1]]
20 ; RV64I-NEXT: $x10 = COPY [[SLLW]]
21 ; RV64I-NEXT: PseudoRET implicit $x10
22 %0:gprb(s64) = COPY $x10
23 %1:gprb(s64) = COPY $x11
24 %2:gprb(s64) = G_SLLW %0, %1
26 PseudoRET implicit $x10
33 tracksRegLiveness: true
38 ; RV64I-LABEL: name: slli_i32
39 ; RV64I: liveins: $x10
41 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
42 ; RV64I-NEXT: [[SLLI:%[0-9]+]]:gpr = SLLI [[COPY]], 31
43 ; RV64I-NEXT: $x10 = COPY [[SLLI]]
44 ; RV64I-NEXT: PseudoRET implicit $x10
45 %0:gprb(s64) = COPY $x10
46 %1:gprb(s64) = G_CONSTANT i64 31
47 %2:gprb(s64) = G_SHL %0, %1
49 PseudoRET implicit $x10
56 tracksRegLiveness: true
61 ; RV64I-LABEL: name: sra_i32
62 ; RV64I: liveins: $x10, $x11
64 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
65 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
66 ; RV64I-NEXT: [[SRAW:%[0-9]+]]:gpr = SRAW [[COPY]], [[COPY1]]
67 ; RV64I-NEXT: $x10 = COPY [[SRAW]]
68 ; RV64I-NEXT: PseudoRET implicit $x10
69 %0:gprb(s64) = COPY $x10
70 %1:gprb(s64) = COPY $x11
71 %2:gprb(s64) = G_SRAW %0, %1
73 PseudoRET implicit $x10
80 tracksRegLiveness: true
85 ; RV64I-LABEL: name: srai_i32
86 ; RV64I: liveins: $x10
88 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
89 ; RV64I-NEXT: [[SRAIW:%[0-9]+]]:gpr = SRAIW [[COPY]], 31
90 ; RV64I-NEXT: $x10 = COPY [[SRAIW]]
91 ; RV64I-NEXT: PseudoRET implicit $x10
92 %0:gprb(s64) = COPY $x10
93 %1:gprb(s64) = G_CONSTANT i64 31
94 %2:gprb(s64) = G_SEXT_INREG %0, 32
95 %3:gprb(s64) = G_ASHR %2, %1(s64)
97 PseudoRET implicit $x10
103 regBankSelected: true
104 tracksRegLiveness: true
109 ; RV64I-LABEL: name: srl_i32
110 ; RV64I: liveins: $x10, $x11
112 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
113 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
114 ; RV64I-NEXT: [[SRLW:%[0-9]+]]:gpr = SRLW [[COPY]], [[COPY1]]
115 ; RV64I-NEXT: $x10 = COPY [[SRLW]]
116 ; RV64I-NEXT: PseudoRET implicit $x10
117 %0:gprb(s64) = COPY $x10
118 %1:gprb(s64) = COPY $x11
119 %2:gprb(s64) = G_SRLW %0, %1
121 PseudoRET implicit $x10
127 regBankSelected: true
128 tracksRegLiveness: true
133 ; RV64I-LABEL: name: srli_i32
134 ; RV64I: liveins: $x10
136 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
137 ; RV64I-NEXT: [[SRLIW:%[0-9]+]]:gpr = SRLIW [[COPY]], 31
138 ; RV64I-NEXT: $x10 = COPY [[SRLIW]]
139 ; RV64I-NEXT: PseudoRET implicit $x10
140 %0:gprb(s64) = COPY $x10
141 %1:gprb(s64) = G_CONSTANT i64 31
142 %2:gprb(s64) = G_CONSTANT i64 4294967295
143 %3:gprb(s64) = G_AND %0, %2
144 %4:gprb(s64) = G_LSHR %3, %1(s64)
146 PseudoRET implicit $x10
152 regBankSelected: true
153 tracksRegLiveness: true
158 ; RV64I-LABEL: name: add_i64
159 ; RV64I: liveins: $x10, $x11
161 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
162 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
163 ; RV64I-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[COPY]], [[COPY1]]
164 ; RV64I-NEXT: $x10 = COPY [[ADD]]
165 ; RV64I-NEXT: PseudoRET implicit $x10
166 %0:gprb(s64) = COPY $x10
167 %1:gprb(s64) = COPY $x11
168 %2:gprb(s64) = G_ADD %0, %1
170 PseudoRET implicit $x10
176 regBankSelected: true
177 tracksRegLiveness: true
182 ; RV64I-LABEL: name: addi_i64
183 ; RV64I: liveins: $x10
185 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
186 ; RV64I-NEXT: [[ADDI:%[0-9]+]]:gpr = ADDI [[COPY]], 1234
187 ; RV64I-NEXT: $x10 = COPY [[ADDI]]
188 ; RV64I-NEXT: PseudoRET implicit $x10
189 %0:gprb(s64) = COPY $x10
190 %1:gprb(s64) = G_CONSTANT i64 1234
191 %2:gprb(s64) = G_ADD %0, %1
193 PseudoRET implicit $x10
199 regBankSelected: true
200 tracksRegLiveness: true
205 ; RV64I-LABEL: name: sub_i64
206 ; RV64I: liveins: $x10, $x11
208 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
209 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
210 ; RV64I-NEXT: [[SUB:%[0-9]+]]:gpr = SUB [[COPY]], [[COPY1]]
211 ; RV64I-NEXT: $x10 = COPY [[SUB]]
212 ; RV64I-NEXT: PseudoRET implicit $x10
213 %0:gprb(s64) = COPY $x10
214 %1:gprb(s64) = COPY $x11
215 %2:gprb(s64) = G_SUB %0, %1
217 PseudoRET implicit $x10
223 regBankSelected: true
224 tracksRegLiveness: true
229 ; RV64I-LABEL: name: subi_i64
230 ; RV64I: liveins: $x10
232 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
233 ; RV64I-NEXT: [[ADDI:%[0-9]+]]:gpr = ADDI $x0, -1234
234 ; RV64I-NEXT: [[SUB:%[0-9]+]]:gpr = SUB [[COPY]], [[ADDI]]
235 ; RV64I-NEXT: $x10 = COPY [[SUB]]
236 ; RV64I-NEXT: PseudoRET implicit $x10
237 %0:gprb(s64) = COPY $x10
238 %1:gprb(s64) = G_CONSTANT i64 -1234
239 %2:gprb(s64) = G_SUB %0, %1
241 PseudoRET implicit $x10
247 regBankSelected: true
248 tracksRegLiveness: true
253 ; RV64I-LABEL: name: sll_i64
254 ; RV64I: liveins: $x10, $x11
256 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
257 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
258 ; RV64I-NEXT: [[SLL:%[0-9]+]]:gpr = SLL [[COPY]], [[COPY1]]
259 ; RV64I-NEXT: $x10 = COPY [[SLL]]
260 ; RV64I-NEXT: PseudoRET implicit $x10
261 %0:gprb(s64) = COPY $x10
262 %1:gprb(s64) = COPY $x11
263 %2:gprb(s64) = G_SHL %0, %1
265 PseudoRET implicit $x10
271 regBankSelected: true
272 tracksRegLiveness: true
277 ; RV64I-LABEL: name: slli_i64
278 ; RV64I: liveins: $x10
280 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
281 ; RV64I-NEXT: [[SLLI:%[0-9]+]]:gpr = SLLI [[COPY]], 63
282 ; RV64I-NEXT: $x10 = COPY [[SLLI]]
283 ; RV64I-NEXT: PseudoRET implicit $x10
284 %0:gprb(s64) = COPY $x10
285 %1:gprb(s64) = G_CONSTANT i64 63
286 %2:gprb(s64) = G_SHL %0, %1
288 PseudoRET implicit $x10
294 regBankSelected: true
295 tracksRegLiveness: true
300 ; RV64I-LABEL: name: sra_i64
301 ; RV64I: liveins: $x10, $x11
303 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
304 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
305 ; RV64I-NEXT: [[SRA:%[0-9]+]]:gpr = SRA [[COPY]], [[COPY1]]
306 ; RV64I-NEXT: $x10 = COPY [[SRA]]
307 ; RV64I-NEXT: PseudoRET implicit $x10
308 %0:gprb(s64) = COPY $x10
309 %1:gprb(s64) = COPY $x11
310 %2:gprb(s64) = G_ASHR %0, %1
312 PseudoRET implicit $x10
318 regBankSelected: true
319 tracksRegLiveness: true
324 ; RV64I-LABEL: name: srai_i64
325 ; RV64I: liveins: $x10
327 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
328 ; RV64I-NEXT: [[SRAI:%[0-9]+]]:gpr = SRAI [[COPY]], 63
329 ; RV64I-NEXT: $x10 = COPY [[SRAI]]
330 ; RV64I-NEXT: PseudoRET implicit $x10
331 %0:gprb(s64) = COPY $x10
332 %1:gprb(s64) = G_CONSTANT i64 63
333 %2:gprb(s64) = G_ASHR %0, %1
335 PseudoRET implicit $x10
341 regBankSelected: true
342 tracksRegLiveness: true
347 ; RV64I-LABEL: name: lshr_i64
348 ; RV64I: liveins: $x10, $x11
350 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
351 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
352 ; RV64I-NEXT: [[SRL:%[0-9]+]]:gpr = SRL [[COPY]], [[COPY1]]
353 ; RV64I-NEXT: $x10 = COPY [[SRL]]
354 ; RV64I-NEXT: PseudoRET implicit $x10
355 %0:gprb(s64) = COPY $x10
356 %1:gprb(s64) = COPY $x11
357 %2:gprb(s64) = G_LSHR %0, %1
359 PseudoRET implicit $x10
365 regBankSelected: true
366 tracksRegLiveness: true
371 ; RV64I-LABEL: name: srli_i64
372 ; RV64I: liveins: $x10
374 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
375 ; RV64I-NEXT: [[SRLI:%[0-9]+]]:gpr = SRLI [[COPY]], 63
376 ; RV64I-NEXT: $x10 = COPY [[SRLI]]
377 ; RV64I-NEXT: PseudoRET implicit $x10
378 %0:gprb(s64) = COPY $x10
379 %1:gprb(s64) = G_CONSTANT i64 63
380 %2:gprb(s64) = G_LSHR %0, %1
382 PseudoRET implicit $x10
388 regBankSelected: true
389 tracksRegLiveness: true
394 ; RV64I-LABEL: name: and_i64
395 ; RV64I: liveins: $x10, $x11
397 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
398 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
399 ; RV64I-NEXT: [[AND:%[0-9]+]]:gpr = AND [[COPY]], [[COPY1]]
400 ; RV64I-NEXT: $x10 = COPY [[AND]]
401 ; RV64I-NEXT: PseudoRET implicit $x10
402 %0:gprb(s64) = COPY $x10
403 %1:gprb(s64) = COPY $x11
404 %2:gprb(s64) = G_AND %0, %1
406 PseudoRET implicit $x10
412 regBankSelected: true
413 tracksRegLiveness: true
418 ; RV64I-LABEL: name: andi_i64
419 ; RV64I: liveins: $x10
421 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
422 ; RV64I-NEXT: [[ANDI:%[0-9]+]]:gpr = ANDI [[COPY]], 1234
423 ; RV64I-NEXT: $x10 = COPY [[ANDI]]
424 ; RV64I-NEXT: PseudoRET implicit $x10
425 %0:gprb(s64) = COPY $x10
426 %1:gprb(s64) = G_CONSTANT i64 1234
427 %2:gprb(s64) = G_AND %0, %1
429 PseudoRET implicit $x10
435 regBankSelected: true
436 tracksRegLiveness: true
441 ; RV64I-LABEL: name: or_i64
442 ; RV64I: liveins: $x10, $x11
444 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
445 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
446 ; RV64I-NEXT: [[OR:%[0-9]+]]:gpr = OR [[COPY]], [[COPY1]]
447 ; RV64I-NEXT: $x10 = COPY [[OR]]
448 ; RV64I-NEXT: PseudoRET implicit $x10
449 %0:gprb(s64) = COPY $x10
450 %1:gprb(s64) = COPY $x11
451 %2:gprb(s64) = G_OR %0, %1
453 PseudoRET implicit $x10
459 regBankSelected: true
460 tracksRegLiveness: true
465 ; RV64I-LABEL: name: ori_i64
466 ; RV64I: liveins: $x10
468 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
469 ; RV64I-NEXT: [[ORI:%[0-9]+]]:gpr = ORI [[COPY]], 1234
470 ; RV64I-NEXT: $x10 = COPY [[ORI]]
471 ; RV64I-NEXT: PseudoRET implicit $x10
472 %0:gprb(s64) = COPY $x10
473 %1:gprb(s64) = G_CONSTANT i64 1234
474 %2:gprb(s64) = G_OR %0, %1
476 PseudoRET implicit $x10
482 regBankSelected: true
483 tracksRegLiveness: true
488 ; RV64I-LABEL: name: xor_i64
489 ; RV64I: liveins: $x10, $x11
491 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
492 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
493 ; RV64I-NEXT: [[XOR:%[0-9]+]]:gpr = XOR [[COPY]], [[COPY1]]
494 ; RV64I-NEXT: $x10 = COPY [[XOR]]
495 ; RV64I-NEXT: PseudoRET implicit $x10
496 %0:gprb(s64) = COPY $x10
497 %1:gprb(s64) = COPY $x11
498 %2:gprb(s64) = G_XOR %0, %1
500 PseudoRET implicit $x10
506 regBankSelected: true
507 tracksRegLiveness: true
512 ; RV64I-LABEL: name: xori_i64
513 ; RV64I: liveins: $x10
515 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
516 ; RV64I-NEXT: [[XORI:%[0-9]+]]:gpr = XORI [[COPY]], 1234
517 ; RV64I-NEXT: $x10 = COPY [[XORI]]
518 ; RV64I-NEXT: PseudoRET implicit $x10
519 %0:gprb(s64) = COPY $x10
520 %1:gprb(s64) = G_CONSTANT i64 1234
521 %2:gprb(s64) = G_XOR %0, %1
523 PseudoRET implicit $x10
529 regBankSelected: true
530 tracksRegLiveness: true
533 liveins: $x10, $x11, $x12, $x13
535 ; RV64I-LABEL: name: add_i128
536 ; RV64I: liveins: $x10, $x11, $x12, $x13
538 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
539 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
540 ; RV64I-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $x12
541 ; RV64I-NEXT: [[COPY3:%[0-9]+]]:gpr = COPY $x13
542 ; RV64I-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[COPY]], [[COPY2]]
543 ; RV64I-NEXT: [[SLTU:%[0-9]+]]:gpr = SLTU [[ADD]], [[COPY2]]
544 ; RV64I-NEXT: [[ADD1:%[0-9]+]]:gpr = ADD [[COPY1]], [[COPY3]]
545 ; RV64I-NEXT: [[ANDI:%[0-9]+]]:gpr = ANDI [[SLTU]], 1
546 ; RV64I-NEXT: [[ADD2:%[0-9]+]]:gpr = ADD [[ADD1]], [[ANDI]]
547 ; RV64I-NEXT: $x10 = COPY [[ADD]]
548 ; RV64I-NEXT: $x11 = COPY [[ADD2]]
549 ; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11
550 %0:gprb(s64) = COPY $x10
551 %1:gprb(s64) = COPY $x11
552 %2:gprb(s64) = COPY $x12
553 %3:gprb(s64) = COPY $x13
554 %4:gprb(s64) = G_ADD %0, %2
555 %5:gprb(s64) = G_ICMP intpred(ult), %4(s64), %2
556 %6:gprb(s64) = G_ADD %1, %3
557 %7:gprb(s64) = G_CONSTANT i64 1
558 %8:gprb(s64) = G_AND %5, %7
559 %9:gprb(s64) = G_ADD %6, %8
562 PseudoRET implicit $x10, implicit $x11
568 regBankSelected: true
569 tracksRegLiveness: true
572 liveins: $x10, $x11, $x12, $x13
574 ; RV64I-LABEL: name: sub_i128
575 ; RV64I: liveins: $x10, $x11, $x12, $x13
577 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
578 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
579 ; RV64I-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $x12
580 ; RV64I-NEXT: [[COPY3:%[0-9]+]]:gpr = COPY $x13
581 ; RV64I-NEXT: [[SUB:%[0-9]+]]:gpr = SUB [[COPY]], [[COPY2]]
582 ; RV64I-NEXT: [[SLTU:%[0-9]+]]:gpr = SLTU [[COPY]], [[COPY2]]
583 ; RV64I-NEXT: [[SUB1:%[0-9]+]]:gpr = SUB [[COPY1]], [[COPY3]]
584 ; RV64I-NEXT: [[ANDI:%[0-9]+]]:gpr = ANDI [[SLTU]], 1
585 ; RV64I-NEXT: [[SUB2:%[0-9]+]]:gpr = SUB [[SUB1]], [[ANDI]]
586 ; RV64I-NEXT: $x10 = COPY [[SUB]]
587 ; RV64I-NEXT: $x11 = COPY [[SUB2]]
588 ; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11
589 %0:gprb(s64) = COPY $x10
590 %1:gprb(s64) = COPY $x11
591 %2:gprb(s64) = COPY $x12
592 %3:gprb(s64) = COPY $x13
593 %4:gprb(s64) = G_SUB %0, %2
594 %5:gprb(s64) = G_ICMP intpred(ult), %0(s64), %2
595 %6:gprb(s64) = G_SUB %1, %3
596 %7:gprb(s64) = G_CONSTANT i64 1
597 %8:gprb(s64) = G_AND %5, %7
598 %9:gprb(s64) = G_SUB %6, %8
601 PseudoRET implicit $x10, implicit $x11