clarify the purpose of this project
[nyanglibc.git] / stdlib / rshift.shared.s
blob31b13d3cca4e9285692a68620baa1d2dd0860323
1 .text
2 .globl __mpn_rshift
3 .type __mpn_rshift,@function
4 .align 1<<4
5 __mpn_rshift:
6 mov %edx, %eax
7 and $3, %eax
8 jne .Lnb00
9 .Lb00:
10 mov (%rsi), %r10
11 mov 8(%rsi), %r11
12 xor %eax, %eax
13 shrd %cl, %r10, %rax
14 mov 16(%rsi), %r8
15 lea 8(%rsi), %rsi
16 lea -24(%rdi), %rdi
17 sub $4, %rdx
18 jmp .L00
19 .Lnb00:
20 cmp $2, %eax
21 jae .Lnb01
22 .Lb01: mov (%rsi), %r9
23 xor %eax, %eax
24 shrd %cl, %r9, %rax
25 sub $2, %rdx
26 jb .Lle1
27 mov 8(%rsi), %r10
28 mov 16(%rsi), %r11
29 lea 16(%rsi), %rsi
30 lea -16(%rdi), %rdi
31 jmp .L01
32 .Lle1: shr %cl, %r9
33 mov %r9, (%rdi)
34 ret
35 .Lnb01:
36 jne .Lb11
37 .Lb10: mov (%rsi), %r8
38 mov 8(%rsi), %r9
39 xor %eax, %eax
40 shrd %cl, %r8, %rax
41 sub $3, %rdx
42 jb .Lle2
43 mov 16(%rsi), %r10
44 lea 24(%rsi), %rsi
45 lea -8(%rdi), %rdi
46 jmp .L10
47 .Lle2: shrd %cl, %r9, %r8
48 mov %r8, (%rdi)
49 shr %cl, %r9
50 mov %r9, 8(%rdi)
51 ret
52 .p2align 4
53 .Lb11:
54 mov (%rsi), %r11
55 mov 8(%rsi), %r8
56 xor %eax, %eax
57 shrd %cl, %r11, %rax
58 mov 16(%rsi), %r9
59 lea 32(%rsi), %rsi
60 sub $4, %rdx
61 jb .Lend
62 .p2align 4
63 .Ltop: shrd %cl, %r8, %r11
64 mov -8(%rsi), %r10
65 mov %r11, (%rdi)
66 .L10: shrd %cl, %r9, %r8
67 mov (%rsi), %r11
68 mov %r8, 8(%rdi)
69 .L01: shrd %cl, %r10, %r9
70 mov 8(%rsi), %r8
71 mov %r9, 16(%rdi)
72 .L00: shrd %cl, %r11, %r10
73 mov 16(%rsi), %r9
74 mov %r10, 24(%rdi)
75 add $32, %rsi
76 lea 32(%rdi), %rdi
77 sub $4, %rdx
78 jnc .Ltop
79 .Lend: shrd %cl, %r8, %r11
80 mov %r11, (%rdi)
81 shrd %cl, %r9, %r8
82 mov %r8, 8(%rdi)
83 shr %cl, %r9
84 mov %r9, 16(%rdi)
85 ret
86 .size __mpn_rshift,.-__mpn_rshift