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