clarify the purpose of this project
[nyanglibc.git] / inet / inet6_rth.s
blob36c19f8cb2b4cd087f16fe16f02fb368f8dca05e
1 .text
2 .p2align 4,,15
3 .globl inet6_rth_space
4 .type inet6_rth_space, @function
5 inet6_rth_space:
6 testl %edi, %edi
7 jne .L6
8 movl %esi, %eax
9 sall $4, %eax
10 addl $8, %eax
11 cmpl $128, %esi
12 cmovnb %edi, %eax
13 ret
14 .p2align 4,,10
15 .p2align 3
16 .L6:
17 xorl %eax, %eax
18 ret
19 .size inet6_rth_space, .-inet6_rth_space
20 .p2align 4,,15
21 .globl inet6_rth_init
22 .type inet6_rth_init, @function
23 inet6_rth_init:
24 testl %edx, %edx
25 jne .L12
26 cmpl $127, %ecx
27 ja .L12
28 pushq %rbx
29 movslq %ecx, %rbx
30 sall $4, %ecx
31 leal 8(%rcx), %edx
32 cmpl %esi, %edx
33 ja .L13
34 salq $4, %rbx
35 xorl %esi, %esi
36 shrq $3, %rbx
37 call memset@PLT
38 movb %bl, 1(%rax)
39 movb $0, 2(%rax)
40 popq %rbx
41 ret
42 .p2align 4,,10
43 .p2align 3
44 .L12:
45 xorl %eax, %eax
46 ret
47 .p2align 4,,10
48 .p2align 3
49 .L13:
50 xorl %eax, %eax
51 popq %rbx
52 ret
53 .size inet6_rth_init, .-inet6_rth_init
54 .p2align 4,,15
55 .globl inet6_rth_add
56 .type inet6_rth_add, @function
57 inet6_rth_add:
58 cmpb $0, 2(%rdi)
59 jne .L23
60 movzbl 1(%rdi), %eax
61 movzbl 3(%rdi), %edx
62 sall $3, %eax
63 movq %rdx, %rcx
64 cltq
65 shrq $4, %rax
66 cmpq %rdx, %rax
67 je .L23
68 addl $1, %ecx
69 salq $4, %rdx
70 xorl %eax, %eax
71 movb %cl, 3(%rdi)
72 movdqu (%rsi), %xmm0
73 movups %xmm0, 8(%rdi,%rdx)
74 ret
75 .p2align 4,,10
76 .p2align 3
77 .L23:
78 movl $-1, %eax
79 ret
80 .size inet6_rth_add, .-inet6_rth_add
81 .p2align 4,,15
82 .globl inet6_rth_reverse
83 .type inet6_rth_reverse, @function
84 inet6_rth_reverse:
85 cmpb $0, 2(%rdi)
86 jne .L42
87 movq (%rdi), %rax
88 movq %rax, (%rsi)
89 movzbl 1(%rdi), %ecx
90 sall $3, %ecx
91 movslq %ecx, %rcx
92 shrq $4, %rcx
93 movl %ecx, %r9d
94 sarl %r9d
95 je .L28
96 leal -1(%rcx), %edx
97 leal -1(%r9), %r8d
98 xorl %eax, %eax
99 movslq %edx, %rdx
100 addq $1, %r8
101 salq $4, %rdx
102 salq $4, %r8
103 .p2align 4,,10
104 .p2align 3
105 .L29:
106 movdqu 8(%rdi,%rdx), %xmm1
107 movdqu 8(%rdi,%rax), %xmm0
108 movups %xmm1, 8(%rsi,%rax)
109 addq $16, %rax
110 movups %xmm0, 8(%rsi,%rdx)
111 subq $16, %rdx
112 cmpq %r8, %rax
113 jne .L29
114 .L28:
115 cmpq %rsi, %rdi
116 je .L30
117 testb $1, %cl
118 je .L30
119 movslq %r9d, %r9
120 salq $4, %r9
121 movdqu 8(%rdi,%r9), %xmm0
122 movups %xmm0, 8(%rsi,%r9)
123 .L30:
124 movb %cl, 3(%rsi)
125 xorl %eax, %eax
127 .L42:
128 movl $-1, %eax
130 .size inet6_rth_reverse, .-inet6_rth_reverse
131 .p2align 4,,15
132 .globl inet6_rth_segments
133 .type inet6_rth_segments, @function
134 inet6_rth_segments:
135 cmpb $0, 2(%rdi)
136 jne .L47
137 movzbl 1(%rdi), %eax
138 sall $3, %eax
139 shrq $4, %rax
140 andl $127, %eax
142 .p2align 4,,10
143 .p2align 3
144 .L47:
145 movl $-1, %eax
147 .size inet6_rth_segments, .-inet6_rth_segments
148 .p2align 4,,15
149 .globl inet6_rth_getaddr
150 .type inet6_rth_getaddr, @function
151 inet6_rth_getaddr:
152 cmpb $0, 2(%rdi)
153 jne .L52
154 movzbl 1(%rdi), %eax
155 movslq %esi, %rsi
156 sall $3, %eax
157 cltq
158 shrq $4, %rax
159 cmpq %rax, %rsi
160 jnb .L52
161 salq $4, %rsi
162 leaq 8(%rdi,%rsi), %rax
164 .p2align 4,,10
165 .p2align 3
166 .L52:
167 xorl %eax, %eax
169 .size inet6_rth_getaddr, .-inet6_rth_getaddr