1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv32 -mattr=+m | FileCheck %s --check-prefixes=RISCV32
4 define { i128, i8 } @muloti_test(i128 %l, i128 %r) #0 {
5 ; RISCV32-LABEL: muloti_test:
6 ; RISCV32: # %bb.0: # %start
7 ; RISCV32-NEXT: addi sp, sp, -80
8 ; RISCV32-NEXT: sw ra, 76(sp)
9 ; RISCV32-NEXT: sw s0, 72(sp)
10 ; RISCV32-NEXT: sw s1, 68(sp)
11 ; RISCV32-NEXT: sw s2, 64(sp)
12 ; RISCV32-NEXT: sw s3, 60(sp)
13 ; RISCV32-NEXT: sw s4, 56(sp)
14 ; RISCV32-NEXT: sw s5, 52(sp)
15 ; RISCV32-NEXT: sw s6, 48(sp)
16 ; RISCV32-NEXT: mv s1, a2
17 ; RISCV32-NEXT: mv s0, a1
18 ; RISCV32-NEXT: mv s2, a0
19 ; RISCV32-NEXT: sw zero, 12(sp)
20 ; RISCV32-NEXT: sw zero, 8(sp)
21 ; RISCV32-NEXT: sw zero, 28(sp)
22 ; RISCV32-NEXT: sw zero, 24(sp)
23 ; RISCV32-NEXT: lw s3, 4(a2)
24 ; RISCV32-NEXT: sw s3, 4(sp)
25 ; RISCV32-NEXT: lw s5, 0(a2)
26 ; RISCV32-NEXT: sw s5, 0(sp)
27 ; RISCV32-NEXT: lw s4, 4(a1)
28 ; RISCV32-NEXT: sw s4, 20(sp)
29 ; RISCV32-NEXT: lw s6, 0(a1)
30 ; RISCV32-NEXT: sw s6, 16(sp)
31 ; RISCV32-NEXT: addi a0, sp, 32
32 ; RISCV32-NEXT: addi a1, sp, 16
33 ; RISCV32-NEXT: mv a2, sp
34 ; RISCV32-NEXT: call __multi3
35 ; RISCV32-NEXT: lw a0, 12(s0)
36 ; RISCV32-NEXT: lw a1, 8(s0)
37 ; RISCV32-NEXT: mul a2, s3, a1
38 ; RISCV32-NEXT: mul a3, a0, s5
39 ; RISCV32-NEXT: add a4, a3, a2
40 ; RISCV32-NEXT: lw a2, 12(s1)
41 ; RISCV32-NEXT: lw a3, 8(s1)
42 ; RISCV32-NEXT: mul a5, s4, a3
43 ; RISCV32-NEXT: mul s1, a2, s6
44 ; RISCV32-NEXT: add a5, s1, a5
45 ; RISCV32-NEXT: mul s1, a3, s6
46 ; RISCV32-NEXT: mul s0, a1, s5
47 ; RISCV32-NEXT: add s1, s0, s1
48 ; RISCV32-NEXT: sltu s0, s1, s0
49 ; RISCV32-NEXT: mulhu a6, a3, s6
50 ; RISCV32-NEXT: add t1, a6, a5
51 ; RISCV32-NEXT: mulhu t2, a1, s5
52 ; RISCV32-NEXT: add t3, t2, a4
53 ; RISCV32-NEXT: add a5, t3, t1
54 ; RISCV32-NEXT: add a5, a5, s0
55 ; RISCV32-NEXT: lw s0, 44(sp)
56 ; RISCV32-NEXT: add a5, s0, a5
57 ; RISCV32-NEXT: lw a4, 40(sp)
58 ; RISCV32-NEXT: add a7, a4, s1
59 ; RISCV32-NEXT: sltu t0, a7, a4
60 ; RISCV32-NEXT: add a5, a5, t0
61 ; RISCV32-NEXT: beq a5, s0, .LBB0_2
62 ; RISCV32-NEXT: # %bb.1: # %start
63 ; RISCV32-NEXT: sltu t0, a5, s0
64 ; RISCV32-NEXT: .LBB0_2: # %start
65 ; RISCV32-NEXT: snez a4, s3
66 ; RISCV32-NEXT: snez s1, a0
67 ; RISCV32-NEXT: and a4, s1, a4
68 ; RISCV32-NEXT: snez s1, s4
69 ; RISCV32-NEXT: snez s0, a2
70 ; RISCV32-NEXT: and s1, s0, s1
71 ; RISCV32-NEXT: mulhu s0, a2, s6
72 ; RISCV32-NEXT: snez s0, s0
73 ; RISCV32-NEXT: or s1, s1, s0
74 ; RISCV32-NEXT: mulhu s0, a0, s5
75 ; RISCV32-NEXT: snez s0, s0
76 ; RISCV32-NEXT: or a4, a4, s0
77 ; RISCV32-NEXT: sltu t2, t3, t2
78 ; RISCV32-NEXT: mulhu s0, s3, a1
79 ; RISCV32-NEXT: snez s0, s0
80 ; RISCV32-NEXT: or t3, a4, s0
81 ; RISCV32-NEXT: sltu s0, t1, a6
82 ; RISCV32-NEXT: mulhu a4, s4, a3
83 ; RISCV32-NEXT: snez a4, a4
84 ; RISCV32-NEXT: or a4, s1, a4
85 ; RISCV32-NEXT: lw s1, 36(sp)
86 ; RISCV32-NEXT: sw s1, 4(s2)
87 ; RISCV32-NEXT: lw s1, 32(sp)
88 ; RISCV32-NEXT: sw s1, 0(s2)
89 ; RISCV32-NEXT: sw a7, 8(s2)
90 ; RISCV32-NEXT: sw a5, 12(s2)
91 ; RISCV32-NEXT: or a4, a4, s0
92 ; RISCV32-NEXT: or a5, t3, t2
93 ; RISCV32-NEXT: or a0, a1, a0
94 ; RISCV32-NEXT: or a1, a3, a2
95 ; RISCV32-NEXT: snez a1, a1
96 ; RISCV32-NEXT: snez a0, a0
97 ; RISCV32-NEXT: and a0, a0, a1
98 ; RISCV32-NEXT: or a0, a0, a5
99 ; RISCV32-NEXT: or a0, a0, a4
100 ; RISCV32-NEXT: or a0, a0, t0
101 ; RISCV32-NEXT: andi a0, a0, 1
102 ; RISCV32-NEXT: sb a0, 16(s2)
103 ; RISCV32-NEXT: lw s6, 48(sp)
104 ; RISCV32-NEXT: lw s5, 52(sp)
105 ; RISCV32-NEXT: lw s4, 56(sp)
106 ; RISCV32-NEXT: lw s3, 60(sp)
107 ; RISCV32-NEXT: lw s2, 64(sp)
108 ; RISCV32-NEXT: lw s1, 68(sp)
109 ; RISCV32-NEXT: lw s0, 72(sp)
110 ; RISCV32-NEXT: lw ra, 76(sp)
111 ; RISCV32-NEXT: addi sp, sp, 80
114 %0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
115 %1 = extractvalue { i128, i1 } %0, 0
116 %2 = extractvalue { i128, i1 } %0, 1
117 %3 = zext i1 %2 to i8
118 %4 = insertvalue { i128, i8 } undef, i128 %1, 0
119 %5 = insertvalue { i128, i8 } %4, i8 %3, 1
123 ; Function Attrs: nounwind readnone speculatable
124 declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
126 attributes #0 = { nounwind readnone }
127 attributes #1 = { nounwind readnone speculatable }
128 attributes #2 = { nounwind }