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