1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=thumb-eabi -mattr=+v6 | FileCheck %s --check-prefixes=THUMBV6
4 define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
5 ; THUMBV6-LABEL: muloti_test:
6 ; THUMBV6: @ %bb.0: @ %start
7 ; THUMBV6-NEXT: .save {r4, r5, r6, r7, lr}
8 ; THUMBV6-NEXT: push {r4, r5, r6, r7, lr}
9 ; THUMBV6-NEXT: .pad #84
10 ; THUMBV6-NEXT: sub sp, #84
11 ; THUMBV6-NEXT: mov r6, r3
12 ; THUMBV6-NEXT: mov r7, r2
13 ; THUMBV6-NEXT: mov r4, r0
14 ; THUMBV6-NEXT: movs r5, #0
15 ; THUMBV6-NEXT: mov r0, sp
16 ; THUMBV6-NEXT: str r5, [r0, #12]
17 ; THUMBV6-NEXT: str r5, [r0, #8]
18 ; THUMBV6-NEXT: ldr r1, [sp, #116]
19 ; THUMBV6-NEXT: str r1, [sp, #72] @ 4-byte Spill
20 ; THUMBV6-NEXT: str r1, [r0, #4]
21 ; THUMBV6-NEXT: ldr r1, [sp, #112]
22 ; THUMBV6-NEXT: str r1, [sp, #44] @ 4-byte Spill
23 ; THUMBV6-NEXT: str r1, [r0]
24 ; THUMBV6-NEXT: mov r0, r2
25 ; THUMBV6-NEXT: mov r1, r3
26 ; THUMBV6-NEXT: mov r2, r5
27 ; THUMBV6-NEXT: mov r3, r5
28 ; THUMBV6-NEXT: bl __multi3
29 ; THUMBV6-NEXT: str r2, [sp, #36] @ 4-byte Spill
30 ; THUMBV6-NEXT: str r3, [sp, #40] @ 4-byte Spill
31 ; THUMBV6-NEXT: str r4, [sp, #76] @ 4-byte Spill
32 ; THUMBV6-NEXT: stm r4!, {r0, r1}
33 ; THUMBV6-NEXT: ldr r4, [sp, #120]
34 ; THUMBV6-NEXT: str r6, [sp, #56] @ 4-byte Spill
35 ; THUMBV6-NEXT: mov r0, r6
36 ; THUMBV6-NEXT: mov r1, r5
37 ; THUMBV6-NEXT: mov r2, r4
38 ; THUMBV6-NEXT: mov r3, r5
39 ; THUMBV6-NEXT: bl __aeabi_lmul
40 ; THUMBV6-NEXT: mov r6, r0
41 ; THUMBV6-NEXT: str r1, [sp, #48] @ 4-byte Spill
42 ; THUMBV6-NEXT: ldr r0, [sp, #124]
43 ; THUMBV6-NEXT: str r0, [sp, #80] @ 4-byte Spill
44 ; THUMBV6-NEXT: mov r1, r5
45 ; THUMBV6-NEXT: mov r2, r7
46 ; THUMBV6-NEXT: mov r3, r5
47 ; THUMBV6-NEXT: bl __aeabi_lmul
48 ; THUMBV6-NEXT: str r1, [sp, #28] @ 4-byte Spill
49 ; THUMBV6-NEXT: adds r6, r0, r6
50 ; THUMBV6-NEXT: str r4, [sp, #68] @ 4-byte Spill
51 ; THUMBV6-NEXT: mov r0, r4
52 ; THUMBV6-NEXT: mov r1, r5
53 ; THUMBV6-NEXT: mov r2, r7
54 ; THUMBV6-NEXT: mov r3, r5
55 ; THUMBV6-NEXT: bl __aeabi_lmul
56 ; THUMBV6-NEXT: str r0, [sp, #20] @ 4-byte Spill
57 ; THUMBV6-NEXT: adds r0, r1, r6
58 ; THUMBV6-NEXT: str r0, [sp, #16] @ 4-byte Spill
59 ; THUMBV6-NEXT: mov r0, r5
60 ; THUMBV6-NEXT: adcs r0, r5
61 ; THUMBV6-NEXT: str r0, [sp, #64] @ 4-byte Spill
62 ; THUMBV6-NEXT: ldr r7, [sp, #104]
63 ; THUMBV6-NEXT: ldr r0, [sp, #72] @ 4-byte Reload
64 ; THUMBV6-NEXT: mov r1, r5
65 ; THUMBV6-NEXT: mov r2, r7
66 ; THUMBV6-NEXT: mov r3, r5
67 ; THUMBV6-NEXT: bl __aeabi_lmul
68 ; THUMBV6-NEXT: mov r6, r0
69 ; THUMBV6-NEXT: str r1, [sp, #52] @ 4-byte Spill
70 ; THUMBV6-NEXT: ldr r0, [sp, #108]
71 ; THUMBV6-NEXT: str r0, [sp, #60] @ 4-byte Spill
72 ; THUMBV6-NEXT: mov r1, r5
73 ; THUMBV6-NEXT: ldr r4, [sp, #44] @ 4-byte Reload
74 ; THUMBV6-NEXT: mov r2, r4
75 ; THUMBV6-NEXT: mov r3, r5
76 ; THUMBV6-NEXT: bl __aeabi_lmul
77 ; THUMBV6-NEXT: str r1, [sp, #32] @ 4-byte Spill
78 ; THUMBV6-NEXT: adds r6, r0, r6
79 ; THUMBV6-NEXT: str r7, [sp, #24] @ 4-byte Spill
80 ; THUMBV6-NEXT: mov r0, r7
81 ; THUMBV6-NEXT: mov r1, r5
82 ; THUMBV6-NEXT: mov r2, r4
83 ; THUMBV6-NEXT: mov r3, r5
84 ; THUMBV6-NEXT: bl __aeabi_lmul
85 ; THUMBV6-NEXT: adds r1, r1, r6
86 ; THUMBV6-NEXT: mov r2, r5
87 ; THUMBV6-NEXT: adcs r2, r5
88 ; THUMBV6-NEXT: str r2, [sp, #44] @ 4-byte Spill
89 ; THUMBV6-NEXT: ldr r2, [sp, #20] @ 4-byte Reload
90 ; THUMBV6-NEXT: adds r0, r0, r2
91 ; THUMBV6-NEXT: ldr r2, [sp, #16] @ 4-byte Reload
92 ; THUMBV6-NEXT: adcs r1, r2
93 ; THUMBV6-NEXT: ldr r2, [sp, #36] @ 4-byte Reload
94 ; THUMBV6-NEXT: adds r0, r2, r0
95 ; THUMBV6-NEXT: ldr r2, [sp, #76] @ 4-byte Reload
96 ; THUMBV6-NEXT: str r0, [r2, #8]
97 ; THUMBV6-NEXT: ldr r0, [sp, #40] @ 4-byte Reload
98 ; THUMBV6-NEXT: adcs r1, r0
99 ; THUMBV6-NEXT: str r1, [r2, #12]
100 ; THUMBV6-NEXT: ldr r1, [sp, #28] @ 4-byte Reload
101 ; THUMBV6-NEXT: adcs r5, r5
102 ; THUMBV6-NEXT: movs r0, #1
103 ; THUMBV6-NEXT: cmp r1, #0
104 ; THUMBV6-NEXT: mov r2, r0
105 ; THUMBV6-NEXT: bne .LBB0_2
106 ; THUMBV6-NEXT: @ %bb.1: @ %start
107 ; THUMBV6-NEXT: mov r2, r1
108 ; THUMBV6-NEXT: .LBB0_2: @ %start
109 ; THUMBV6-NEXT: str r2, [sp, #40] @ 4-byte Spill
110 ; THUMBV6-NEXT: ldr r1, [sp, #56] @ 4-byte Reload
111 ; THUMBV6-NEXT: cmp r1, #0
112 ; THUMBV6-NEXT: mov r4, r0
113 ; THUMBV6-NEXT: bne .LBB0_4
114 ; THUMBV6-NEXT: @ %bb.3: @ %start
115 ; THUMBV6-NEXT: mov r4, r1
116 ; THUMBV6-NEXT: .LBB0_4: @ %start
117 ; THUMBV6-NEXT: ldr r1, [sp, #80] @ 4-byte Reload
118 ; THUMBV6-NEXT: cmp r1, #0
119 ; THUMBV6-NEXT: mov r2, r0
120 ; THUMBV6-NEXT: ldr r3, [sp, #48] @ 4-byte Reload
121 ; THUMBV6-NEXT: ldr r6, [sp, #32] @ 4-byte Reload
122 ; THUMBV6-NEXT: bne .LBB0_6
123 ; THUMBV6-NEXT: @ %bb.5: @ %start
124 ; THUMBV6-NEXT: ldr r2, [sp, #80] @ 4-byte Reload
125 ; THUMBV6-NEXT: .LBB0_6: @ %start
126 ; THUMBV6-NEXT: cmp r3, #0
127 ; THUMBV6-NEXT: mov r7, r0
128 ; THUMBV6-NEXT: ldr r1, [sp, #72] @ 4-byte Reload
129 ; THUMBV6-NEXT: bne .LBB0_8
130 ; THUMBV6-NEXT: @ %bb.7: @ %start
131 ; THUMBV6-NEXT: mov r7, r3
132 ; THUMBV6-NEXT: .LBB0_8: @ %start
133 ; THUMBV6-NEXT: cmp r6, #0
134 ; THUMBV6-NEXT: mov r3, r0
135 ; THUMBV6-NEXT: bne .LBB0_10
136 ; THUMBV6-NEXT: @ %bb.9: @ %start
137 ; THUMBV6-NEXT: mov r3, r6
138 ; THUMBV6-NEXT: .LBB0_10: @ %start
139 ; THUMBV6-NEXT: cmp r1, #0
140 ; THUMBV6-NEXT: mov r6, r1
141 ; THUMBV6-NEXT: mov r1, r0
142 ; THUMBV6-NEXT: bne .LBB0_12
143 ; THUMBV6-NEXT: @ %bb.11: @ %start
144 ; THUMBV6-NEXT: mov r1, r6
145 ; THUMBV6-NEXT: .LBB0_12: @ %start
146 ; THUMBV6-NEXT: str r7, [sp, #72] @ 4-byte Spill
147 ; THUMBV6-NEXT: ands r2, r4
148 ; THUMBV6-NEXT: ldr r6, [sp, #60] @ 4-byte Reload
149 ; THUMBV6-NEXT: cmp r6, #0
150 ; THUMBV6-NEXT: mov r4, r0
151 ; THUMBV6-NEXT: bne .LBB0_14
152 ; THUMBV6-NEXT: @ %bb.13: @ %start
153 ; THUMBV6-NEXT: mov r4, r6
154 ; THUMBV6-NEXT: .LBB0_14: @ %start
155 ; THUMBV6-NEXT: ldr r7, [sp, #40] @ 4-byte Reload
156 ; THUMBV6-NEXT: orrs r2, r7
157 ; THUMBV6-NEXT: ands r4, r1
158 ; THUMBV6-NEXT: orrs r4, r3
159 ; THUMBV6-NEXT: ldr r3, [sp, #52] @ 4-byte Reload
160 ; THUMBV6-NEXT: cmp r3, #0
161 ; THUMBV6-NEXT: mov r1, r0
162 ; THUMBV6-NEXT: bne .LBB0_16
163 ; THUMBV6-NEXT: @ %bb.15: @ %start
164 ; THUMBV6-NEXT: mov r1, r3
165 ; THUMBV6-NEXT: .LBB0_16: @ %start
166 ; THUMBV6-NEXT: ldr r3, [sp, #72] @ 4-byte Reload
167 ; THUMBV6-NEXT: orrs r2, r3
168 ; THUMBV6-NEXT: orrs r4, r1
169 ; THUMBV6-NEXT: ldr r1, [sp, #68] @ 4-byte Reload
170 ; THUMBV6-NEXT: ldr r3, [sp, #80] @ 4-byte Reload
171 ; THUMBV6-NEXT: orrs r1, r3
172 ; THUMBV6-NEXT: cmp r1, #0
173 ; THUMBV6-NEXT: mov r3, r0
174 ; THUMBV6-NEXT: bne .LBB0_18
175 ; THUMBV6-NEXT: @ %bb.17: @ %start
176 ; THUMBV6-NEXT: mov r3, r1
177 ; THUMBV6-NEXT: .LBB0_18: @ %start
178 ; THUMBV6-NEXT: ldr r1, [sp, #64] @ 4-byte Reload
179 ; THUMBV6-NEXT: orrs r2, r1
180 ; THUMBV6-NEXT: ldr r1, [sp, #44] @ 4-byte Reload
181 ; THUMBV6-NEXT: orrs r4, r1
182 ; THUMBV6-NEXT: ldr r1, [sp, #24] @ 4-byte Reload
183 ; THUMBV6-NEXT: orrs r1, r6
184 ; THUMBV6-NEXT: mov r6, r1
185 ; THUMBV6-NEXT: cmp r1, #0
186 ; THUMBV6-NEXT: mov r1, r0
187 ; THUMBV6-NEXT: bne .LBB0_20
188 ; THUMBV6-NEXT: @ %bb.19: @ %start
189 ; THUMBV6-NEXT: mov r1, r6
190 ; THUMBV6-NEXT: .LBB0_20: @ %start
191 ; THUMBV6-NEXT: ands r1, r3
192 ; THUMBV6-NEXT: orrs r1, r4
193 ; THUMBV6-NEXT: orrs r1, r2
194 ; THUMBV6-NEXT: orrs r1, r5
195 ; THUMBV6-NEXT: ands r1, r0
196 ; THUMBV6-NEXT: ldr r0, [sp, #76] @ 4-byte Reload
197 ; THUMBV6-NEXT: strb r1, [r0, #16]
198 ; THUMBV6-NEXT: add sp, #84
199 ; THUMBV6-NEXT: pop {r4, r5, r6, r7, pc}
201 %0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
202 %1 = extractvalue { i128, i1 } %0, 0
203 %2 = extractvalue { i128, i1 } %0, 1
204 %3 = zext i1 %2 to i8
205 %4 = insertvalue { i128, i8 } undef, i128 %1, 0
206 %5 = insertvalue { i128, i8 } %4, i8 %3, 1
210 ; Function Attrs: nounwind readnone speculatable
211 declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
213 attributes #0 = { nounwind readnone uwtable }
214 attributes #1 = { nounwind readnone speculatable }
215 attributes #2 = { nounwind }