clarify the purpose of this project
[nyanglibc.git] / stdlib / mul_1.s
blobcddc9ebbead07d389e7fce0534eec538188a09fc
1 .text
2 .globl __mpn_mul_1
3 .type __mpn_mul_1,@function
4 .align 1<<4
5 __mpn_mul_1:
6 push %rbx
7 xor %r10, %r10
8 mov (%rsi), %rax
9 mov %rdx, %rbx
10 mul %rcx
11 mov %rbx, %r11
12 add %r10, %rax
13 adc $0, %rdx
14 and $3, %ebx
15 jz .Lb0
16 cmp $2, %ebx
17 jz .Lb2
18 jg .Lb3
19 .Lb1: dec %r11
20 jne .Lgt1
21 mov %rax, (%rdi)
22 jmp .Lret
23 .Lgt1: lea 8(%rsi,%r11,8), %rsi
24 lea -8(%rdi,%r11,8), %rdi
25 neg %r11
26 xor %r10, %r10
27 xor %ebx, %ebx
28 mov %rax, %r9
29 mov (%rsi,%r11,8), %rax
30 mov %rdx, %r8
31 jmp .LL1
32 .Lb0: lea (%rsi,%r11,8), %rsi
33 lea -16(%rdi,%r11,8), %rdi
34 neg %r11
35 xor %r10, %r10
36 mov %rax, %r8
37 mov %rdx, %rbx
38 jmp .LL0
39 .Lb3: lea -8(%rsi,%r11,8), %rsi
40 lea -24(%rdi,%r11,8), %rdi
41 neg %r11
42 mov %rax, %rbx
43 mov %rdx, %r10
44 jmp .LL3
45 .Lb2: lea -16(%rsi,%r11,8), %rsi
46 lea -32(%rdi,%r11,8), %rdi
47 neg %r11
48 xor %r8, %r8
49 xor %ebx, %ebx
50 mov %rax, %r10
51 mov 24(%rsi,%r11,8), %rax
52 mov %rdx, %r9
53 jmp .LL2
54 .p2align 4
55 .Ltop: mov %r10, (%rdi,%r11,8)
56 add %rax, %r9
57 mov (%rsi,%r11,8), %rax
58 adc %rdx, %r8
59 mov $0, %r10d
60 .LL1: mul %rcx
61 mov %r9, 8(%rdi,%r11,8)
62 add %rax, %r8
63 adc %rdx, %rbx
64 .LL0: mov 8(%rsi,%r11,8), %rax
65 mul %rcx
66 mov %r8, 16(%rdi,%r11,8)
67 add %rax, %rbx
68 adc %rdx, %r10
69 .LL3: mov 16(%rsi,%r11,8), %rax
70 mul %rcx
71 mov %rbx, 24(%rdi,%r11,8)
72 mov $0, %r8d # zero
73 mov %r8, %rbx # zero
74 add %rax, %r10
75 mov 24(%rsi,%r11,8), %rax
76 mov %r8, %r9 # zero
77 adc %rdx, %r9
78 .LL2: mul %rcx
79 add $4, %r11
80 js .Ltop
81 mov %r10, (%rdi,%r11,8)
82 add %rax, %r9
83 adc %r8, %rdx
84 mov %r9, 8(%rdi,%r11,8)
85 add %r8, %rdx
86 .Lret: mov %rdx, %rax
87 pop %rbx
88 ret
89 .size __mpn_mul_1,.-__mpn_mul_1