1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
3--- |
4
5  define void @mul_i32(i32 %x, i32 %y) {entry: ret void}
6  define void @umul_with_overflow(i32 %lhs, i32 %rhs, i32* %pmul, i1* %pcarry_flag) { ret void }
7
8...
9---
10name:            mul_i32
11alignment:       4
12legalized:       true
13tracksRegLiveness: true
14body:             |
15  bb.0.entry:
16    liveins: $a0, $a1
17
18    ; MIPS32-LABEL: name: mul_i32
19    ; MIPS32: liveins: $a0, $a1
20    ; MIPS32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
21    ; MIPS32: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
22    ; MIPS32: [[MUL:%[0-9]+]]:gprb(s32) = G_MUL [[COPY]], [[COPY1]]
23    ; MIPS32: $v0 = COPY [[MUL]](s32)
24    ; MIPS32: RetRA implicit $v0
25    %0:_(s32) = COPY $a0
26    %1:_(s32) = COPY $a1
27    %2:_(s32) = G_MUL %0, %1
28    $v0 = COPY %2(s32)
29    RetRA implicit $v0
30
31...
32---
33name:            umul_with_overflow
34alignment:       4
35legalized:       true
36tracksRegLiveness: true
37body:             |
38  bb.1 (%ir-block.0):
39    liveins: $a0, $a1, $a2, $a3
40
41    ; MIPS32-LABEL: name: umul_with_overflow
42    ; MIPS32: liveins: $a0, $a1, $a2, $a3
43    ; MIPS32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
44    ; MIPS32: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
45    ; MIPS32: [[COPY2:%[0-9]+]]:gprb(p0) = COPY $a2
46    ; MIPS32: [[COPY3:%[0-9]+]]:gprb(p0) = COPY $a3
47    ; MIPS32: [[MUL:%[0-9]+]]:gprb(s32) = G_MUL [[COPY]], [[COPY1]]
48    ; MIPS32: [[UMULH:%[0-9]+]]:gprb(s32) = G_UMULH [[COPY]], [[COPY1]]
49    ; MIPS32: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 0
50    ; MIPS32: [[ICMP:%[0-9]+]]:gprb(s32) = G_ICMP intpred(ne), [[UMULH]](s32), [[C]]
51    ; MIPS32: [[C1:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
52    ; MIPS32: [[COPY4:%[0-9]+]]:gprb(s32) = COPY [[ICMP]](s32)
53    ; MIPS32: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY4]], [[C1]]
54    ; MIPS32: G_STORE [[AND]](s32), [[COPY3]](p0) :: (store 1 into %ir.pcarry_flag)
55    ; MIPS32: G_STORE [[MUL]](s32), [[COPY2]](p0) :: (store 4 into %ir.pmul)
56    ; MIPS32: RetRA
57    %0:_(s32) = COPY $a0
58    %1:_(s32) = COPY $a1
59    %2:_(p0) = COPY $a2
60    %3:_(p0) = COPY $a3
61    %4:_(s32) = G_MUL %0, %1
62    %7:_(s32) = G_UMULH %0, %1
63    %8:_(s32) = G_CONSTANT i32 0
64    %9:_(s32) = G_ICMP intpred(ne), %7(s32), %8
65    %10:_(s32) = G_CONSTANT i32 1
66    %11:_(s32) = COPY %9(s32)
67    %6:_(s32) = G_AND %11, %10
68    G_STORE %6(s32), %3(p0) :: (store 1 into %ir.pcarry_flag)
69    G_STORE %4(s32), %2(p0) :: (store 4 into %ir.pmul)
70    RetRA
71
72...
73