clarify the purpose of this project
[nyanglibc.git] / stdlib / mul.s
blob45d54bf740a7559d3fa33ef43e401f117e8a7616
1 .text
2 .p2align 4,,15
3 .globl __mpn_mul
4 .hidden __mpn_mul
5 .type __mpn_mul, @function
6 __mpn_mul:
7 pushq %rbp
8 movq %rdi, %r9
9 movq %rsp, %rbp
10 pushq %r15
11 pushq %r14
12 pushq %r13
13 pushq %r12
14 movq %rsi, %r13
15 pushq %rbx
16 movq %rdx, %r14
17 movq %r8, %rbx
18 subq $72, %rsp
19 cmpq $31, %r8
20 movq %rcx, -56(%rbp)
21 jg .L2
22 xorl %eax, %eax
23 testq %r8, %r8
24 je .L1
25 movq (%rcx), %rcx
26 cmpq $1, %rcx
27 ja .L4
28 je .L5
29 testq %rdx, %rdx
30 jle .L8
31 leaq (%rdi,%rdx,8), %rdx
32 movq %rdi, %rax
33 .p2align 4,,10
34 .p2align 3
35 .L10:
36 movq $0, (%rax)
37 addq $8, %rax
38 cmpq %rax, %rdx
39 jne .L10
40 .L8:
41 xorl %eax, %eax
42 jmp .L7
43 .p2align 4,,10
44 .p2align 3
45 .L2:
46 movq %r8, %r15
47 movq -56(%rbp), %rdx
48 movq %rbx, %rcx
49 salq $4, %r15
50 movq %rdi, -64(%rbp)
51 addq $16, %r15
52 subq %r15, %rsp
53 leaq 15(%rsp), %rax
54 andq $-16, %rax
55 movq %rax, %r8
56 movq %rax, -72(%rbp)
57 call __mpn_impn_mul_n
58 leaq 0(,%rbx,8), %r10
59 movq -64(%rbp), %r9
60 movq %r14, %r11
61 subq %rbx, %r11
62 addq %r10, %r13
63 cmpq %r11, %rbx
64 leaq (%r9,%r10), %r12
65 jg .L14
66 subq %r15, %rsp
67 movq %r14, -104(%rbp)
68 movq %r9, -96(%rbp)
69 leaq 15(%rsp), %r15
70 movq %r13, %r14
71 movq %rbx, %r13
72 movq %r11, %rbx
73 andq $-16, %r15
74 leaq (%r15,%r10), %rax
75 movq %r15, -64(%rbp)
76 movq %r10, %r15
77 movq %rax, -88(%rbp)
78 addq $8, %rax
79 movq %rax, -80(%rbp)
80 .p2align 4,,10
81 .p2align 3
82 .L22:
83 movq -72(%rbp), %r8
84 movq -56(%rbp), %rdx
85 movq %r13, %rcx
86 movq -64(%rbp), %rdi
87 movq %r14, %rsi
88 call __mpn_impn_mul_n
89 movq -64(%rbp), %rdx
90 movq %r12, %rsi
91 movq %r12, %rdi
92 movq %r13, %rcx
93 addq %r15, %r12
94 call __mpn_add_n
95 movq -88(%rbp), %rdi
96 xorl %edx, %edx
97 leaq 8(%r12), %rcx
98 movq -80(%rbp), %rsi
99 addq (%rdi), %rax
100 setc %dl
101 movq %rax, (%r12)
102 movq %r13, %rax
103 testq %rdx, %rdx
104 jne .L17
105 .L18:
106 cmpq %rsi, %rcx
107 je .L20
108 cmpq $1, %rax
109 jle .L20
110 leaq -1(%rax), %rdx
111 xorl %eax, %eax
112 .p2align 4,,10
113 .p2align 3
114 .L21:
115 movq (%rsi,%rax,8), %rdi
116 movq %rdi, (%rcx,%rax,8)
117 addq $1, %rax
118 cmpq %rdx, %rax
119 jne .L21
120 .L20:
121 subq %r13, %rbx
122 addq %r15, %r14
123 cmpq %rbx, %r13
124 jle .L22
125 movq %rbx, %r11
126 movq -96(%rbp), %r9
127 movq %r13, %rbx
128 movq %r14, %r13
129 movq -104(%rbp), %r14
130 movq %r15, %r10
131 .L14:
132 testq %r11, %r11
133 jne .L48
134 .L23:
135 addq %r14, %rbx
136 movq -8(%r9,%rbx,8), %rax
137 .L1:
138 leaq -40(%rbp), %rsp
139 popq %rbx
140 popq %r12
141 popq %r13
142 popq %r14
143 popq %r15
144 popq %rbp
146 .p2align 4,,10
147 .p2align 3
148 .L4:
149 movq %rdi, -64(%rbp)
150 call __mpn_mul_1
151 movq -64(%rbp), %r9
152 .L7:
153 cmpq $1, %rbx
154 leaq 0(,%r14,8), %r15
155 movq %rax, (%r9,%r14,8)
156 leaq 8(%r9), %r12
157 jle .L1
158 movq -56(%rbp), %r8
159 leaq (%r9,%rbx,8), %rbx
160 movq %r14, %rax
161 movq %r13, -56(%rbp)
162 movq %r15, %r14
163 movq %rax, %r15
164 movq %rbx, %r13
165 addq $8, %r8
166 movq %r8, %rbx
167 jmp .L13
168 .p2align 4,,10
169 .p2align 3
170 .L50:
171 movl $0, %eax
172 je .L49
173 .L12:
174 movq %rax, (%r12,%r14)
175 addq $8, %r12
176 addq $8, %rbx
177 cmpq %r12, %r13
178 je .L1
179 .L13:
180 movq (%rbx), %rcx
181 cmpq $1, %rcx
182 jbe .L50
183 movq -56(%rbp), %rsi
184 movq %r15, %rdx
185 movq %r12, %rdi
186 call __mpn_addmul_1
187 jmp .L12
188 .p2align 4,,10
189 .p2align 3
190 .L19:
191 addq $8, %rsi
192 movq -8(%rsi), %rdi
193 addq $8, %rcx
194 leaq 1(%rdi), %rdx
195 testq %rdx, %rdx
196 movq %rdx, -8(%rcx)
197 jne .L18
198 .L17:
199 subq $1, %rax
200 jne .L19
201 jmp .L20
202 .p2align 4,,10
203 .p2align 3
204 .L49:
205 movq -56(%rbp), %rdx
206 movq %r15, %rcx
207 movq %r12, %rsi
208 movq %r12, %rdi
209 call __mpn_add_n
210 jmp .L12
211 .p2align 4,,10
212 .p2align 3
213 .L5:
214 testq %rdx, %rdx
215 jle .L8
216 xorl %eax, %eax
217 .p2align 4,,10
218 .p2align 3
219 .L9:
220 movq 0(%r13,%rax,8), %rdx
221 movq %rdx, (%r9,%rax,8)
222 addq $1, %rax
223 cmpq %rax, %r14
224 jne .L9
225 xorl %eax, %eax
226 jmp .L7
227 .p2align 4,,10
228 .p2align 3
229 .L48:
230 movq -72(%rbp), %r15
231 movq -56(%rbp), %rsi
232 movq %r11, %r8
233 movq %r13, %rcx
234 movq %rbx, %rdx
235 movq %r9, -88(%rbp)
236 movq %r10, -80(%rbp)
237 movq %r11, -64(%rbp)
238 movq %r15, %rdi
239 call __mpn_mul
240 movq %rbx, %rcx
241 movq %r15, %rdx
242 movq %r12, %rsi
243 movq %r12, %rdi
244 call __mpn_add_n
245 movq -80(%rbp), %r10
246 movq %r15, %rdx
247 xorl %esi, %esi
248 movq -64(%rbp), %r11
249 movq -88(%rbp), %r9
250 addq %r10, %rdx
251 addq %r12, %r10
252 addq (%rdx), %rax
253 leaq 8(%rdx), %rcx
254 leaq 8(%r10), %rdx
255 setc %sil
256 movq %rax, (%r10)
257 testq %rsi, %rsi
258 jne .L26
259 .L27:
260 cmpq %rcx, %rdx
261 je .L23
262 cmpq $1, %r11
263 jle .L23
264 subq $1, %r11
265 xorl %eax, %eax
266 .p2align 4,,10
267 .p2align 3
268 .L29:
269 movq (%rcx,%rax,8), %rsi
270 movq %rsi, (%rdx,%rax,8)
271 addq $1, %rax
272 cmpq %r11, %rax
273 jne .L29
274 jmp .L23
275 .p2align 4,,10
276 .p2align 3
277 .L28:
278 addq $8, %rcx
279 movq -8(%rcx), %rax
280 addq $8, %rdx
281 addq $1, %rax
282 testq %rax, %rax
283 movq %rax, -8(%rdx)
284 jne .L27
285 .L26:
286 subq $1, %r11
287 jne .L28
288 jmp .L23
289 .size __mpn_mul, .-__mpn_mul
290 .hidden __mpn_addmul_1
291 .hidden __mpn_mul_1
292 .hidden __mpn_add_n
293 .hidden __mpn_impn_mul_n