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 // ---------------------
36 // Let K = 64 (table size).
38 // e = 2 = 2 * T[j] * (1 + P(y))
40 // x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K]
41 // m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2]
43 // values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
45 // P(y) is a minimax polynomial approximation of exp(x)-1
46 // on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
48 // To avoid problems with arithmetic overflow and underflow,
50 // value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
51 // where BIAS is a value of exponent bias.
57 // exp(x) = 1 for subnormals
58 // for finite argument, only exp(0)=1 is exact
60 // if x > 709.782712893383973096 then exp(x) overflow
61 // if x < -745.133219101941108420 then exp(x) underflow
63 /******************************************************************************/
65 #include <private/bionic_asm.h>
66 # -- Begin static_func
68 .align __bionic_asm_align
69 .type static_func, @function
75 lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
76 lea static_const_table@GOTOFF(%eax), %eax
78 .size static_func,.-static_func
83 # parameter 1: 8 + %ebp
92 movsd 128(%esp), %xmm0
94 movapd 64(%ebx), %xmm1
95 movapd 48(%ebx), %xmm6
96 movapd 80(%ebx), %xmm2
97 movapd 96(%ebx), %xmm3
98 pextrw $3, %xmm0, %eax
104 cmpl $-2147483648, %edx
105 jae .L_2TAG_PACKET_0.0.2
111 movapd 128(%ebx), %xmm4
113 movapd 144(%ebx), %xmm5
121 movdqa 16(%ebx), %xmm6
123 movdqa 32(%ebx), %xmm6
127 movapd 160(%ebx,%ecx), %xmm2
135 mulpd 112(%ebx), %xmm6
137 unpckhpd %xmm2, %xmm2
141 unpckhpd %xmm0, %xmm0
146 ja .L_2TAG_PACKET_1.0.2
149 jmp .L_2TAG_PACKET_2.0.2
150 .L_2TAG_PACKET_1.0.2:
152 movzwl 24(%esp), %edx
170 movsd %xmm6, 16(%esp)
180 pextrw $3, %xmm0, %ecx
183 jae .L_2TAG_PACKET_3.0.2
185 je .L_2TAG_PACKET_4.0.2
186 jmp .L_2TAG_PACKET_2.0.2
187 cmpl $-2147483648, %ecx
188 jb .L_2TAG_PACKET_3.0.2
189 cmpl $-1064950997, %ecx
190 jb .L_2TAG_PACKET_2.0.2
191 ja .L_2TAG_PACKET_4.0.2
193 cmpl $-17155601, %edx
194 jb .L_2TAG_PACKET_2.0.2
195 jmp .L_2TAG_PACKET_4.0.2
196 .L_2TAG_PACKET_3.0.2:
198 jmp .L_2TAG_PACKET_5.0.2
199 .L_2TAG_PACKET_4.0.2:
201 .L_2TAG_PACKET_5.0.2:
203 movsd 128(%esp), %xmm0
205 jmp .L_2TAG_PACKET_6.0.2
206 .L_2TAG_PACKET_7.0.2:
207 cmpl $2146435072, %eax
208 jae .L_2TAG_PACKET_8.0.2
210 cmpl $-2147483648, %eax
211 jae .L_2TAG_PACKET_9.0.2
212 movsd 1208(%ebx), %xmm0
215 jmp .L_2TAG_PACKET_5.0.2
216 .L_2TAG_PACKET_9.0.2:
217 movsd 1216(%ebx), %xmm0
220 jmp .L_2TAG_PACKET_5.0.2
221 .L_2TAG_PACKET_8.0.2:
223 cmpl $2146435072, %eax
224 ja .L_2TAG_PACKET_10.0.2
226 jne .L_2TAG_PACKET_10.0.2
228 cmpl $2146435072, %eax
229 jne .L_2TAG_PACKET_11.0.2
230 movsd 1192(%ebx), %xmm0
231 jmp .L_2TAG_PACKET_2.0.2
232 .L_2TAG_PACKET_11.0.2:
233 movsd 1200(%ebx), %xmm0
234 jmp .L_2TAG_PACKET_2.0.2
235 .L_2TAG_PACKET_10.0.2:
236 movsd 128(%esp), %xmm0
238 jmp .L_2TAG_PACKET_2.0.2
239 .L_2TAG_PACKET_0.0.2:
241 andl $2147483647, %eax
242 cmpl $1083179008, %eax
243 jae .L_2TAG_PACKET_7.0.2
244 movsd 128(%esp), %xmm0
245 addsd 1184(%ebx), %xmm0
246 jmp .L_2TAG_PACKET_2.0.2
247 .L_2TAG_PACKET_2.0.2:
248 movsd %xmm0, 48(%esp)
250 .L_2TAG_PACKET_6.0.2:
259 # Start file scope ASM
260 ALIAS_SYMBOL(expl, exp);
262 .section .rodata, "a"
572 .type static_const_table,@object
573 .size static_const_table,1224
575 .section .note.GNU-stack, ""