1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
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 }
14 tracksRegLiveness: true
19 ; MIPS32-LABEL: name: mul_i32
20 ; MIPS32: liveins: $a0, $a1
21 ; MIPS32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
22 ; MIPS32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
23 ; MIPS32: [[MUL:%[0-9]+]]:gpr32 = MUL [[COPY]], [[COPY1]], implicit-def dead $hi0, implicit-def dead $lo0
24 ; MIPS32: $v0 = COPY [[MUL]]
25 ; MIPS32: RetRA implicit $v0
26 %0:gprb(s32) = COPY $a0
27 %1:gprb(s32) = COPY $a1
28 %2:gprb(s32) = G_MUL %0, %1
34 name: umul_with_overflow
38 tracksRegLiveness: true
41 liveins: $a0, $a1, $a2, $a3
43 ; MIPS32-LABEL: name: umul_with_overflow
44 ; MIPS32: liveins: $a0, $a1, $a2, $a3
45 ; MIPS32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
46 ; MIPS32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
47 ; MIPS32: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
48 ; MIPS32: [[COPY3:%[0-9]+]]:gpr32 = COPY $a3
49 ; MIPS32: [[MUL:%[0-9]+]]:gpr32 = MUL [[COPY]], [[COPY1]], implicit-def dead $hi0, implicit-def dead $lo0
50 ; MIPS32: [[PseudoMULTu:%[0-9]+]]:acc64 = PseudoMULTu [[COPY]], [[COPY1]]
51 ; MIPS32: [[PseudoMFHI:%[0-9]+]]:gpr32 = PseudoMFHI [[PseudoMULTu]]
52 ; MIPS32: [[SLTu:%[0-9]+]]:gpr32 = SLTu $zero, [[PseudoMFHI]]
53 ; MIPS32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
54 ; MIPS32: [[AND:%[0-9]+]]:gpr32 = AND [[SLTu]], [[ORi]]
55 ; MIPS32: SB [[AND]], [[COPY3]], 0 :: (store 1 into %ir.pcarry_flag)
56 ; MIPS32: SW [[MUL]], [[COPY2]], 0 :: (store 4 into %ir.pmul)
58 %0:gprb(s32) = COPY $a0
59 %1:gprb(s32) = COPY $a1
60 %2:gprb(p0) = COPY $a2
61 %3:gprb(p0) = COPY $a3
62 %4:gprb(s32) = G_MUL %0, %1
63 %7:gprb(s32) = G_UMULH %0, %1
64 %8:gprb(s32) = G_CONSTANT i32 0
65 %9:gprb(s32) = G_ICMP intpred(ne), %7(s32), %8
66 %10:gprb(s32) = G_CONSTANT i32 1
67 %11:gprb(s32) = COPY %9(s32)
68 %6:gprb(s32) = G_AND %11, %10
69 G_STORE %6(s32), %3(p0) :: (store 1 into %ir.pcarry_flag)
70 G_STORE %4(s32), %2(p0) :: (store 4 into %ir.pmul)