2 Copyright (c) 2014, Intel Corporation
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
15 * Neither the name of Intel Corporation nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 /******************************************************************************/
32 // ALGORITHM DESCRIPTION
33 // ---------------------
35 // x=2^k * mx, mx in [1,2)
37 // Get B~1/mx based on the output of rcpss instruction (B0)
38 // B = int((B0*2^7+0.5))/2^7
40 // Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
42 // Result: k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6) and
43 // p(r) is a degree 7 polynomial
44 // -log(B) read from data table (high, low parts)
45 // Result is formed from high and low parts
48 // log(NaN) = quiet NaN, and raise invalid exception
49 // log(+INF) = that INF
50 // log(0) = -INF with divide-by-zero exception raised
52 // log(x) = NaN with invalid exception raised if x < -0, including -INF
54 /******************************************************************************/
56 #include <private/bionic_asm.h>
57 # -- Begin static_func
59 .align __bionic_asm_align
60 .type static_func, @function
66 lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
67 lea static_const_table@GOTOFF(%eax), %eax
69 .size static_func,.-static_func
74 # parameter 1: 8 + %ebp
85 pinsrw $3, %eax, %xmm2
88 pinsrw $3, %edx, %xmm3
89 movsd 112(%esp), %xmm0
93 movsd 2128(%ebx), %xmm5
94 pextrw $3, %xmm0, %eax
101 pshufd $228, %xmm5, %xmm6
105 jae .L_2TAG_PACKET_0.0.2
106 .L_2TAG_PACKET_1.0.2:
117 cvtsi2sdl %eax, %xmm7
119 movsd 2064(%ebx), %xmm6
120 movapd 2080(%ebx), %xmm3
124 movapd (%ebx,%edx), %xmm0
125 movapd 2096(%ebx), %xmm4
127 movapd 2112(%ebx), %xmm2
129 pshufd $68, %xmm1, %xmm5
130 mulsd 2072(%ebx), %xmm7
135 pshufd $228, %xmm0, %xmm6
141 pshufd $238, %xmm0, %xmm2
149 pshufd $238, %xmm4, %xmm5
152 jmp .L_2TAG_PACKET_2.0.2
153 .L_2TAG_PACKET_0.0.2:
154 movsd 112(%esp), %xmm0
158 jae .L_2TAG_PACKET_3.0.2
160 jb .L_2TAG_PACKET_4.0.2
161 .L_2TAG_PACKET_5.0.2:
163 jmp .L_2TAG_PACKET_2.0.2
164 .L_2TAG_PACKET_6.0.2:
165 ja .L_2TAG_PACKET_5.0.2
167 ja .L_2TAG_PACKET_5.0.2
168 jmp .L_2TAG_PACKET_7.0.2
169 .L_2TAG_PACKET_3.0.2:
175 jae .L_2TAG_PACKET_6.0.2
178 je .L_2TAG_PACKET_8.0.2
179 .L_2TAG_PACKET_7.0.2:
183 pinsrw $3, %eax, %xmm1
186 .L_2TAG_PACKET_9.0.2:
188 movsd 112(%esp), %xmm0
190 jmp .L_2TAG_PACKET_10.0.2
191 .L_2TAG_PACKET_8.0.2:
195 pinsrw $3, %eax, %xmm0
198 jmp .L_2TAG_PACKET_9.0.2
199 .L_2TAG_PACKET_4.0.2:
205 je .L_2TAG_PACKET_8.0.2
208 pinsrw $3, %eax, %xmm1
211 pextrw $3, %xmm0, %eax
218 pshufd $228, %xmm5, %xmm6
220 jmp .L_2TAG_PACKET_1.0.2
221 .L_2TAG_PACKET_2.0.2:
222 movsd %xmm0, 24(%esp)
224 .L_2TAG_PACKET_10.0.2:
233 # Start file scope ASM
234 ALIAS_SYMBOL(logl, log);
236 .section .rodata, "a"
776 .type static_const_table,@object
777 .size static_const_table,2144
779 .section .note.GNU-stack, ""