Add the optimized implementation of 18 math functions for x86 and x86_64 respectively

Change-Id: I31bf601448a9427f825517f3a0ff24de47f49bfa
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
This commit is contained in:
Jingwei Zhang 2014-10-31 18:29:18 +08:00 committed by Christopher Ferris
parent edc1d3e3c6
commit 5d4f0e6a26
40 changed files with 52124 additions and 18 deletions

View File

@ -21,19 +21,14 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c \
upstream-freebsd/lib/msun/src/catrig.c \
upstream-freebsd/lib/msun/src/catrigf.c \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_acosf.c \
upstream-freebsd/lib/msun/src/e_acosh.c \
upstream-freebsd/lib/msun/src/e_acoshf.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_asinf.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_atan2f.c \
upstream-freebsd/lib/msun/src/e_atanh.c \
upstream-freebsd/lib/msun/src/e_atanhf.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_coshf.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_expf.c \
upstream-freebsd/lib/msun/src/e_fmod.c \
upstream-freebsd/lib/msun/src/e_fmodf.c \
@ -41,7 +36,6 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/e_gammaf.c \
upstream-freebsd/lib/msun/src/e_gammaf_r.c \
upstream-freebsd/lib/msun/src/e_gamma_r.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_hypotf.c \
upstream-freebsd/lib/msun/src/e_j0.c \
upstream-freebsd/lib/msun/src/e_j0f.c \
@ -53,13 +47,10 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/e_lgammaf.c \
upstream-freebsd/lib/msun/src/e_lgammaf_r.c \
upstream-freebsd/lib/msun/src/e_lgamma_r.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_log10f.c \
upstream-freebsd/lib/msun/src/e_log2.c \
upstream-freebsd/lib/msun/src/e_log2f.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_logf.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_powf.c \
upstream-freebsd/lib/msun/src/e_remainder.c \
upstream-freebsd/lib/msun/src/e_remainderf.c \
@ -67,7 +58,6 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/e_rem_pio2f.c \
upstream-freebsd/lib/msun/src/e_scalb.c \
upstream-freebsd/lib/msun/src/e_scalbf.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/e_sinhf.c \
upstream-freebsd/lib/msun/src/imprecise.c \
upstream-freebsd/lib/msun/src/k_cos.c \
@ -81,12 +71,10 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/k_tanf.c \
upstream-freebsd/lib/msun/src/s_asinh.c \
upstream-freebsd/lib/msun/src/s_asinhf.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_atanf.c \
upstream-freebsd/lib/msun/src/s_carg.c \
upstream-freebsd/lib/msun/src/s_cargf.c \
upstream-freebsd/lib/msun/src/s_cargl.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_cbrtf.c \
upstream-freebsd/lib/msun/src/s_ccosh.c \
upstream-freebsd/lib/msun/src/s_ccoshf.c \
@ -100,7 +88,6 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_conjl.c \
upstream-freebsd/lib/msun/src/s_copysign.c \
upstream-freebsd/lib/msun/src/s_copysignf.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_cosf.c \
upstream-freebsd/lib/msun/src/s_cproj.c \
upstream-freebsd/lib/msun/src/s_cprojf.c \
@ -119,7 +106,6 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_erff.c \
upstream-freebsd/lib/msun/src/s_exp2.c \
upstream-freebsd/lib/msun/src/s_exp2f.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_expm1f.c \
upstream-freebsd/lib/msun/src/s_fabs.c \
upstream-freebsd/lib/msun/src/s_fabsf.c \
@ -136,7 +122,6 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_ilogbf.c \
upstream-freebsd/lib/msun/src/s_llround.c \
upstream-freebsd/lib/msun/src/s_llroundf.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_log1pf.c \
upstream-freebsd/lib/msun/src/s_logb.c \
upstream-freebsd/lib/msun/src/s_logbf.c \
@ -158,11 +143,8 @@ LOCAL_SRC_FILES := \
upstream-freebsd/lib/msun/src/s_signgam.c \
upstream-freebsd/lib/msun/src/s_significand.c \
upstream-freebsd/lib/msun/src/s_significandf.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_sinf.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanf.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
upstream-freebsd/lib/msun/src/s_tanhf.c \
upstream-freebsd/lib/msun/src/s_tgammaf.c \
upstream-freebsd/lib/msun/src/w_cabs.c \
@ -252,17 +234,35 @@ LOCAL_SRC_FILES += \
# -----------------------------------------------------------------------------
LOCAL_SRC_FILES_arm += \
arm/fenv.c \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_floorf.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
upstream-freebsd/lib/msun/src/s_trunc.c \
upstream-freebsd/lib/msun/src/s_truncf.c \
@ -300,26 +300,62 @@ LOCAL_SRC_FILES_arm64 += \
arm64/rint.S \
arm64/sqrt.S \
arm64/trunc.S \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
# -----------------------------------------------------------------------------
# mips
# -----------------------------------------------------------------------------
libm_mips_arch_files := \
mips/fenv.c \
upstream-freebsd/lib/msun/src/e_acos.c \
upstream-freebsd/lib/msun/src/e_asin.c \
upstream-freebsd/lib/msun/src/e_atan2.c \
upstream-freebsd/lib/msun/src/e_cosh.c \
upstream-freebsd/lib/msun/src/e_exp.c \
upstream-freebsd/lib/msun/src/e_hypot.c \
upstream-freebsd/lib/msun/src/e_log.c \
upstream-freebsd/lib/msun/src/e_log10.c \
upstream-freebsd/lib/msun/src/e_pow.c \
upstream-freebsd/lib/msun/src/e_sinh.c \
upstream-freebsd/lib/msun/src/e_sqrt.c \
upstream-freebsd/lib/msun/src/e_sqrtf.c \
upstream-freebsd/lib/msun/src/s_atan.c \
upstream-freebsd/lib/msun/src/s_cbrt.c \
upstream-freebsd/lib/msun/src/s_ceil.c \
upstream-freebsd/lib/msun/src/s_ceilf.c \
upstream-freebsd/lib/msun/src/s_cos.c \
upstream-freebsd/lib/msun/src/s_fma.c \
upstream-freebsd/lib/msun/src/s_fmaf.c \
upstream-freebsd/lib/msun/src/s_floor.c \
upstream-freebsd/lib/msun/src/s_floorf.c \
upstream-freebsd/lib/msun/src/s_expm1.c \
upstream-freebsd/lib/msun/src/s_llrint.c \
upstream-freebsd/lib/msun/src/s_llrintf.c \
upstream-freebsd/lib/msun/src/s_log1p.c \
upstream-freebsd/lib/msun/src/s_lrint.c \
upstream-freebsd/lib/msun/src/s_lrintf.c \
upstream-freebsd/lib/msun/src/s_rint.c \
upstream-freebsd/lib/msun/src/s_rintf.c \
upstream-freebsd/lib/msun/src/s_sin.c \
upstream-freebsd/lib/msun/src/s_tan.c \
upstream-freebsd/lib/msun/src/s_tanh.c \
upstream-freebsd/lib/msun/src/s_trunc.c \
upstream-freebsd/lib/msun/src/s_truncf.c \
@ -341,6 +377,27 @@ LOCAL_SRC_FILES_x86 += \
upstream-freebsd/lib/msun/src/s_rintf.c \
x86/sqrt.S \
x86/sqrtf.S \
x86/e_acos.S \
x86/e_asin.S \
x86/e_atan2.S \
x86/e_cosh.S \
x86/e_exp.S \
x86/e_hypot.S \
x86/e_log10.S \
x86/e_log.S \
x86/e_pow.S \
x86/e_sinh.S \
x86/libm_reduce_pi04l.S \
x86/libm_sincos_huge.S \
x86/libm_tancot_huge.S \
x86/s_atan.S \
x86/s_cbrt.S \
x86/s_cos.S \
x86/s_expm1.S \
x86/s_log1p.S \
x86/s_sin.S \
x86/s_tanh.S \
x86/s_tan.S \
ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
LOCAL_SRC_FILES_x86 += \
@ -377,6 +434,24 @@ LOCAL_SRC_FILES_x86_64 += \
upstream-freebsd/lib/msun/src/s_rintf.c \
x86_64/sqrt.S \
x86_64/sqrtf.S \
x86_64/e_acos.S \
x86_64/e_asin.S \
x86_64/e_atan2.S \
x86_64/e_cosh.S \
x86_64/e_exp.S \
x86_64/e_hypot.S \
x86_64/e_log10.S \
x86_64/e_log.S \
x86_64/e_pow.S \
x86_64/e_sinh.S \
x86_64/s_atan.S \
x86_64/s_cbrt.S \
x86_64/s_cos.S \
x86_64/s_expm1.S \
x86_64/s_log1p.S \
x86_64/s_sin.S \
x86_64/s_tanh.S \
x86_64/s_tan.S \
ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
LOCAL_SRC_FILES_x86_64 += \

1930
libm/x86/e_acos.S Normal file

File diff suppressed because it is too large Load Diff

2004
libm/x86/e_asin.S Normal file

File diff suppressed because it is too large Load Diff

1222
libm/x86/e_atan2.S Normal file

File diff suppressed because it is too large Load Diff

1350
libm/x86/e_cosh.S Normal file

File diff suppressed because it is too large Load Diff

577
libm/x86/e_exp.S Normal file
View File

@ -0,0 +1,577 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Description:
// Let K = 64 (table size).
// x x/log(2) n
// e = 2 = 2 * T[j] * (1 + P(y))
// where
// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K]
// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2]
// j/K
// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
//
// P(y) is a minimax polynomial approximation of exp(x)-1
// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
//
// To avoid problems with arithmetic overflow and underflow,
// n n1 n2
// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
// where BIAS is a value of exponent bias.
//
// Special cases:
// exp(NaN) = NaN
// exp(+INF) = +INF
// exp(-INF) = 0
// exp(x) = 1 for subnormals
// for finite argument, only exp(0)=1 is exact
// For IEEE double
// if x > 709.782712893383973096 then exp(x) overflow
// if x < -745.133219101941108420 then exp(x) underflow
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin exp
ENTRY(exp)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $120, %esp
movl %ebx, 64(%esp)
call static_func
movl %eax, %ebx
movsd 128(%esp), %xmm0
unpcklpd %xmm0, %xmm0
movapd 64(%ebx), %xmm1
movapd 48(%ebx), %xmm6
movapd 80(%ebx), %xmm2
movapd 96(%ebx), %xmm3
pextrw $3, %xmm0, %eax
andl $32767, %eax
movl $16527, %edx
subl %eax, %edx
subl $15504, %eax
orl %eax, %edx
cmpl $-2147483648, %edx
jae .L_2TAG_PACKET_0.0.2
mulpd %xmm0, %xmm1
addpd %xmm6, %xmm1
movapd %xmm1, %xmm7
subpd %xmm6, %xmm1
mulpd %xmm1, %xmm2
movapd 128(%ebx), %xmm4
mulpd %xmm1, %xmm3
movapd 144(%ebx), %xmm5
subpd %xmm2, %xmm0
movd %xmm7, %eax
movl %eax, %ecx
andl $63, %ecx
shll $4, %ecx
sarl $6, %eax
movl %eax, %edx
movdqa 16(%ebx), %xmm6
pand %xmm6, %xmm7
movdqa 32(%ebx), %xmm6
paddq %xmm6, %xmm7
psllq $46, %xmm7
subpd %xmm3, %xmm0
movapd 160(%ebx,%ecx), %xmm2
mulpd %xmm0, %xmm4
movapd %xmm0, %xmm6
movapd %xmm0, %xmm1
mulpd %xmm6, %xmm6
mulpd %xmm6, %xmm0
addpd %xmm4, %xmm5
mulsd %xmm6, %xmm0
mulpd 112(%ebx), %xmm6
addsd %xmm2, %xmm1
unpckhpd %xmm2, %xmm2
mulpd %xmm5, %xmm0
addsd %xmm0, %xmm1
orpd %xmm7, %xmm2
unpckhpd %xmm0, %xmm0
addsd %xmm1, %xmm0
addsd %xmm6, %xmm0
addl $894, %edx
cmpl $1916, %edx
ja .L_2TAG_PACKET_1.0.2
mulsd %xmm2, %xmm0
addsd %xmm2, %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_1.0.2:
fstcw 24(%esp)
movzwl 24(%esp), %edx
orl $768, %edx
movw %dx, 28(%esp)
fldcw 28(%esp)
movl %eax, %edx
sarl $1, %eax
subl %eax, %edx
movdqa (%ebx), %xmm6
pandn %xmm2, %xmm6
addl $1023, %eax
movd %eax, %xmm3
psllq $52, %xmm3
orpd %xmm3, %xmm6
addl $1023, %edx
movd %edx, %xmm4
psllq $52, %xmm4
movsd %xmm0, 8(%esp)
fldl 8(%esp)
movsd %xmm6, 16(%esp)
fldl 16(%esp)
fmul %st, %st(1)
faddp %st, %st(1)
movsd %xmm4, 8(%esp)
fldl 8(%esp)
fmulp %st, %st(1)
fstpl 8(%esp)
movsd 8(%esp), %xmm0
fldcw 24(%esp)
pextrw $3, %xmm0, %ecx
andl $32752, %ecx
cmpl $32752, %ecx
jae .L_2TAG_PACKET_3.0.2
cmpl $0, %ecx
je .L_2TAG_PACKET_4.0.2
jmp .L_2TAG_PACKET_2.0.2
cmpl $-2147483648, %ecx
jb .L_2TAG_PACKET_3.0.2
cmpl $-1064950997, %ecx
jb .L_2TAG_PACKET_2.0.2
ja .L_2TAG_PACKET_4.0.2
movl 128(%esp), %edx
cmpl $-17155601, %edx
jb .L_2TAG_PACKET_2.0.2
jmp .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_3.0.2:
movl $14, %edx
jmp .L_2TAG_PACKET_5.0.2
.L_2TAG_PACKET_4.0.2:
movl $15, %edx
.L_2TAG_PACKET_5.0.2:
movsd %xmm0, (%esp)
movsd 128(%esp), %xmm0
fldl (%esp)
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_7.0.2:
cmpl $2146435072, %eax
jae .L_2TAG_PACKET_8.0.2
movl 132(%esp), %eax
cmpl $-2147483648, %eax
jae .L_2TAG_PACKET_9.0.2
movsd 1208(%ebx), %xmm0
mulsd %xmm0, %xmm0
movl $14, %edx
jmp .L_2TAG_PACKET_5.0.2
.L_2TAG_PACKET_9.0.2:
movsd 1216(%ebx), %xmm0
mulsd %xmm0, %xmm0
movl $15, %edx
jmp .L_2TAG_PACKET_5.0.2
.L_2TAG_PACKET_8.0.2:
movl 128(%esp), %edx
cmpl $2146435072, %eax
ja .L_2TAG_PACKET_10.0.2
cmpl $0, %edx
jne .L_2TAG_PACKET_10.0.2
movl 132(%esp), %eax
cmpl $2146435072, %eax
jne .L_2TAG_PACKET_11.0.2
movsd 1192(%ebx), %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_11.0.2:
movsd 1200(%ebx), %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_10.0.2:
movsd 128(%esp), %xmm0
addsd %xmm0, %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_0.0.2:
movl 132(%esp), %eax
andl $2147483647, %eax
cmpl $1083179008, %eax
jae .L_2TAG_PACKET_7.0.2
movsd 128(%esp), %xmm0
addsd 1184(%ebx), %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_2.0.2:
movsd %xmm0, 48(%esp)
fldl 48(%esp)
.L_2TAG_PACKET_6.0.2:
movl 64(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(exp)
# -- End exp
# Start file scope ASM
.weak expl
.equ expl, exp
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 0
.long 4293918720
.long 0
.long 4293918720
.long 4294967232
.long 0
.long 4294967232
.long 0
.long 65472
.long 0
.long 65472
.long 0
.long 0
.long 1127743488
.long 0
.long 1127743488
.long 1697350398
.long 1079448903
.long 1697350398
.long 1079448903
.long 4277796864
.long 1065758274
.long 4277796864
.long 1065758274
.long 3164486458
.long 1025308570
.long 3164486458
.long 1025308570
.long 4294967294
.long 1071644671
.long 4294967294
.long 1071644671
.long 3811088480
.long 1062650204
.long 1432067621
.long 1067799893
.long 3230715663
.long 1065423125
.long 1431604129
.long 1069897045
.long 0
.long 0
.long 0
.long 0
.long 235107661
.long 1018002367
.long 1048019040
.long 11418
.long 896005651
.long 1015861842
.long 3541402996
.long 22960
.long 1642514529
.long 1012987726
.long 410360776
.long 34629
.long 1568897900
.long 1016568486
.long 1828292879
.long 46424
.long 1882168529
.long 1010744893
.long 852742562
.long 58348
.long 509852888
.long 1017336174
.long 3490863952
.long 70401
.long 653277307
.long 1017431380
.long 2930322911
.long 82586
.long 1649557430
.long 1017729363
.long 1014845818
.long 94904
.long 1058231231
.long 1015777676
.long 3949972341
.long 107355
.long 1044000607
.long 1016786167
.long 828946858
.long 119943
.long 1151779725
.long 1015705409
.long 2288159958
.long 132667
.long 3819481236
.long 1016499965
.long 1853186616
.long 145530
.long 2552227826
.long 1015039787
.long 1709341917
.long 158533
.long 1829350193
.long 1015216097
.long 4112506593
.long 171677
.long 1913391795
.long 1015756674
.long 2799960843
.long 184965
.long 1303423926
.long 1015238005
.long 171030293
.long 198398
.long 1574172746
.long 1016061241
.long 2992903935
.long 211976
.long 3424156969
.long 1017196428
.long 926591434
.long 225703
.long 1938513547
.long 1017631273
.long 887463926
.long 239579
.long 2804567149
.long 1015390024
.long 1276261410
.long 253606
.long 631083525
.long 1017690182
.long 569847337
.long 267786
.long 1623370770
.long 1011049453
.long 1617004845
.long 282120
.long 3667985273
.long 1013894369
.long 3049340112
.long 296610
.long 3145379760
.long 1014403278
.long 3577096743
.long 311258
.long 2603100681
.long 1017152460
.long 1990012070
.long 326066
.long 3249202951
.long 1017448880
.long 1453150081
.long 341035
.long 419288974
.long 1016280325
.long 917841882
.long 356167
.long 3793507337
.long 1016095713
.long 3712504873
.long 371463
.long 728023093
.long 1016345318
.long 363667784
.long 386927
.long 2582678538
.long 1017123460
.long 2956612996
.long 402558
.long 7592966
.long 1016721543
.long 2186617380
.long 418360
.long 228611441
.long 1016696141
.long 1719614412
.long 434334
.long 2261665670
.long 1017457593
.long 1013258798
.long 450482
.long 544148907
.long 1017323666
.long 3907805043
.long 466805
.long 2383914918
.long 1017143586
.long 1447192520
.long 483307
.long 1176412038
.long 1017267372
.long 1944781190
.long 499988
.long 2882956373
.long 1013312481
.long 919555682
.long 516851
.long 3154077648
.long 1016528543
.long 2571947538
.long 533897
.long 348651999
.long 1016405780
.long 2604962540
.long 551129
.long 3253791412
.long 1015920431
.long 1110089947
.long 568549
.long 1509121860
.long 1014756995
.long 2568320822
.long 586158
.long 2617649212
.long 1017340090
.long 2966275556
.long 603959
.long 553214634
.long 1016457425
.long 2682146383
.long 621954
.long 730975783
.long 1014083580
.long 2191782032
.long 640145
.long 1486499517
.long 1016818996
.long 2069751140
.long 658534
.long 2595788928
.long 1016407932
.long 2990417244
.long 677123
.long 1853053619
.long 1015310724
.long 1434058175
.long 695915
.long 2462790535
.long 1015814775
.long 2572866477
.long 714911
.long 3693944214
.long 1017259110
.long 3092190714
.long 734114
.long 2979333550
.long 1017188654
.long 4076559942
.long 753526
.long 174054861
.long 1014300631
.long 2420883922
.long 773150
.long 816778419
.long 1014197934
.long 3716502172
.long 792987
.long 3507050924
.long 1015341199
.long 777507147
.long 813041
.long 1821514088
.long 1013410604
.long 3706687593
.long 833312
.long 920623539
.long 1016295433
.long 1242007931
.long 853805
.long 2789017511
.long 1014276997
.long 3707479175
.long 874520
.long 3586233004
.long 1015962192
.long 64696965
.long 895462
.long 474650514
.long 1016642419
.long 863738718
.long 916631
.long 1614448851
.long 1014281732
.long 3884662774
.long 938030
.long 2450082086
.long 1016164135
.long 2728693977
.long 959663
.long 1101668360
.long 1015989180
.long 3999357479
.long 981531
.long 835814894
.long 1015702697
.long 1533953344
.long 1003638
.long 1301400989
.long 1014466875
.long 2174652632
.long 1025985
.long 0
.long 1072693248
.long 0
.long 2146435072
.long 0
.long 0
.long 4294967295
.long 2146435071
.long 0
.long 1048576
.type static_const_table,@object
.size static_const_table,1224
.data
.section .note.GNU-stack, ""
# End

221
libm/x86/e_hypot.S Normal file
View File

@ -0,0 +1,221 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// X87 version:
// Use 80-bit FPU precision fmul, fsqrt to compute square and sqrt.
//
// SSE version:
// Swap x, y if |x|<|y|
// For x=2^k*x, get y=y*2^(-k)
// Get S ~ sqrt(x^2+y^2) (leading 1 + leading 25 mantissa bits)
//
// Get D = ( RN(x^2+y^2) - S^2 ) + ( x^2 - RN(x^2) ) +
// + ( y^2 - ((RN(x^2+y^2)-RN(x^2)) )
//
// Result is 2^k*(S + Se), where Se = S*e
// S*e is approximated as (D/2S)*( 1 - (D/2S)^2*1.0/S )
//
// Return 2^k*(S+Se)
//
// For |y/x|<2^(-64), return x
//
// For cases where maximum biased exponent is either greater than 7fdh or
// below 32, take a special path to check for special cases (0, NaN, Inf),
// possible overflow, and more accurate computation for denormal results
//
// Special cases:
// hypot(x,y), hypot(y,x), and hypot(x,-y) are equivalent
// hypot(x,+-0) is equivalent to fabs(x)
// hypot(x,y) = y if (x==NaN or x==INF) and y==INF
// hypot(x,y) = x if (x==NaN or x==INF) and y!=INF (even if y==NaN!)
// hypot(x,y) = y if (x!=NaN and x!=INF) and (y==NaN or y==INF)
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin hypot
ENTRY(hypot)
# parameter 1: 8 + %ebp
# parameter 2: 16 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $152, %esp
movl %ebx, 96(%esp)
call static_func
movl %eax, %ebx
movapd (%ebx), %xmm3
movsd 160(%esp), %xmm0
movsd 168(%esp), %xmm1
andpd %xmm3, %xmm0
andpd %xmm3, %xmm1
pextrw $3, %xmm0, %eax
pextrw $3, %xmm1, %edx
cmpl $24528, %eax
ja .L_2TAG_PACKET_0.0.2
cmpl $24528, %edx
ja .L_2TAG_PACKET_0.0.2
.L_2TAG_PACKET_1.0.2:
fldl 160(%esp)
fldl 168(%esp)
fxch %st(1)
fmul %st(0), %st
fxch %st(1)
nop
fmul %st(0), %st
faddp %st, %st(1)
fsqrt
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_0.0.2:
cmpl $32752, %eax
movl %eax, %ecx
jae .L_2TAG_PACKET_3.0.2
subl %edx, %ecx
cmpl $32752, %edx
jae .L_2TAG_PACKET_3.0.2
addl $928, %ecx
addl %edx, %eax
cmpl $1856, %ecx
ja .L_2TAG_PACKET_4.0.2
cmpl $49056, %eax
jb .L_2TAG_PACKET_1.0.2
fldl 160(%esp)
fldl 168(%esp)
fxch %st(1)
fmul %st(0), %st
fxch %st(1)
nop
fmul %st(0), %st
faddp %st, %st(1)
fsqrt
.L_2TAG_PACKET_5.0.2:
fstl (%esp)
fstpt 16(%esp)
xorl %eax, %eax
movw 24(%esp), %ax
cmpl $17407, %eax
jae .L_2TAG_PACKET_6.0.2
fldl (%esp)
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_4.0.2:
movsd %xmm0, 32(%esp)
movsd %xmm1, 40(%esp)
fldl 32(%esp)
faddl 40(%esp)
jmp .L_2TAG_PACKET_5.0.2
.L_2TAG_PACKET_6.0.2:
movl $46, %edx
.L_2TAG_PACKET_8.0.2:
movsd 160(%esp), %xmm0
movsd 168(%esp), %xmm1
fldl (%esp)
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_3.0.2:
shufpd $0, %xmm1, %xmm0
movdqa %xmm0, %xmm2
movdqa 16(%ebx), %xmm3
movsd %xmm0, 32(%esp)
movsd %xmm1, 40(%esp)
cmppd $3, %xmm0, %xmm2
cmppd $0, %xmm0, %xmm3
movmskpd %xmm2, %edx
movmskpd %xmm3, %eax
testl %edx, %edx
je .L_2TAG_PACKET_9.0.2
fldl 32(%esp)
fmull 40(%esp)
testl $1, %eax
jne .L_2TAG_PACKET_10.0.2
testl $2, %eax
jne .L_2TAG_PACKET_11.0.2
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_9.0.2:
fldl 32(%esp)
faddl 40(%esp)
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_10.0.2:
fstpl 40(%esp)
fldl 32(%esp)
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_11.0.2:
fstpl 32(%esp)
fldl 40(%esp)
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_2.0.2:
.L_2TAG_PACKET_7.0.2:
movl 96(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(hypot)
# -- End hypot
# Start file scope ASM
.weak hypotl
.equ hypotl, hypot
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 4294967295
.long 2147483647
.long 4294967295
.long 2147483647
.long 0
.long 2146435072
.long 0
.long 2146435072
.type static_const_table,@object
.size static_const_table,32
.data
.section .note.GNU-stack, ""
# End

781
libm/x86/e_log.S Normal file
View File

@ -0,0 +1,781 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// x=2^k * mx, mx in [1,2)
//
// Get B~1/mx based on the output of rcpss instruction (B0)
// B = int((B0*2^7+0.5))/2^7
//
// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
//
// Result: k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6) and
// p(r) is a degree 7 polynomial
// -log(B) read from data table (high, low parts)
// Result is formed from high and low parts
//
// Special cases:
// log(NaN) = quiet NaN, and raise invalid exception
// log(+INF) = that INF
// log(0) = -INF with divide-by-zero exception raised
// log(1) = +0
// log(x) = NaN with invalid exception raised if x < -0, including -INF
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin log
ENTRY(log)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $104, %esp
movl %ebx, 40(%esp)
call static_func
movl %eax, %ebx
xorpd %xmm2, %xmm2
movl $16368, %eax
pinsrw $3, %eax, %xmm2
xorpd %xmm3, %xmm3
movl $30704, %edx
pinsrw $3, %edx, %xmm3
movsd 112(%esp), %xmm0
movapd %xmm0, %xmm1
movl $32768, %ecx
movd %ecx, %xmm4
movsd 2128(%ebx), %xmm5
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
psllq $5, %xmm0
movl $16352, %ecx
psrlq $34, %xmm0
rcpss %xmm0, %xmm0
psllq $12, %xmm1
pshufd $228, %xmm5, %xmm6
psrlq $12, %xmm1
subl $16, %eax
cmpl $32736, %eax
jae .L_2TAG_PACKET_0.0.2
.L_2TAG_PACKET_1.0.2:
paddd %xmm4, %xmm0
orpd %xmm3, %xmm1
movd %xmm0, %edx
psllq $29, %xmm0
andpd %xmm1, %xmm5
andpd %xmm6, %xmm0
subsd %xmm5, %xmm1
mulpd %xmm0, %xmm5
andl $32752, %eax
subl %ecx, %eax
cvtsi2sdl %eax, %xmm7
mulsd %xmm0, %xmm1
movsd 2064(%ebx), %xmm6
movapd 2080(%ebx), %xmm3
subsd %xmm2, %xmm5
andl $16711680, %edx
shrl $12, %edx
movapd (%ebx,%edx), %xmm0
movapd 2096(%ebx), %xmm4
addsd %xmm5, %xmm1
movapd 2112(%ebx), %xmm2
mulsd %xmm7, %xmm6
pshufd $68, %xmm1, %xmm5
mulsd 2072(%ebx), %xmm7
mulsd %xmm1, %xmm3
addsd %xmm6, %xmm0
mulpd %xmm5, %xmm4
mulpd %xmm5, %xmm5
pshufd $228, %xmm0, %xmm6
addsd %xmm1, %xmm0
addpd %xmm2, %xmm4
mulpd %xmm5, %xmm3
subsd %xmm0, %xmm6
mulsd %xmm1, %xmm4
pshufd $238, %xmm0, %xmm2
addsd %xmm6, %xmm1
mulsd %xmm5, %xmm5
addsd %xmm2, %xmm7
addpd %xmm3, %xmm4
addsd %xmm7, %xmm1
mulpd %xmm5, %xmm4
addsd %xmm4, %xmm1
pshufd $238, %xmm4, %xmm5
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_0.0.2:
movsd 112(%esp), %xmm0
movapd %xmm0, %xmm1
addl $16, %eax
cmpl $32768, %eax
jae .L_2TAG_PACKET_3.0.2
cmpl $16, %eax
jb .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_5.0.2:
addsd %xmm0, %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_6.0.2:
ja .L_2TAG_PACKET_5.0.2
cmpl $0, %edx
ja .L_2TAG_PACKET_5.0.2
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_3.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
addl %ecx, %ecx
cmpl $-2097152, %ecx
jae .L_2TAG_PACKET_6.0.2
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_7.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $32752, %eax
pinsrw $3, %eax, %xmm1
movl $3, %edx
mulsd %xmm1, %xmm0
.L_2TAG_PACKET_9.0.2:
movsd %xmm0, (%esp)
movsd 112(%esp), %xmm0
fldl (%esp)
jmp .L_2TAG_PACKET_10.0.2
.L_2TAG_PACKET_8.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
divsd %xmm1, %xmm0
movl $2, %edx
jmp .L_2TAG_PACKET_9.0.2
.L_2TAG_PACKET_4.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_8.0.2
xorpd %xmm1, %xmm1
movl $18416, %eax
pinsrw $3, %eax, %xmm1
mulsd %xmm1, %xmm0
movapd %xmm0, %xmm1
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
psllq $5, %xmm0
movl $18416, %ecx
psrlq $34, %xmm0
rcpss %xmm0, %xmm0
psllq $12, %xmm1
pshufd $228, %xmm5, %xmm6
psrlq $12, %xmm1
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_2.0.2:
movsd %xmm0, 24(%esp)
fldl 24(%esp)
.L_2TAG_PACKET_10.0.2:
movl 40(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(log)
# -- End log
# Start file scope ASM
.weak logl
.equ logl, log
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 4277811200
.long 1072049730
.long 2479318832
.long 1026487127
.long 2854492160
.long 1072033410
.long 215631550
.long 1025638968
.long 1547061248
.long 1072017216
.long 2886781435
.long 1026423395
.long 649825280
.long 1072001146
.long 4281533405
.long 1024038923
.long 646346752
.long 1071985198
.long 1562735921
.long 1023790276
.long 2203734016
.long 1071969370
.long 1838397691
.long 3173936209
.long 1872169984
.long 1071953661
.long 3981202460
.long 1022325013
.long 669557760
.long 1071938069
.long 4182597802
.long 3173174122
.long 4076413952
.long 1071922591
.long 1209029111
.long 3170736207
.long 556125184
.long 1071907228
.long 821086028
.long 3173437049
.long 204914688
.long 1071891976
.long 2097025986
.long 3171071798
.long 387545088
.long 1071876834
.long 3142936996
.long 3173092218
.long 2912783360
.long 1071861800
.long 2502420140
.long 1024505919
.long 1144260608
.long 1071846874
.long 3315658140
.long 3173469843
.long 1471209472
.long 1071832053
.long 129621009
.long 3172443877
.long 1829683200
.long 1071817336
.long 3885467693
.long 1025535275
.long 288676864
.long 1071802722
.long 86139472
.long 3171639793
.long 3636378624
.long 1071788208
.long 1850238587
.long 1024654342
.long 1606817792
.long 1071773795
.long 3388899795
.long 3173675586
.long 1236164608
.long 1071759480
.long 3983599207
.long 1020046558
.long 1089616896
.long 1071745262
.long 4171974224
.long 1024773198
.long 4143093760
.long 1071731139
.long 2727587401
.long 3173965207
.long 600267776
.long 1071717112
.long 3147685042
.long 3173353031
.long 2249313280
.long 1071703177
.long 125835074
.long 1025255832
.long 3805303808
.long 1071689334
.long 2289991207
.long 1025460331
.long 87278592
.long 1071675583
.long 1106114045
.long 1025933602
.long 3195405312
.long 1071661920
.long 3885316576
.long 3171206239
.long 3853649920
.long 1071648346
.long 2977069852
.long 3171236771
.long 2944026624
.long 1071625048
.long 1008093493
.long 1023444474
.long 3993180160
.long 1071598247
.long 1862355595
.long 1024642533
.long 1454641152
.long 1071571617
.long 1514603089
.long 1026500596
.long 3286085632
.long 1071545154
.long 1400028424
.long 3173279056
.long 438773760
.long 1071518858
.long 120727864
.long 3172148914
.long 1212979200
.long 1071492725
.long 1625055594
.long 3172901933
.long 1189017600
.long 1071466754
.long 3920062376
.long 1025727407
.long 403064832
.long 1071440943
.long 1053271728
.long 3171391427
.long 3343210496
.long 1071415289
.long 3243395502
.long 3173627613
.long 1765777408
.long 1071389792
.long 2145968512
.long 1026354304
.long 461430784
.long 1071364449
.long 4094322285
.long 1026021467
.long 71706624
.long 1071339258
.long 763632021
.long 1024496933
.long 1380503552
.long 1071314217
.long 1383547992
.long 3173088453
.long 1015732224
.long 1071289325
.long 3198646877
.long 1025390322
.long 35977216
.long 1071264580
.long 2141026805
.long 1025754693
.long 3927306240
.long 1071239979
.long 282116272
.long 3173394334
.long 1125341184
.long 1071215523
.long 2768427504
.long 3172279059
.long 1666971648
.long 1071191208
.long 786837629
.long 3172427445
.long 2827694080
.long 1071167033
.long 3857122416
.long 3173014241
.long 2003683328
.long 1071142997
.long 859010954
.long 1026545007
.long 1004017664
.long 1071119098
.long 3356644970
.long 3173458064
.long 1753020416
.long 1071095334
.long 788338552
.long 1026157693
.long 1992718336
.long 1071071704
.long 1239179443
.long 1026394889
.long 3870234624
.long 1071048206
.long 2082614663
.long 1024926053
.long 1050437632
.long 1071024840
.long 660007840
.long 1025548499
.long 188395520
.long 1071001603
.long 3878792704
.long 3173889571
.long 3747176448
.long 1070978493
.long 144991708
.long 3171552042
.long 1405669376
.long 1070955511
.long 3999088879
.long 1025486317
.long 121151488
.long 1070932654
.long 2170865497
.long 1026473584
.long 2652319744
.long 1070909920
.long 453695652
.long 3173916809
.long 3262236672
.long 1070887309
.long 157800053
.long 3173984206
.long 601221120
.long 1070864820
.long 3968917661
.long 1023992886
.long 1999843328
.long 1070842450
.long 3053895004
.long 1024998228
.long 1992167424
.long 1070820199
.long 2968614856
.long 1024552653
.long 3788726272
.long 1070798065
.long 3542170808
.long 3173573242
.long 2094829568
.long 1070776048
.long 1246758132
.long 1026202874
.long 288675840
.long 1070754146
.long 3747328950
.long 1026331585
.long 1829681152
.long 1070732357
.long 3125197546
.long 1024100318
.long 1666869248
.long 1070710681
.long 1363656119
.long 1026336493
.long 3417110528
.long 1070689116
.long 4154791553
.long 1026267853
.long 2183653376
.long 1070667662
.long 1671819292
.long 3173785870
.long 1734434816
.long 1070646317
.long 373091049
.long 1025972363
.long 1615681536
.long 1070625080
.long 384650897
.long 1022926043
.long 1445382144
.long 1070603950
.long 344320330
.long 3172397196
.long 1823715328
.long 1070569756
.long 3389841200
.long 1025231852
.long 3839688704
.long 1070527917
.long 1706790417
.long 3167363349
.long 4293332992
.long 1070486286
.long 1614935088
.long 1019351591
.long 2966720512
.long 1070444861
.long 4145393717
.long 3173711658
.long 4066729984
.long 1070403639
.long 1974925028
.long 3171437182
.long 3337621504
.long 1070362619
.long 3314953170
.long 3169971314
.long 943448064
.long 1070321799
.long 1498682038
.long 3173862340
.long 1465634816
.long 1070281176
.long 1319952810
.long 3171693965
.long 1015734272
.long 1070240749
.long 1347821929
.long 3173544515
.long 118001664
.long 1070200516
.long 1751482746
.long 1026134093
.long 3707174912
.long 1070160474
.long 1486946159
.long 1023930920
.long 3946381312
.long 1070120623
.long 2867408081
.long 3171368276
.long 1699848192
.long 1070080961
.long 2590187139
.long 1025379803
.long 2235846656
.long 1070041485
.long 1888568069
.long 3172754960
.long 2339729408
.long 1070002194
.long 3852214753
.long 3173323149
.long 3196850176
.long 1069963086
.long 742141560
.long 1025101707
.long 1800683520
.long 1069924160
.long 3949500444
.long 3172102179
.long 3835801600
.long 1069885413
.long 3848895943
.long 1025913832
.long 2201202688
.long 1069846845
.long 1425913464
.long 1025868665
.long 2778279936
.long 1069808453
.long 2120889677
.long 3173831128
.long 2954203136
.long 1069770236
.long 592147081
.long 1019621288
.long 210141184
.long 1069732193
.long 3414275233
.long 1023647084
.long 709476352
.long 1069694321
.long 2413027164
.long 1024462115
.long 2116284416
.long 1069656619
.long 1144559924
.long 1026336654
.long 2183651328
.long 1069619086
.long 3459057650
.long 1025634168
.long 3047047168
.long 1069581720
.long 1879674924
.long 3173508573
.long 970711040
.long 1069541521
.long 1335954173
.long 3173332182
.long 2198478848
.long 1069467449
.long 2951103968
.long 3173892200
.long 1669611520
.long 1069393703
.long 531044147
.long 1025149248
.long 29114368
.long 1069320280
.long 3327831251
.long 1025918673
.long 2376949760
.long 1069247176
.long 737634533
.long 3172176000
.long 1085390848
.long 1069174390
.long 3108243400
.long 3171828406
.long 1566130176
.long 1069101918
.long 985483226
.long 1025708380
.long 792780800
.long 1069029758
.long 4184866295
.long 1024426204
.long 183156736
.long 1068957907
.long 2845699378
.long 1022107277
.long 1301782528
.long 1068886362
.long 1012735262
.long 3173804294
.long 1562411008
.long 1068815121
.long 2197086703
.long 3170187813
.long 2815549440
.long 1068744181
.long 2782613207
.long 1026345054
.long 2756124672
.long 1068673540
.long 2929486205
.long 3173037800
.long 3511050240
.long 1068603195
.long 1443733147
.long 3173331549
.long 3047047168
.long 1068533144
.long 1879674924
.long 3172459997
.long 3221667840
.long 1068427825
.long 1338588027
.long 3171815742
.long 3453861888
.long 1068288883
.long 1205348359
.long 3172624626
.long 3506110464
.long 1068150514
.long 893105198
.long 1025571866
.long 346013696
.long 1068012714
.long 3495569021
.long 3172563349
.long 4074029056
.long 1067875476
.long 3961106338
.long 3171065595
.long 3559784448
.long 1067738798
.long 1975385384
.long 3173783155
.long 797769728
.long 1067602675
.long 3760305787
.long 1026047642
.long 2313633792
.long 1067467101
.long 1559353171
.long 1023480256
.long 3960766464
.long 1067213778
.long 1067365107
.long 1025865926
.long 684261376
.long 1066944805
.long 844762164
.long 3173687482
.long 630718464
.long 1066676905
.long 2458269694
.long 1024033081
.long 1486061568
.long 1066410070
.long 115537874
.long 3173243995
.long 2743664640
.long 1065886792
.long 3665098304
.long 3173471607
.long 1971912704
.long 1065357333
.long 2577214440
.long 3171993451
.long 1498939392
.long 1064306693
.long 3409036923
.long 1025599151
.long 0
.long 0
.long 0
.long 2147483648
.long 4277811200
.long 1067855426
.long 2479318832
.long 1022292823
.long 2454267026
.long 1069697316
.long 0
.long 3218079744
.long 1030730101
.long 3217380702
.long 1431655765
.long 1070945621
.long 2576980378
.long 1070176665
.long 0
.long 3219128320
.long 0
.long 4294959104
.long 0
.long 4294959104
.type static_const_table,@object
.size static_const_table,2144
.data
.section .note.GNU-stack, ""
# End

796
libm/x86/e_log10.S Normal file
View File

@ -0,0 +1,796 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Let x=2^k * mx, mx in [1,2)
//
// Get B~1/mx based on the output of rcpss instruction (B0)
// B = int((B0*LH*2^7+0.5))/2^7
// LH is a short approximation for log10(e)
//
// Reduced argument: r=B*mx-LH (computed accurately in high and low parts)
//
// Result: k*log10(2) - log(B) + p(r)
// p(r) is a degree 7 polynomial
// -log(B) read from data table (high, low parts)
// Result is formed from high and low parts
//
// Special cases:
// log10(0) = -INF with divide-by-zero exception raised
// log10(1) = +0
// log10(x) = NaN with invalid exception raised if x < -0, including -INF
// log10(+INF) = +INF
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin log10
ENTRY(log10)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $104, %esp
movl %ebx, 40(%esp)
call static_func
movl %eax, %ebx
xorpd %xmm2, %xmm2
movl $16368, %eax
pinsrw $3, %eax, %xmm2
movl $1054736384, %ecx
movd %ecx, %xmm7
xorpd %xmm3, %xmm3
movl $30704, %edx
pinsrw $3, %edx, %xmm3
movsd 112(%esp), %xmm0
movapd %xmm0, %xmm1
movl $32768, %edx
movd %edx, %xmm4
movapd 2128(%ebx), %xmm5
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
movl $16352, %ecx
psllq $5, %xmm0
movsd 2144(%ebx), %xmm2
psrlq $34, %xmm0
rcpss %xmm0, %xmm0
psllq $12, %xmm1
pshufd $78, %xmm5, %xmm6
psrlq $12, %xmm1
subl $16, %eax
cmpl $32736, %eax
jae .L_2TAG_PACKET_0.0.2
.L_2TAG_PACKET_1.0.2:
mulss %xmm7, %xmm0
orpd %xmm3, %xmm1
andpd %xmm1, %xmm5
paddd %xmm4, %xmm0
subsd %xmm5, %xmm1
movd %xmm0, %edx
psllq $29, %xmm0
andpd %xmm6, %xmm0
andl $32752, %eax
subl %ecx, %eax
cvtsi2sdl %eax, %xmm7
mulpd %xmm0, %xmm5
mulsd %xmm0, %xmm1
movsd 2064(%ebx), %xmm6
movapd 2080(%ebx), %xmm3
subsd %xmm2, %xmm5
andl $16711680, %edx
shrl $12, %edx
movapd -1504(%ebx,%edx), %xmm0
movapd 2096(%ebx), %xmm4
addsd %xmm5, %xmm1
movapd 2112(%ebx), %xmm2
mulsd %xmm7, %xmm6
pshufd $68, %xmm1, %xmm5
mulsd 2072(%ebx), %xmm7
mulsd %xmm1, %xmm3
addsd %xmm6, %xmm0
mulpd %xmm5, %xmm4
movsd 2152(%ebx), %xmm6
mulpd %xmm5, %xmm5
addpd %xmm2, %xmm4
mulpd %xmm5, %xmm3
pshufd $228, %xmm0, %xmm2
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm4
subsd %xmm0, %xmm2
mulsd %xmm1, %xmm6
addsd %xmm2, %xmm1
pshufd $238, %xmm0, %xmm2
mulsd %xmm5, %xmm5
addsd %xmm2, %xmm7
addsd %xmm6, %xmm1
addpd %xmm3, %xmm4
addsd %xmm7, %xmm1
mulpd %xmm5, %xmm4
addsd %xmm4, %xmm1
pshufd $238, %xmm4, %xmm5
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_0.0.2:
movsd 112(%esp), %xmm0
movapd %xmm0, %xmm1
addl $16, %eax
cmpl $32768, %eax
jae .L_2TAG_PACKET_3.0.2
cmpl $16, %eax
jb .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_5.0.2:
addsd %xmm0, %xmm0
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_6.0.2:
ja .L_2TAG_PACKET_5.0.2
cmpl $0, %edx
ja .L_2TAG_PACKET_5.0.2
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_3.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
addl %ecx, %ecx
cmpl $-2097152, %ecx
jae .L_2TAG_PACKET_6.0.2
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_7.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $32752, %eax
pinsrw $3, %eax, %xmm1
movl $9, %edx
mulsd %xmm1, %xmm0
.L_2TAG_PACKET_9.0.2:
movsd %xmm0, (%esp)
movsd 112(%esp), %xmm0
fldl (%esp)
jmp .L_2TAG_PACKET_10.0.2
.L_2TAG_PACKET_8.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
divsd %xmm1, %xmm0
movl $8, %edx
jmp .L_2TAG_PACKET_9.0.2
.L_2TAG_PACKET_4.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_8.0.2
xorpd %xmm1, %xmm1
movl $18416, %eax
pinsrw $3, %eax, %xmm1
mulsd %xmm1, %xmm0
xorpd %xmm2, %xmm2
movl $16368, %eax
pinsrw $3, %eax, %xmm2
movapd %xmm0, %xmm1
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
movl $18416, %ecx
psllq $5, %xmm0
movsd 2144(%ebx), %xmm2
psrlq $34, %xmm0
rcpss %xmm0, %xmm0
psllq $12, %xmm1
pshufd $78, %xmm5, %xmm6
psrlq $12, %xmm1
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_2.0.2:
movsd %xmm0, 24(%esp)
fldl 24(%esp)
.L_2TAG_PACKET_10.0.2:
movl 40(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(log10)
# -- End log10
# Start file scope ASM
.weak log10l
.equ log10l, log10
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 1352628224
.long 1070810131
.long 521319256
.long 1025503025
.long 2150839296
.long 1070801944
.long 3329350096
.long 3170190015
.long 1360613376
.long 1070793794
.long 2024059075
.long 1024991594
.long 1875350528
.long 1070785680
.long 2163882141
.long 3163564137
.long 2312126464
.long 1070777602
.long 1975711076
.long 1023674196
.long 1306336256
.long 1070769560
.long 3524899523
.long 3170508164
.long 1806334976
.long 1070761553
.long 4254777025
.long 1025238739
.long 2483193856
.long 1070753581
.long 3800671317
.long 3172916830
.long 2025350144
.long 1070745644
.long 1731514745
.long 1025501083
.long 3433285632
.long 1070737741
.long 2551857336
.long 3169662186
.long 1134317568
.long 1070729873
.long 3426297655
.long 3172637891
.long 2457152512
.long 1070722038
.long 63549415
.long 1025415416
.long 1861803008
.long 1070714237
.long 1910171636
.long 1023977580
.long 2414140416
.long 1070706469
.long 4002514337
.long 3170841618
.long 2900726784
.long 1070698734
.long 3268064083
.long 1022459609
.long 2123517952
.long 1070691032
.long 1767031218
.long 1022448156
.long 3194569728
.long 1070683362
.long 3402332618
.long 3171671160
.long 650882048
.long 1070675725
.long 4146023905
.long 3171023038
.long 1928988672
.long 1070668119
.long 1438617867
.long 1016360491
.long 1594908672
.long 1070660545
.long 971389377
.long 1024763979
.long 2818746368
.long 1070653002
.long 3555925341
.long 3172434821
.long 194584576
.long 1070645491
.long 943919215
.long 3172950063
.long 1215096832
.long 1070638010
.long 2283358588
.long 1022335098
.long 501519360
.long 1070630560
.long 480904295
.long 1024437959
.long 1278266368
.long 1070623140
.long 2755806066
.long 3172342012
.long 2487812096
.long 1070615750
.long 2489653202
.long 3172481099
.long 3085451264
.long 1070608390
.long 3759184951
.long 3172574892
.long 2039090176
.long 1070601060
.long 1361176676
.long 3172355319
.long 953057280
.long 1070591423
.long 1176587546
.long 3166422018
.long 3370524672
.long 1070576879
.long 3669570051
.long 1025376630
.long 749742080
.long 1070562394
.long 707700964
.long 3170814058
.long 4008353792
.long 1070547965
.long 3247327652
.long 1022431400
.long 2612455424
.long 1070533594
.long 2453457344
.long 3172322969
.long 3230920704
.long 1070519279
.long 1296781801
.long 1025115335
.long 3965253632
.long 1070505020
.long 373075289
.long 1017938528
.long 2593157120
.long 1070476669
.long 1068054086
.long 1021616576
.long 925962240
.long 1070448537
.long 850121213
.long 1023928989
.long 1732556800
.long 1070420620
.long 1305206740
.long 3172665570
.long 3815630848
.long 1070392915
.long 192642943
.long 3172699907
.long 2001758208
.long 1070365420
.long 2820786683
.long 1024704867
.long 16746496
.long 1070338131
.long 1399573110
.long 3171372773
.long 1886492672
.long 1070311044
.long 3621428075
.long 3172974358
.long 3338196992
.long 1070284157
.long 3793882035
.long 1025124701
.long 381769728
.long 1070257468
.long 3877933342
.long 3170195490
.long 2186491904
.long 1070230972
.long 1838687089
.long 1017927292
.long 1008330752
.long 1070204668
.long 2228321664
.long 1025352196
.long 2247065600
.long 1070178552
.long 1413900906
.long 3170902532
.long 2964070400
.long 1070152622
.long 3590454629
.long 1025016844
.long 465154048
.long 1070126876
.long 2079688550
.long 3172268183
.long 883615744
.long 1070101310
.long 989244452
.long 3171900485
.long 1993768960
.long 1070075922
.long 1124327841
.long 3172964992
.long 1794471936
.long 1070050710
.long 1140575046
.long 1022673726
.long 2797932544
.long 1070025671
.long 1894836933
.long 3172544059
.long 3433797632
.long 1070000803
.long 3221831166
.long 3171921685
.long 2338371584
.long 1069976104
.long 3732461053
.long 3164513518
.long 2644013056
.long 1069951571
.long 2519460462
.long 3172548740
.long 3383814144
.long 1069927202
.long 2290997657
.long 1025499649
.long 3781380096
.long 1069902995
.long 380479405
.long 1025184136
.long 3245785088
.long 1069878948
.long 1096398261
.long 3169885192
.long 1366712320
.long 1069855059
.long 2218343715
.long 3170281628
.long 2204717056
.long 1069831325
.long 2668334011
.long 1025264524
.long 1401772032
.long 1069807745
.long 4103993159
.long 1022925721
.long 3356721152
.long 1069784316
.long 3573790772
.long 3172186527
.long 4041148416
.long 1069761037
.long 4027691910
.long 3171276990
.long 3880151040
.long 1069737906
.long 4087118786
.long 3172710734
.long 3453364224
.long 1069714921
.long 99014299
.long 3172003077
.long 3491092480
.long 1069692080
.long 3801836701
.long 3172989287
.long 575580160
.long 1069669382
.long 1920406012
.long 3170874125
.long 22282240
.long 1069646824
.long 964193370
.long 1019363159
.long 2991429632
.long 1069624404
.long 3372589890
.long 1023425053
.long 2189645824
.long 1069602122
.long 2610503872
.long 1023652442
.long 3341467648
.long 1069579975
.long 1190292004
.long 1022425665
.long 3711293440
.long 1069557962
.long 1104795356
.long 1023625829
.long 1380401152
.long 1069524644
.long 1156998217
.long 1025100499
.long 765710336
.long 1069481144
.long 1736649113
.long 1024999439
.long 849412096
.long 1069437902
.long 2618178330
.long 3170853629
.long 1433104384
.long 1069394915
.long 43477267
.long 3170378811
.long 2548596736
.long 1069352180
.long 3967367063
.long 1025246584
.long 157577216
.long 1069309695
.long 100402533
.long 3172825502
.long 3326238720
.long 1069267455
.long 1176892909
.long 1025464099
.long 4155494400
.long 1069225459
.long 3713707617
.long 3172630046
.long 3545804800
.long 1069183704
.long 857007315
.long 1024965777
.long 2602520576
.long 1069142187
.long 2588758347
.long 1022463131
.long 2631196672
.long 1069100905
.long 2118424235
.long 1022490989
.long 838135808
.long 1069059856
.long 4117002727
.long 1024874520
.long 3210903552
.long 1069019036
.long 650070125
.long 3172012966
.long 3039211520
.long 1068978444
.long 438055812
.long 1017743757
.long 2385633280
.long 1068938077
.long 3011990369
.long 3171312044
.long 3491618816
.long 1068897932
.long 712813818
.long 3172720400
.long 183644160
.long 1068858008
.long 4287006742
.long 1022379728
.long 3639214080
.long 1068818300
.long 353762279
.long 3172980009
.long 3728416768
.long 1068778808
.long 1851367730
.long 1025486574
.long 3370094592
.long 1068739529
.long 4046594913
.long 3172567047
.long 1348407296
.long 1068700461
.long 143189675
.long 1025397632
.long 899403776
.long 1068661601
.long 3753687842
.long 3170772772
.long 1117708288
.long 1068622947
.long 1857340812
.long 3170782678
.long 1248276480
.long 1068584497
.long 1289858203
.long 1025222289
.long 683237376
.long 1068546249
.long 2356679608
.long 3171629170
.long 3253764096
.long 1068508200
.long 3267136556
.long 1018554987
.long 94478336
.long 1068441756
.long 1927868814
.long 3169378180
.long 3233144832
.long 1068366445
.long 2682188854
.long 1023964004
.long 2940297216
.long 1068291522
.long 275301289
.long 1023944679
.long 3677708288
.long 1068216982
.long 302658771
.long 1024465567
.long 1576968192
.long 1068142822
.long 3672035940
.long 3172254610
.long 1614069760
.long 1068069037
.long 480052905
.long 3172692062
.long 424435712
.long 1067995624
.long 2207869657
.long 3170965436
.long 3477782528
.long 1067922578
.long 2980661858
.long 3164990018
.long 3598401536
.long 1067849897
.long 1974393034
.long 3171357083
.long 2435235840
.long 1067777577
.long 1385289011
.long 1024615823
.long 1867333632
.long 1067705614
.long 3442236633
.long 1025334384
.long 3999301632
.long 1067634004
.long 3506472073
.long 1025132546
.long 2566971392
.long 1067562745
.long 1425757592
.long 3172358463
.long 112943104
.long 1067491833
.long 1693407156
.long 3172426603
.long 3079929856
.long 1067392159
.long 3999942455
.long 1018549369
.long 2443837440
.long 1067251701
.long 974534460
.long 1023963412
.long 359366656
.long 1067111917
.long 2204915018
.long 1013514416
.long 3564519424
.long 1066972799
.long 3977441659
.long 3170879860
.long 2011086848
.long 1066834343
.long 590145514
.long 1025390011
.long 3216982016
.long 1066696541
.long 3629120110
.long 1024330313
.long 2194128896
.long 1066559388
.long 2367098512
.long 3172260338
.long 2916220928
.long 1066422877
.long 2262431886
.long 1021229446
.long 2263941120
.long 1066172214
.long 3118507287
.long 1021484970
.long 3076292608
.long 1065901726
.long 1411737803
.long 3172957147
.long 1186136064
.long 1065632488
.long 3109349337
.long 1025397383
.long 3085303808
.long 1065364487
.long 584715031
.long 3172596519
.long 1821048832
.long 1064842211
.long 2182246895
.long 3172536214
.long 697368576
.long 1064311094
.long 3157561765
.long 3172716357
.long 894042112
.long 1063260131
.long 3237958154
.long 3172587292
.long 0
.long 0
.long 0
.long 0
.long 1352628224
.long 1066615827
.long 521319256
.long 1021308721
.long 3248877870
.long 1077250164
.long 1691676429
.long 3221787401
.long 945132465
.long 3223701783
.long 3700831335
.long 1073506818
.long 2141010593
.long 1075227551
.long 3698831637
.long 3220339442
.long 4160749568
.long 4294967295
.long 0
.long 4294959104
.long 0
.long 1071366144
.long 3207479560
.long 1062894188
.type static_const_table,@object
.size static_const_table,2160
.data
.section .note.GNU-stack, ""
# End

4277
libm/x86/e_pow.S Normal file

File diff suppressed because it is too large Load Diff

1408
libm/x86/e_sinh.S Normal file

File diff suppressed because it is too large Load Diff

3718
libm/x86/libm_reduce_pi04l.S Normal file

File diff suppressed because it is too large Load Diff

668
libm/x86/libm_sincos_huge.S Normal file
View File

@ -0,0 +1,668 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# -- Begin __libm_sincos_huge
.text
.align 16,0x90
.hidden __libm_sincos_huge
.globl __libm_sincos_huge
__libm_sincos_huge:
# parameter 1: 8 + %ebp
# parameter 2: 16 + %ebp
# parameter 3: 20 + %ebp
..B1.1:
pushl %ebp
movl %esp, %ebp
andl $-64, %esp
pushl %esi
pushl %edi
pushl %ebx
subl $52, %esp
movl 16(%ebp), %eax
movl 20(%ebp), %edx
movl %eax, 32(%esp)
movl %edx, 36(%esp)
..B1.2:
fnstcw 30(%esp)
..B1.3:
call ..L2
..L2:
popl %edi
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi
movsd 8(%ebp), %xmm1
movl 12(%ebp), %esi
movl %esi, %eax
andl $2147483647, %eax
andps .L_2il0floatpacket.0@GOTOFF(%edi), %xmm1
shrl $31, %esi
movl %eax, 40(%esp)
cmpl $1104150528, %eax
movsd %xmm1, 8(%ebp)
jae ..B1.11
..B1.4:
movsd _Pi4Inv@GOTOFF(%edi), %xmm0
mulsd %xmm1, %xmm0
movzwl 30(%esp), %edx
movl %edx, %eax
andl $768, %eax
movsd %xmm0, (%esp)
cmpl $768, %eax
je ..B1.42
..B1.5:
orl $-64768, %edx
movw %dx, 28(%esp)
..B1.6:
fldcw 28(%esp)
..B1.7:
movsd 8(%ebp), %xmm1
movl $1, %ebx
..B1.8:
movl %ebx, 12(%esp)
movl 4(%esp), %ebx
movl %ebx, %eax
movl %esi, 8(%esp)
movl %ebx, %esi
shrl $20, %esi
andl $1048575, %eax
movl %esi, %ecx
orl $1048576, %eax
negl %ecx
movl %eax, %edx
addl $19, %ecx
addl $13, %esi
movl %ecx, 24(%esp)
shrl %cl, %edx
movl %esi, %ecx
shll %cl, %eax
movl 24(%esp), %ecx
movl (%esp), %esi
shrl %cl, %esi
orl %esi, %eax
cmpl $1094713344, %ebx
movsd %xmm1, 16(%esp)
fldl 16(%esp)
cmovb %edx, %eax
movl 8(%esp), %esi
lea 1(%eax), %edx
movl %edx, %ebx
andl $-2, %ebx
movl %ebx, 16(%esp)
fildl 16(%esp)
movl 12(%esp), %ebx
cmpl $1094713344, 40(%esp)
jae ..B1.10
..B1.9:
fldl _Pi4x3@GOTOFF(%edi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 8+_Pi4x3@GOTOFF(%edi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 16+_Pi4x3@GOTOFF(%edi)
fmulp %st, %st(1)
faddp %st, %st(1)
jmp ..B1.17
..B1.10:
fldl _Pi4x4@GOTOFF(%edi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 8+_Pi4x4@GOTOFF(%edi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 16+_Pi4x4@GOTOFF(%edi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 24+_Pi4x4@GOTOFF(%edi)
fmulp %st, %st(1)
faddp %st, %st(1)
jmp ..B1.17
..B1.11:
movzwl 30(%esp), %edx
movl %edx, %eax
andl $768, %eax
cmpl $768, %eax
je ..B1.43
..B1.12:
orl $-64768, %edx
movw %dx, 28(%esp)
..B1.13:
fldcw 28(%esp)
..B1.14:
movsd 8(%ebp), %xmm1
movl $1, %ebx
..B1.15:
movsd %xmm1, 16(%esp)
fldl 16(%esp)
addl $-32, %esp
lea 32(%esp), %eax
fstpt (%esp)
movl $0, 12(%esp)
movl %eax, 16(%esp)
call __libm_reduce_pi04l
..B1.46:
addl $32, %esp
..B1.16:
fldl (%esp)
lea 1(%eax), %edx
fldl 8(%esp)
faddp %st, %st(1)
..B1.17:
movl %edx, %ecx
addl $3, %eax
shrl $2, %ecx
andl $1, %ecx
shrl $2, %eax
xorl %ecx, %esi
movl 36(%esp), %ecx
andl $1, %eax
andl $3, %ecx
cmpl $3, %ecx
jne ..B1.25
..B1.18:
fldt 84+_SP@GOTOFF(%edi)
fld %st(1)
fmul %st(2), %st
testb $2, %dl
fmul %st, %st(1)
fldt 72+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fmul %st, %st(1)
fldt 60+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fmul %st, %st(1)
fldt 48+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fmul %st, %st(1)
fldt 36+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fmul %st, %st(1)
fldt 24+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fmul %st, %st(1)
fldt 12+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fmul %st, %st(1)
fldt _SP@GOTOFF(%edi)
faddp %st, %st(2)
fmul %st, %st(1)
fldt 84+_CP@GOTOFF(%edi)
fmul %st(1), %st
fldt 72+_CP@GOTOFF(%edi)
faddp %st, %st(1)
fmul %st(1), %st
fldt 60+_CP@GOTOFF(%edi)
faddp %st, %st(1)
fmul %st(1), %st
fldt 48+_CP@GOTOFF(%edi)
faddp %st, %st(1)
fmul %st(1), %st
fldt 36+_CP@GOTOFF(%edi)
faddp %st, %st(1)
fmul %st(1), %st
fldt 24+_CP@GOTOFF(%edi)
faddp %st, %st(1)
fmul %st(1), %st
fldt 12+_CP@GOTOFF(%edi)
faddp %st, %st(1)
fmul %st(1), %st
fldt _CP@GOTOFF(%edi)
faddp %st, %st(1)
fmulp %st, %st(1)
fldl _ones@GOTOFF(%edi,%esi,8)
fldl _ones@GOTOFF(%edi,%eax,8)
je ..B1.22
..B1.19:
fmulp %st, %st(4)
testl %ebx, %ebx
fxch %st(2)
fmul %st(3), %st
movl 32(%esp), %eax
faddp %st, %st(3)
fxch %st(2)
fstpl (%eax)
fmul %st, %st(1)
faddp %st, %st(1)
fstpl 8(%eax)
je ..B1.21
..B1.20:
fldcw 30(%esp)
..B1.21:
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.22:
fxch %st(1)
fmulp %st, %st(4)
testl %ebx, %ebx
fxch %st(2)
fmul %st(3), %st
movl 32(%esp), %eax
faddp %st, %st(3)
fxch %st(2)
fstpl 8(%eax)
fmul %st, %st(1)
faddp %st, %st(1)
fstpl (%eax)
je ..B1.24
..B1.23:
fldcw 30(%esp)
..B1.24:
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.25:
testb $2, 36(%esp)
je ..B1.33
..B1.26:
fld %st(0)
testb $2, %dl
fmul %st(1), %st
fld %st(0)
fmul %st(1), %st
je ..B1.30
..B1.27:
fstp %st(2)
fldt 84+_CP@GOTOFF(%edi)
testl %ebx, %ebx
fmul %st(2), %st
fldt 72+_CP@GOTOFF(%edi)
fmul %st(3), %st
fldt 60+_CP@GOTOFF(%edi)
movl 32(%esp), %eax
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 48+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 36+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 24+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 12+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmulp %st, %st(3)
fldt _CP@GOTOFF(%edi)
faddp %st, %st(1)
fmulp %st, %st(1)
faddp %st, %st(1)
fldl _ones@GOTOFF(%edi,%esi,8)
fmul %st, %st(1)
faddp %st, %st(1)
fstpl 8(%eax)
je ..B1.29
..B1.28:
fldcw 30(%esp)
..B1.29:
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.30:
fldt 84+_SP@GOTOFF(%edi)
testl %ebx, %ebx
fmul %st(1), %st
fldt 72+_SP@GOTOFF(%edi)
fmul %st(2), %st
fldt 60+_SP@GOTOFF(%edi)
movl 32(%esp), %eax
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 48+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 36+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 24+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 12+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmulp %st, %st(2)
fldt _SP@GOTOFF(%edi)
faddp %st, %st(1)
fmulp %st, %st(2)
faddp %st, %st(1)
fldl _ones@GOTOFF(%edi,%esi,8)
fmulp %st, %st(2)
fmul %st(1), %st
faddp %st, %st(1)
fstpl 8(%eax)
je ..B1.32
..B1.31:
fldcw 30(%esp)
..B1.32:
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.33:
testb $1, 36(%esp)
je ..B1.41
..B1.34:
fld %st(0)
testb $2, %dl
fmul %st(1), %st
fld %st(0)
fmul %st(1), %st
je ..B1.38
..B1.35:
fldt 84+_SP@GOTOFF(%edi)
testl %ebx, %ebx
fmul %st(1), %st
fldt 72+_SP@GOTOFF(%edi)
fmul %st(2), %st
fldt 60+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 48+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 36+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 24+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 12+_SP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmulp %st, %st(2)
fldt _SP@GOTOFF(%edi)
faddp %st, %st(1)
fmulp %st, %st(2)
faddp %st, %st(1)
fldl _ones@GOTOFF(%edi,%eax,8)
fmulp %st, %st(2)
fmul %st(1), %st
movl 32(%esp), %eax
faddp %st, %st(1)
fstpl (%eax)
je ..B1.37
..B1.36:
fldcw 30(%esp)
..B1.37:
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.38:
fstp %st(2)
fldt 84+_CP@GOTOFF(%edi)
testl %ebx, %ebx
fmul %st(2), %st
fldt 72+_CP@GOTOFF(%edi)
fmul %st(3), %st
fldt 60+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 48+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 36+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 24+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(3), %st
fldt 12+_CP@GOTOFF(%edi)
faddp %st, %st(2)
fxch %st(1)
fmulp %st, %st(3)
fldt _CP@GOTOFF(%edi)
faddp %st, %st(1)
fmulp %st, %st(1)
faddp %st, %st(1)
fldl _ones@GOTOFF(%edi,%eax,8)
fmul %st, %st(1)
movl 32(%esp), %eax
faddp %st, %st(1)
fstpl (%eax)
je ..B1.40
..B1.39:
fldcw 30(%esp)
..B1.40:
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.41:
fstp %st(0)
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.42:
xorl %ebx, %ebx
jmp ..B1.8
..B1.43:
xorl %ebx, %ebx
jmp ..B1.15
.align 16,0x90
.type __libm_sincos_huge,@function
.size __libm_sincos_huge,.-__libm_sincos_huge
.data
# -- End __libm_sincos_huge
.section .rodata, "a"
.align 16
.align 16
.L_2il0floatpacket.0:
.long 0xffffffff,0x7fffffff,0x00000000,0x00000000
.type .L_2il0floatpacket.0,@object
.size .L_2il0floatpacket.0,16
.align 16
_Pi4Inv:
.long 1841940611
.long 1072979760
.type _Pi4Inv,@object
.size _Pi4Inv,8
.space 8, 0x00 # pad
.align 16
_Pi4x3:
.long 1413754880
.long 3219726843
.long 993632256
.long 1027030475
.long 3773204808
.long 3129236486
.type _Pi4x3,@object
.size _Pi4x3,24
.space 8, 0x00 # pad
.align 16
_Pi4x4:
.long 1413480448
.long 3219726843
.long 442499072
.long 3183522913
.long 771751936
.long 3146979722
.long 622873025
.long 3110831002
.type _Pi4x4,@object
.size _Pi4x4,32
.align 16
_SP:
.word 43691
.word 43690
.word 43690
.word 43690
.word 49148
.word 0
.word 34951
.word 34952
.word 34952
.word 34952
.word 16376
.word 0
.word 50471
.word 3328
.word 208
.word 53261
.word 49138
.word 0
.word 17910
.word 46614
.word 7466
.word 47343
.word 16364
.word 0
.word 33371
.word 14743
.word 11071
.word 55090
.word 49125
.word 0
.word 48947
.word 35764
.word 12250
.word 45202
.word 16350
.word 0
.word 17574
.word 60698
.word 10735
.word 55102
.word 49110
.word 0
.word 34320
.word 12415
.word 25249
.word 51489
.word 16334
.word 0
.type _SP,@object
.size _SP,96
.align 16
_CP:
.word 0
.word 0
.word 0
.word 32768
.word 49150
.word 0
.word 43685
.word 43690
.word 43690
.word 43690
.word 16378
.word 0
.word 39983
.word 2912
.word 24758
.word 46603
.word 49141
.word 0
.word 61476
.word 3244
.word 208
.word 53261
.word 16367
.word 0
.word 1022
.word 16229
.word 32187
.word 37874
.word 49129
.word 0
.word 55373
.word 44526
.word 50840
.word 36726
.word 16354
.word 0
.word 55994
.word 65145
.word 59958
.word 51657
.word 49114
.word 0
.word 15046
.word 2976
.word 1998
.word 54661
.word 16338
.word 0
.type _CP,@object
.size _CP,96
.align 16
_ones:
.long 0
.long 1072693248
.long 0
.long 3220176896
.type _ones,@object
.size _ones,16
.data
.hidden __libm_reduce_pi04l
.section .note.GNU-stack, ""
# End

750
libm/x86/libm_tancot_huge.S Normal file
View File

@ -0,0 +1,750 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# -- Begin __libm_tancot_huge
.text
.align 16,0x90
.hidden __libm_tancot_huge
.globl __libm_tancot_huge
__libm_tancot_huge:
# parameter 1: 8 + %ebp
# parameter 2: 16 + %ebp
# parameter 3: 20 + %ebp
..B1.1:
pushl %ebp
movl %esp, %ebp
andl $-64, %esp
pushl %esi
pushl %edi
pushl %ebx
subl $52, %esp
movl 16(%ebp), %eax
movl 20(%ebp), %ebx
movl %eax, 40(%esp)
..B1.2:
fnstcw 38(%esp)
..B1.3:
movl 12(%ebp), %edx
movl %edx, %eax
andl $2147483647, %eax
shrl $31, %edx
movl %edx, 44(%esp)
cmpl $1104150528, %eax
call ..L2
..L2:
popl %esi
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi
jae ..B1.11
..B1.4:
movsd 8(%ebp), %xmm1
movzwl 38(%esp), %ecx
movl %ecx, %edx
andl $768, %edx
andps .L_2il0floatpacket.0@GOTOFF(%esi), %xmm1
cmpl $768, %edx
movsd _Pi4Inv@GOTOFF(%esi), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm1, 8(%ebp)
movsd %xmm0, (%esp)
je ..B1.39
..B1.5:
orl $-64768, %ecx
movw %cx, 36(%esp)
..B1.6:
fldcw 36(%esp)
..B1.7:
movsd 8(%ebp), %xmm1
movl $1, %edi
..B1.8:
movl %esi, 12(%esp)
movl 4(%esp), %esi
movl %esi, %edx
movl %edi, 24(%esp)
movl %esi, %edi
shrl $20, %edi
andl $1048575, %edx
movl %edi, %ecx
orl $1048576, %edx
negl %ecx
addl $13, %edi
movl %ebx, 8(%esp)
addl $19, %ecx
movl %edx, %ebx
movl %ecx, 28(%esp)
shrl %cl, %ebx
movl %edi, %ecx
shll %cl, %edx
movl 28(%esp), %ecx
movl (%esp), %edi
shrl %cl, %edi
orl %edi, %edx
cmpl $1094713344, %esi
movsd %xmm1, 16(%esp)
fldl 16(%esp)
cmovb %ebx, %edx
movl 24(%esp), %edi
movl 12(%esp), %esi
lea 1(%edx), %ebx
andl $-2, %ebx
movl %ebx, 16(%esp)
cmpl $1094713344, %eax
fildl 16(%esp)
movl 8(%esp), %ebx
jae ..B1.10
..B1.9:
fldl _Pi4x3@GOTOFF(%esi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 8+_Pi4x3@GOTOFF(%esi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 16+_Pi4x3@GOTOFF(%esi)
fmulp %st, %st(1)
faddp %st, %st(1)
jmp ..B1.17
..B1.10:
fldl _Pi4x4@GOTOFF(%esi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 8+_Pi4x4@GOTOFF(%esi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 16+_Pi4x4@GOTOFF(%esi)
fmul %st(1), %st
faddp %st, %st(2)
fldl 24+_Pi4x4@GOTOFF(%esi)
fmulp %st, %st(1)
faddp %st, %st(1)
jmp ..B1.17
..B1.11:
movzwl 38(%esp), %edx
movl %edx, %eax
andl $768, %eax
cmpl $768, %eax
je ..B1.40
..B1.12:
orl $-64768, %edx
movw %dx, 36(%esp)
..B1.13:
fldcw 36(%esp)
..B1.14:
movl $1, %edi
..B1.15:
movsd 8(%ebp), %xmm0
addl $-32, %esp
andps .L_2il0floatpacket.0@GOTOFF(%esi), %xmm0
lea 32(%esp), %eax
movsd %xmm0, 16(%eax)
fldl 16(%eax)
fstpt (%esp)
movl $0, 12(%esp)
movl %eax, 16(%esp)
call __libm_reduce_pi04l
..B1.43:
movl %eax, %edx
addl $32, %esp
..B1.16:
fldl (%esp)
fldl 8(%esp)
faddp %st, %st(1)
..B1.17:
movl %ebx, %eax
andl $3, %eax
cmpl $3, %eax
jne ..B1.24
..B1.18:
fldl _ones@GOTOFF(%esi)
incl %edx
fdiv %st(1), %st
testb $2, %dl
fstpt 24(%esp)
fld %st(0)
fmul %st(1), %st
fld %st(0)
fmul %st(1), %st
fldt 36+_TP@GOTOFF(%esi)
fmul %st(2), %st
fldt 24+_TP@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(2), %st
fldt 12+_TP@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(2), %st
fldt 36+_TQ@GOTOFF(%esi)
fmul %st(3), %st
fldt 24+_TQ@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(3), %st
fldt 12+_TQ@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(3), %st
fldt _TQ@GOTOFF(%esi)
faddp %st, %st(1)
fldt _TP@GOTOFF(%esi)
faddp %st, %st(2)
fldt 132+_GP@GOTOFF(%esi)
fmul %st(3), %st
fldt 120+_GP@GOTOFF(%esi)
fmul %st(4), %st
fldt 108+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(4), %st
fldt 96+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(4), %st
fldt 84+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(4), %st
fldt 72+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(4), %st
fldt 60+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(4), %st
fldt 48+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(4), %st
fldt 36+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(4), %st
fldt 24+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmulp %st, %st(4)
fldt 12+_GP@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(4), %st
fmul %st(5), %st
fldt _GP@GOTOFF(%esi)
faddp %st, %st(4)
fxch %st(3)
fmul %st(5), %st
faddp %st, %st(3)
je ..B1.20
..B1.19:
fldt 24(%esp)
fxch %st(1)
fdivrp %st, %st(2)
fxch %st(1)
fmulp %st, %st(3)
movl 44(%esp), %eax
xorl $1, %eax
fxch %st(2)
fmul %st(3), %st
fldl _ones@GOTOFF(%esi,%eax,8)
fmul %st, %st(2)
fmul %st, %st(3)
fxch %st(3)
faddp %st, %st(2)
fxch %st(1)
fstpl 16(%esp)
fmul %st(1), %st
fxch %st(1)
fmulp %st, %st(2)
movsd 16(%esp), %xmm0
faddp %st, %st(1)
fstpl 16(%esp)
movsd 16(%esp), %xmm1
jmp ..B1.21
..B1.20:
fdivrp %st, %st(1)
fmulp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
movl 44(%esp), %eax
fldl _ones@GOTOFF(%esi,%eax,8)
fmul %st, %st(1)
fmul %st, %st(3)
fxch %st(3)
faddp %st, %st(1)
fstpl 16(%esp)
fmul %st(1), %st
fldt 24(%esp)
fmulp %st, %st(2)
movsd 16(%esp), %xmm0
faddp %st, %st(1)
fstpl 16(%esp)
movsd 16(%esp), %xmm1
..B1.21:
testl %edi, %edi
je ..B1.23
..B1.22:
fldcw 38(%esp)
..B1.23:
movl 40(%esp), %eax
movsd %xmm0, (%eax)
movsd %xmm1, 8(%eax)
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.24:
testb $2, %bl
je ..B1.31
..B1.25:
incl %edx
fld %st(0)
fmul %st(1), %st
testb $2, %dl
je ..B1.27
..B1.26:
fldl _ones@GOTOFF(%esi)
fdiv %st(2), %st
fld %st(1)
fmul %st(2), %st
fldt 132+_GP@GOTOFF(%esi)
fmul %st(1), %st
fldt 120+_GP@GOTOFF(%esi)
fmul %st(2), %st
fldt 108+_GP@GOTOFF(%esi)
movl 44(%esp), %eax
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
xorl $1, %eax
fldt 96+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 84+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 72+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 60+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 48+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 36+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 24+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmulp %st, %st(2)
fldt 12+_GP@GOTOFF(%esi)
faddp %st, %st(1)
fmulp %st, %st(3)
fldt _GP@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(3), %st
fxch %st(2)
fmulp %st, %st(3)
fxch %st(1)
faddp %st, %st(2)
fldl _ones@GOTOFF(%esi,%eax,8)
fmul %st, %st(2)
fmulp %st, %st(1)
faddp %st, %st(1)
fstpl 16(%esp)
movsd 16(%esp), %xmm0
jmp ..B1.28
..B1.27:
fldt 36+_TP@GOTOFF(%esi)
fmul %st(1), %st
fldt 24+_TP@GOTOFF(%esi)
movl 44(%esp), %eax
faddp %st, %st(1)
fmul %st(1), %st
fldt 36+_TQ@GOTOFF(%esi)
fmul %st(2), %st
fldt 24+_TQ@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(2), %st
fldt 12+_TQ@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(2), %st
fldt _TQ@GOTOFF(%esi)
faddp %st, %st(1)
fldt 12+_TP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt _TP@GOTOFF(%esi)
faddp %st, %st(1)
fdivp %st, %st(1)
fmulp %st, %st(1)
fmul %st(1), %st
fldl _ones@GOTOFF(%esi,%eax,8)
fmul %st, %st(1)
fmulp %st, %st(2)
faddp %st, %st(1)
fstpl 16(%esp)
movsd 16(%esp), %xmm0
..B1.28:
testl %edi, %edi
je ..B1.30
..B1.29:
fldcw 38(%esp)
..B1.30:
movl 40(%esp), %eax
movsd %xmm0, (%eax)
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.31:
testb $1, %bl
je ..B1.38
..B1.32:
incl %edx
fld %st(0)
fmul %st(1), %st
testb $2, %dl
je ..B1.34
..B1.33:
fldt 36+_TP@GOTOFF(%esi)
fmul %st(1), %st
fldt 24+_TP@GOTOFF(%esi)
movl 44(%esp), %eax
faddp %st, %st(1)
fmul %st(1), %st
xorl $1, %eax
fldt 36+_TQ@GOTOFF(%esi)
fmul %st(2), %st
fldt 24+_TQ@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(2), %st
fldt 12+_TQ@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(2), %st
fldt _TQ@GOTOFF(%esi)
faddp %st, %st(1)
fldt 12+_TP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt _TP@GOTOFF(%esi)
faddp %st, %st(1)
fdivp %st, %st(1)
fmulp %st, %st(1)
fmul %st(1), %st
fldl _ones@GOTOFF(%esi,%eax,8)
fmul %st, %st(1)
fmulp %st, %st(2)
faddp %st, %st(1)
fstpl 16(%esp)
movsd 16(%esp), %xmm0
jmp ..B1.35
..B1.34:
fldl _ones@GOTOFF(%esi)
fdiv %st(2), %st
fld %st(1)
fmul %st(2), %st
fldt 132+_GP@GOTOFF(%esi)
fmul %st(1), %st
fldt 120+_GP@GOTOFF(%esi)
fmul %st(2), %st
fldt 108+_GP@GOTOFF(%esi)
movl 44(%esp), %eax
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 96+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 84+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 72+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 60+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 48+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 36+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmul %st(2), %st
fldt 24+_GP@GOTOFF(%esi)
faddp %st, %st(2)
fxch %st(1)
fmulp %st, %st(2)
fldt 12+_GP@GOTOFF(%esi)
faddp %st, %st(1)
fmulp %st, %st(3)
fldt _GP@GOTOFF(%esi)
faddp %st, %st(1)
fmul %st(3), %st
fxch %st(2)
fmulp %st, %st(3)
fxch %st(1)
faddp %st, %st(2)
fldl _ones@GOTOFF(%esi,%eax,8)
fmul %st, %st(2)
fmulp %st, %st(1)
faddp %st, %st(1)
fstpl 16(%esp)
movsd 16(%esp), %xmm0
..B1.35:
testl %edi, %edi
je ..B1.37
..B1.36:
fldcw 38(%esp)
..B1.37:
movl 40(%esp), %eax
movsd %xmm0, 8(%eax)
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.38:
fstp %st(0)
addl $52, %esp
popl %ebx
popl %edi
popl %esi
movl %ebp, %esp
popl %ebp
ret
..B1.39:
xorl %edi, %edi
jmp ..B1.8
..B1.40:
xorl %edi, %edi
jmp ..B1.15
.align 16,0x90
.type __libm_tancot_huge,@function
.size __libm_tancot_huge,.-__libm_tancot_huge
.data
# -- End __libm_tancot_huge
.section .rodata, "a"
.align 16
.align 16
.L_2il0floatpacket.0:
.long 0xffffffff,0x7fffffff,0x00000000,0x00000000
.type .L_2il0floatpacket.0,@object
.size .L_2il0floatpacket.0,16
.align 16
_Pi4Inv:
.long 1841940611
.long 1072979760
.type _Pi4Inv,@object
.size _Pi4Inv,8
.space 8, 0x00 # pad
.align 16
_Pi4x3:
.long 1413754880
.long 3219726843
.long 993632256
.long 1027030475
.long 3773204808
.long 3129236486
.type _Pi4x3,@object
.size _Pi4x3,24
.space 8, 0x00 # pad
.align 16
_Pi4x4:
.long 1413480448
.long 3219726843
.long 442499072
.long 3183522913
.long 771751936
.long 3146979722
.long 622873025
.long 3110831002
.type _Pi4x4,@object
.size _Pi4x4,32
.align 16
_ones:
.long 0
.long 1072693248
.long 0
.long 3220176896
.type _ones,@object
.size _ones,16
.align 16
_TP:
.word 19670
.word 44908
.word 50960
.word 50786
.word 49149
.word 0
.word 19206
.word 45228
.word 54194
.word 52268
.word 16377
.word 0
.word 227
.word 51280
.word 43560
.word 38195
.word 49139
.word 0
.word 12272
.word 18029
.word 6715
.word 45670
.word 16357
.word 0
.type _TP,@object
.size _TP,48
.align 16
_TQ:
.word 14748
.word 33681
.word 5452
.word 38090
.word 49151
.word 0
.word 46755
.word 50026
.word 17634
.word 35372
.word 16382
.word 0
.word 46863
.word 53352
.word 42702
.word 59869
.word 49145
.word 0
.word 33295
.word 20942
.word 32118
.word 39935
.word 16371
.word 0
.type _TQ,@object
.size _TQ,48
.align 16
_GP:
.word 43691
.word 43690
.word 43690
.word 43690
.word 49149
.word 0
.word 46639
.word 2912
.word 24758
.word 46603
.word 49145
.word 0
.word 57255
.word 2218
.word 21984
.word 35507
.word 49142
.word 0
.word 34208
.word 43033
.word 48281
.word 56811
.word 49138
.word 0
.word 28773
.word 27191
.word 31071
.word 45908
.word 49135
.word 0
.word 43257
.word 33777
.word 11976
.word 37184
.word 49132
.word 0
.word 62410
.word 35990
.word 36363
.word 60269
.word 49128
.word 0
.word 13659
.word 55568
.word 26569
.word 48851
.word 49125
.word 0
.word 10347
.word 46238
.word 47188
.word 39576
.word 49122
.word 0
.word 2161
.word 6703
.word 25719
.word 64708
.word 49118
.word 0
.word 42329
.word 7593
.word 44754
.word 47734
.word 49115
.word 0
.word 163
.word 32746
.word 39875
.word 61957
.word 49112
.word 0
.type _GP,@object
.size _GP,144
.data
.hidden __libm_reduce_pi04l
.section .note.GNU-stack, ""
# End

935
libm/x86/s_atan.S Normal file
View File

@ -0,0 +1,935 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// This implementation uses the main path for |x| in [2^{-5},2^65).
// For |x| in [2^{-64},2^{-5}), a secondary path is used.
// For the biased exponent of X within 3FFH-64 and 3FF+64, we use one branch.
// We use the following definition of B and X` so that the formula
// atan(X) = Tau + atan( (X`-B) / (One + BX) ) is correct
//
// X = (-1)^s * 2^k * 1. x1 x2 ... x52
//
// Define X` = 0 if k >= 5; and X` = |X| otherwise
// Define One = 0 if k >= 5; and One = 1 otherwise
// Define B = 0 if k <= -6; B = 2^k * 1.x1 x2 x3 x4 1 if -5 <= k <= 4
// Define B = 2^5 * 1.0 0 ... 0 if k >= 5
//
// Tau is 0 if k <= -6;
// Tau is atan( B ) if -5 <= k <= 4
// Tau is pi/2 if k >= 5
//
// Special cases:
// atan(NaN) = quiet NaN
// atan(+/-INF) = +/-Pi/2
// atan(+/-0) = +/-0
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin atan
ENTRY(atan)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $104, %esp
movl %ebx, 48(%esp)
call static_func
movl %eax, %ebx
movsd 112(%esp), %xmm0
movsd 2640(%ebx), %xmm3
movsd 2624(%ebx), %xmm5
movsd 2656(%ebx), %xmm4
movsd %xmm0, 8(%esp)
pextrw $3, %xmm0, %edx
andpd %xmm0, %xmm3
pshufd $68, %xmm0, %xmm1
orpd %xmm4, %xmm3
movl %edx, %eax
andl $32767, %edx
subl $16288, %edx
cmpl $159, %edx
ja .L_2TAG_PACKET_0.0.2
mulsd %xmm3, %xmm1
subsd %xmm3, %xmm0
addsd %xmm5, %xmm1
divsd %xmm1, %xmm0
addl $1, %edx
movsd 2672(%ebx), %xmm2
movsd 2688(%ebx), %xmm4
andl $32768, %eax
xorpd %xmm7, %xmm7
pinsrw $3, %eax, %xmm7
addl %edx, %edx
movsd (%ebx,%edx,8), %xmm6
movsd 8(%ebx,%edx,8), %xmm5
xorpd %xmm7, %xmm5
xorpd %xmm7, %xmm6
movsd 2680(%ebx), %xmm7
pshufd $68, %xmm0, %xmm1
mulsd %xmm0, %xmm0
pshufd $68, %xmm1, %xmm3
addsd %xmm6, %xmm1
mulsd %xmm0, %xmm2
addsd %xmm0, %xmm4
subsd %xmm1, %xmm6
mulsd %xmm0, %xmm4
addsd %xmm7, %xmm2
mulsd %xmm3, %xmm0
addsd %xmm3, %xmm6
mulsd %xmm2, %xmm0
addsd 2696(%ebx), %xmm4
addsd %xmm5, %xmm6
mulsd %xmm4, %xmm0
addsd %xmm6, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_0.0.2:
addl $944, %edx
cmpl $1103, %edx
ja .L_2TAG_PACKET_2.0.2
movsd 2672(%ebx), %xmm4
movsd 2688(%ebx), %xmm7
movsd 8(%esp), %xmm0
mulsd %xmm1, %xmm1
movsd 2680(%ebx), %xmm2
movsd 2696(%ebx), %xmm5
mulsd %xmm1, %xmm4
addsd %xmm1, %xmm7
movapd %xmm1, %xmm6
mulsd %xmm0, %xmm1
addsd %xmm4, %xmm2
mulsd %xmm6, %xmm7
mulsd %xmm1, %xmm2
addsd %xmm5, %xmm7
mulsd %xmm7, %xmm2
addsd %xmm2, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_2.0.2:
addl $15344, %edx
cmpl $16368, %edx
ja .L_2TAG_PACKET_3.0.2
movsd 8(%esp), %xmm0
movsd 8(%esp), %xmm1
cmpl $16, %edx
jae .L_2TAG_PACKET_4.0.2
mulsd %xmm0, %xmm1
.L_2TAG_PACKET_4.0.2:
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_3.0.2:
cmpl $17392, %edx
jae .L_2TAG_PACKET_5.0.2
xorpd %xmm1, %xmm1
movl $49136, %ecx
pinsrw $3, %ecx, %xmm1
divsd %xmm0, %xmm1
movsd 2672(%ebx), %xmm2
movsd 2688(%ebx), %xmm4
andl $32768, %eax
xorpd %xmm7, %xmm7
pinsrw $3, %eax, %xmm7
addl %edx, %edx
movsd 2592(%ebx), %xmm6
movsd 2600(%ebx), %xmm5
xorpd %xmm7, %xmm5
xorpd %xmm7, %xmm6
movsd 2680(%ebx), %xmm7
pshufd $68, %xmm1, %xmm0
mulsd %xmm1, %xmm1
pshufd $68, %xmm0, %xmm3
addsd %xmm6, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm1, %xmm4
subsd %xmm0, %xmm6
mulsd %xmm1, %xmm4
addsd %xmm7, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm3, %xmm6
mulsd %xmm2, %xmm1
addsd 2696(%ebx), %xmm4
addsd %xmm5, %xmm6
mulsd %xmm4, %xmm1
addsd %xmm6, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_5.0.2:
movsd 8(%esp), %xmm4
movsd 2608(%ebx), %xmm0
movsd 2592(%ebx), %xmm2
movsd 2600(%ebx), %xmm3
movd %xmm1, %eax
psrlq $32, %xmm1
movd %xmm1, %edx
andl $2147483647, %edx
cmpl $2146435072, %edx
jae .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_7.0.2:
andnpd %xmm4, %xmm0
orpd %xmm0, %xmm2
orpd %xmm3, %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_6.0.2:
subl $2146435072, %edx
orl %edx, %eax
cmpl $0, %eax
je .L_2TAG_PACKET_7.0.2
movapd %xmm4, %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
.L_2TAG_PACKET_1.0.2:
movl 48(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(atan)
# -- End atan
# Start file scope ASM
.weak atanl
.equ atanl, atan
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 0
.long 0
.long 0
.long 0
.long 3819695742
.long 1067482761
.long 2398680355
.long 3155462074
.long 2998791009
.long 1067548225
.long 3868465248
.long 3157182472
.long 3339424991
.long 1067613680
.long 3296670360
.long 1010752543
.long 2710002256
.long 1067679126
.long 3403896007
.long 1010910768
.long 3275701428
.long 1067744562
.long 119959933
.long 1011482843
.long 2908636881
.long 1067809988
.long 2464489612
.long 1011545526
.long 3777889398
.long 1067875403
.long 3262682165
.long 1009703919
.long 3759667419
.long 1067940807
.long 1838130851
.long 3157373556
.long 732369940
.long 1068006200
.long 1203428313
.long 1010055371
.long 1166616461
.long 1068071580
.long 2901274051
.long 3158549977
.long 2945472892
.long 1068136947
.long 3726120658
.long 1009762715
.long 3954480976
.long 1068202301
.long 1289173457
.long 1009429861
.long 2081752829
.long 1068267642
.long 1836909874
.long 1006212095
.long 3807999788
.long 1068332968
.long 2172459940
.long 3156162078
.long 2731789884
.long 1068398280
.long 3450718392
.long 3159216547
.long 1044477961
.long 1068463577
.long 2230553229
.long 1011424339
.long 1486930287
.long 1068530218
.long 2861547474
.long 1012041376
.long 2293016881
.long 1068595466
.long 136843272
.long 1012684797
.long 201518157
.long 1068660680
.long 63231984
.long 1012427198
.long 4054234584
.long 1068725856
.long 3927006960
.long 1011878955
.long 1246477213
.long 1068790995
.long 1494265652
.long 3155219350
.long 678186699
.long 1068856093
.long 1264361424
.long 3159256693
.long 2690594995
.long 1068921148
.long 3906996379
.long 1009288267
.long 3362611517
.long 1068986159
.long 1650970041
.long 3158331771
.long 3102162111
.long 1069051124
.long 365917035
.long 3160264153
.long 2352611067
.long 1069116041
.long 4008970190
.long 3159478182
.long 1594134794
.long 1069180908
.long 466690178
.long 1012526501
.long 1345079306
.long 1069245723
.long 2268273568
.long 3160164092
.long 2163300970
.long 1069310484
.long 2750834800
.long 3158113482
.long 352522716
.long 1069375190
.long 1750411372
.long 1011790845
.long 848541647
.long 1069439838
.long 2164207573
.long 1011698350
.long 40647312
.long 1069504427
.long 2949165434
.long 3159107267
.long 2216766270
.long 1069574357
.long 2197920765
.long 3161055954
.long 1090914384
.long 1069638757
.long 2330454674
.long 1013365998
.long 387601244
.long 1069703022
.long 3185681168
.long 1013434071
.long 3991640484
.long 1069767144
.long 1313211590
.long 3161087959
.long 3322489502
.long 1069831118
.long 3013977995
.long 1013053011
.long 3121698570
.long 1069894936
.long 4069015667
.long 1013023362
.long 4289964660
.long 1069958591
.long 1736191156
.long 3158266731
.long 3903312386
.long 1070022077
.long 1833592413
.long 3159731471
.long 3818449864
.long 1070085387
.long 851036429
.long 3159730451
.long 2097480306
.long 1070148515
.long 3506390884
.long 3160462302
.long 1611694502
.long 1070211454
.long 2785735540
.long 3160465144
.long 1464694796
.long 1070274198
.long 4229277299
.long 3159907000
.long 1299612775
.long 1070336741
.long 4116653788
.long 3160427739
.long 1310544789
.long 1070399077
.long 1064430331
.long 1013218202
.long 2253168030
.long 1070461200
.long 1405044609
.long 3157623179
.long 1159567373
.long 1070523105
.long 2353445521
.long 3159992176
.long 1359373750
.long 1070605818
.long 1748171336
.long 3161879263
.long 908341706
.long 1070667034
.long 3372710815
.long 3161775245
.long 1743027350
.long 1070727765
.long 687089934
.long 3160507171
.long 2055355646
.long 1070787992
.long 2392855242
.long 1013682469
.long 690426164
.long 1070847697
.long 1103926666
.long 1014052810
.long 1483247847
.long 1070906862
.long 2082645847
.long 3161345479
.long 392040270
.long 1070965472
.long 2407720023
.long 1014053754
.long 2673846014
.long 1071023511
.long 1293605532
.long 3158464385
.long 1384215810
.long 1071080967
.long 2446095872
.long 3159216407
.long 3101660631
.long 1071137826
.long 698040758
.long 1014855328
.long 2094057058
.long 1071194078
.long 2282048339
.long 1014040385
.long 1712750594
.long 1071249712
.long 1204372378
.long 3162276464
.long 1411515787
.long 1071304719
.long 949080808
.long 1015006403
.long 931538085
.long 1071359091
.long 3027127039
.long 1014307233
.long 179139065
.long 1071412821
.long 4285547492
.long 3161934731
.long 3387721259
.long 1071465902
.long 373225773
.long 1013486625
.long 2132236852
.long 1071544299
.long 3250533429
.long 1014031677
.long 1942070284
.long 1071645596
.long 1237964179
.long 3163239113
.long 1532707802
.long 1071695380
.long 330645583
.long 1012495610
.long 2294184979
.long 1071743834
.long 3959472897
.long 1015833116
.long 3805060714
.long 1071790961
.long 2671256142
.long 1013727772
.long 2215037898
.long 1071836770
.long 2683359117
.long 1015831902
.long 483661594
.long 1071881273
.long 836288326
.long 3162648643
.long 1534679894
.long 1071924486
.long 373258696
.long 3162470096
.long 1538714628
.long 1071966430
.long 3199433068
.long 1015325501
.long 527642555
.long 1072007128
.long 3636832592
.long 3161843145
.long 291339150
.long 1072046605
.long 890169537
.long 3160586117
.long 2450210201
.long 1072084888
.long 1636353294
.long 3163193400
.long 2411367951
.long 1072122007
.long 374899873
.long 1011331750
.long 681549971
.long 1072157992
.long 506411689
.long 1015373954
.long 1466745541
.long 1072192873
.long 2143860931
.long 1013364334
.long 2845622366
.long 1072226682
.long 2869178209
.long 3162423682
.long 2838871438
.long 1072275456
.long 3742223599
.long 1014338577
.long 4200275274
.long 1072337034
.long 1566539915
.long 3161839550
.long 3034733530
.long 1072394897
.long 652621408
.long 3162261964
.long 3207412993
.long 1072449290
.long 3206124665
.long 1014408733
.long 624461478
.long 1072500450
.long 932437485
.long 1015204343
.long 767665908
.long 1072548600
.long 1037911952
.long 3163527627
.long 1110773639
.long 1072593952
.long 2371517912
.long 3160465741
.long 1940828530
.long 1072636704
.long 2731408428
.long 3162895795
.long 1911329388
.long 1072677041
.long 1773089615
.long 3159569267
.long 1764715788
.long 1072704191
.long 691346949
.long 3164069946
.long 3332979233
.long 1072722195
.long 3550733983
.long 1014770628
.long 1321870254
.long 1072739231
.long 1415315820
.long 1016224052
.long 3657429030
.long 1072755365
.long 3910539033
.long 1015966402
.long 4197624557
.long 1072770661
.long 2333399254
.long 3164546480
.long 1512059493
.long 1072785177
.long 2701510318
.long 1016178092
.long 453379037
.long 1072798965
.long 4046344253
.long 3162814364
.long 1942345162
.long 1072818388
.long 621134147
.long 1016335195
.long 4210176273
.long 1072842164
.long 2701013387
.long 3164326619
.long 4185644010
.long 1072863795
.long 4163699341
.long 1016203112
.long 679688788
.long 1072883543
.long 4147276762
.long 1014066750
.long 29432865
.long 1072901630
.long 970415797
.long 1016902063
.long 4070721092
.long 1072918247
.long 2539004411
.long 3163736096
.long 2252468843
.long 1072933561
.long 3424082887
.long 3163407177
.long 2929724825
.long 1072947712
.long 3661482235
.long 3163846989
.long 1377513368
.long 1072960824
.long 3987926680
.long 1013647908
.long 1031632908
.long 1072973003
.long 3672217151
.long 1016614619
.long 2516508130
.long 1072984342
.long 545855020
.long 3162728930
.long 3792452178
.long 1072994923
.long 3420119467
.long 1016471430
.long 3147791459
.long 1073004818
.long 1342204979
.long 1013937254
.long 999189752
.long 1073014090
.long 1006335472
.long 3162850919
.long 711011011
.long 1073022794
.long 4633488
.long 3162966895
.long 15640363
.long 1073030980
.long 1686389560
.long 3164376226
.long 1218463589
.long 1073042382
.long 1526837110
.long 3163533985
.long 2538470555
.long 1073056144
.long 2273304406
.long 3163784996
.long 1229720947
.long 1073068489
.long 2971628206
.long 3162356540
.long 3115427016
.long 1073079621
.long 4215132957
.long 3164282762
.long 4030612557
.long 1073089709
.long 1913251691
.long 3163671292
.long 2728521257
.long 1073098892
.long 2861089500
.long 1015454459
.long 1118696283
.long 1073107285
.long 1628948053
.long 1016179658
.long 2682711255
.long 1073114984
.long 2906306266
.long 1014142643
.long 2073898081
.long 1073122072
.long 1322740454
.long 3164497217
.long 1403700297
.long 1073128618
.long 416137895
.long 3162781466
.long 2502685617
.long 1073134681
.long 3242008732
.long 1014593495
.long 1531926851
.long 1073140313
.long 1362708094
.long 1016517604
.long 3572814411
.long 1073145557
.long 3709790527
.long 1012646874
.long 1695536111
.long 1073150453
.long 3980346340
.long 1016705136
.long 2363057203
.long 1073155033
.long 2551194792
.long 1012569695
.long 2873365682
.long 1073159327
.long 3181154748
.long 1017041450
.long 1053384691
.long 1073165288
.long 3074536879
.long 1016965660
.long 3270542712
.long 1073172451
.long 2535319415
.long 3163051778
.long 1353631484
.long 1073178850
.long 1173833755
.long 1015534537
.long 3511218460
.long 1073184599
.long 1243608109
.long 3161592122
.long 4121259284
.long 1073189793
.long 398584912
.long 3163829923
.long 1193862106
.long 1073194509
.long 1873745539
.long 3163802819
.long 3861949790
.long 1073198808
.long 3841261147
.long 1015587248
.long 1486904578
.long 1073202745
.long 1634726776
.long 3163847886
.long 2879153715
.long 1073206362
.long 200456242
.long 3164138657
.long 385353253
.long 1073209698
.long 1186355517
.long 1014887155
.long 1125865839
.long 1073212783
.long 203561262
.long 3161244927
.long 1221361475
.long 1073215645
.long 3382476563
.long 1014936138
.long 2077323573
.long 1073218307
.long 1005121005
.long 3164430752
.long 215611373
.long 1073220790
.long 353198764
.long 3164485137
.long 2347419265
.long 1073223110
.long 1103143360
.long 1016542137
.long 1379112765
.long 1073225284
.long 381583533
.long 3162870833
.long 3891198463
.long 1073228298
.long 1771275754
.long 1014654681
.long 3395914051
.long 1073231917
.long 2350900914
.long 3164013978
.long 2799919478
.long 1073235146
.long 2893950164
.long 3163260901
.long 1138673476
.long 1073238045
.long 2622204785
.long 3164174388
.long 3408855940
.long 1073240661
.long 2800881650
.long 1016008624
.long 2044858738
.long 1073243035
.long 604544785
.long 1017022901
.long 2578795176
.long 1073245198
.long 2557332925
.long 1016135165
.long 4196285314
.long 1073247177
.long 2032365307
.long 1016194735
.long 224877747
.long 1073248996
.long 497926916
.long 1016947111
.long 3271386490
.long 1073250671
.long 2689994846
.long 1016631513
.long 813635989
.long 1073252221
.long 747035277
.long 3164530136
.long 369829519
.long 1073253658
.long 2182033858
.long 3163190340
.long 1187679052
.long 1073254994
.long 673954443
.long 1016149821
.long 4232586098
.long 1073256239
.long 497775200
.long 3162179015
.long 426690558
.long 1073257404
.long 3063343247
.long 1016865578
.long 1624065902
.long 1073258494
.long 1354224996
.long 3163503778
.long 1413754136
.long 1073291771
.long 856972295
.long 1016178214
.long 1413754136
.long 1073291771
.long 856972295
.long 1016178214
.long 4294967295
.long 2147483647
.long 0
.long 0
.long 0
.long 1072693248
.long 0
.long 0
.long 0
.long 4294901760
.long 0
.long 0
.long 0
.long 32768
.long 0
.long 0
.long 2006262985
.long 1069310863
.long 2358449471
.long 3217342131
.long 3845454352
.long 1069952297
.long 2829679149
.long 1073771565
.type static_const_table,@object
.size static_const_table,2704
.data
.section .note.GNU-stack, ""
# End

739
libm/x86/s_cbrt.S Normal file
View File

@ -0,0 +1,739 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Assume x=2^{3*k+j} * 1.b1 b2 ... b5 b6 ... b52, where j = 0,1,2.
// Let r=(x*2^{-3k-j} - 1.b1 b2 ... b5 1)* rcp[b1 b2 ..b5],
// where rcp[b1 b2 .. b5]=1/(1.b1 b2 b3 b4 b5 1) in double precision
// cbrt(2^j * 1. b1 b2 .. b5 1) is approximated as T[j][b1..b5]+D[j][b1..b5]
// (T stores the high 53 bits, D stores the low order bits)
// Result=2^k*T+(2^k*T*r)*P+2^k*D
// where P=p1+p2*r+..+p8*r^7
//
// Special cases:
// cbrt(NaN) = quiet NaN, and raise invalid exception
// cbrt(INF) = that INF
// cbrt(+/-0) = +/-0
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin cbrt
ENTRY(cbrt)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $120, %esp
movl %esi, 52(%esp)
call static_func
movl %eax, %esi
movsd 128(%esp), %xmm0
movapd %xmm0, %xmm7
movsd %xmm0, 8(%esp)
movl $524032, %edx
movsd 64(%esi), %xmm5
movsd 80(%esi), %xmm3
psrlq $44, %xmm7
pextrw $0, %xmm7, %ecx
movd %xmm7, %eax
movsd 96(%esi), %xmm1
movsd 112(%esi), %xmm2
movl %ebx, 16(%esp)
andl $248, %ecx
movsd 128(%ecx,%esi), %xmm4
movl %eax, %ebx
andl %eax, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_0.0.2
cmpl $524032, %edx
je .L_2TAG_PACKET_1.0.2
shrl $8, %edx
shrl $8, %ebx
andpd %xmm0, %xmm2
andpd %xmm5, %xmm0
orpd %xmm2, %xmm3
orpd %xmm0, %xmm1
movapd (%esi), %xmm5
movl $5462, %eax
movapd 16(%esi), %xmm6
mull %edx
movl %ebx, %edx
andl $2047, %ebx
shrl $14, %eax
andl $2048, %edx
subl %eax, %ebx
subl %eax, %ebx
subl %eax, %ebx
shll $8, %ebx
addl $682, %eax
orl %edx, %eax
movd %eax, %xmm7
addl %ebx, %ecx
psllq $52, %xmm7
.L_2TAG_PACKET_2.0.2:
movapd 32(%esi), %xmm2
movapd 48(%esi), %xmm0
subsd %xmm3, %xmm1
movq %xmm7, %xmm3
mulsd 384(%ecx,%esi), %xmm7
mulsd %xmm4, %xmm1
mulsd 1152(%ecx,%esi), %xmm3
movapd %xmm1, %xmm4
unpcklpd %xmm1, %xmm1
mulpd %xmm1, %xmm5
mulpd %xmm1, %xmm6
mulpd %xmm1, %xmm1
addpd %xmm5, %xmm2
addpd %xmm6, %xmm0
mulpd %xmm1, %xmm2
mulpd %xmm1, %xmm1
mulsd %xmm7, %xmm4
addpd %xmm2, %xmm0
movl 16(%esp), %ebx
mulsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm4, %xmm0
addsd %xmm3, %xmm0
addsd %xmm7, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_0.0.2:
mulsd 1984(%esi), %xmm0
movq %xmm0, %xmm7
movl $524032, %edx
psrlq $44, %xmm7
pextrw $0, %xmm7, %ecx
movd %xmm7, %eax
andl $248, %ecx
movsd 128(%ecx,%esi), %xmm4
movl %eax, %ebx
andl %eax, %edx
shrl $8, %edx
shrl $8, %ebx
cmpl $0, %edx
je .L_2TAG_PACKET_4.0.2
andpd %xmm0, %xmm2
andpd %xmm5, %xmm0
orpd %xmm2, %xmm3
orpd %xmm0, %xmm1
movapd (%esi), %xmm5
movl $5462, %eax
movapd 16(%esi), %xmm6
mull %edx
movl %ebx, %edx
andl $2047, %ebx
shrl $14, %eax
andl $2048, %edx
subl %eax, %ebx
subl %eax, %ebx
subl %eax, %ebx
shll $8, %ebx
addl $661, %eax
orl %edx, %eax
movd %eax, %xmm7
addl %ebx, %ecx
psllq $52, %xmm7
jmp .L_2TAG_PACKET_2.0.2
.L_2TAG_PACKET_4.0.2:
cmpl $0, %ebx
jne .L_2TAG_PACKET_5.0.2
movl 16(%esp), %ebx
fldl 1952(%esi)
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_5.0.2:
movl 16(%esp), %ebx
fldl 1968(%esi)
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_1.0.2:
movl 16(%esp), %ebx
movl 132(%esp), %eax
movl 128(%esp), %edx
movl %eax, %ecx
andl $2147483647, %ecx
cmpl $2146435072, %ecx
ja .L_2TAG_PACKET_6.0.2
cmpl $0, %edx
jne .L_2TAG_PACKET_6.0.2
cmpl $2146435072, %eax
jne .L_2TAG_PACKET_7.0.2
fldl 1920(%esi)
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_7.0.2:
fldl 1936(%esi)
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_6.0.2:
movsd 8(%esp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
.L_2TAG_PACKET_3.0.2:
movl 52(%esp), %esi
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(cbrt)
# -- End cbrt
# Start file scope ASM
.weak cbrtl
.equ cbrtl, cbrt
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 1553778919
.long 3213899486
.long 3534952507
.long 3215266280
.long 1646371399
.long 3214412045
.long 477218588
.long 3216798151
.long 3582521621
.long 1066628362
.long 1007461464
.long 1068473053
.long 889629714
.long 1067378449
.long 1431655765
.long 1070945621
.long 4294967295
.long 1048575
.long 0
.long 0
.long 0
.long 3220193280
.long 0
.long 0
.long 0
.long 3220176896
.long 0
.long 0
.long 0
.long 1032192
.long 0
.long 0
.long 528611360
.long 3220144632
.long 2884679527
.long 3220082993
.long 1991868891
.long 3220024928
.long 2298714891
.long 3219970134
.long 58835168
.long 3219918343
.long 3035110223
.long 3219869313
.long 1617585086
.long 3219822831
.long 2500867033
.long 3219778702
.long 4241943008
.long 3219736752
.long 258732970
.long 3219696825
.long 404232216
.long 3219658776
.long 2172167368
.long 3219622476
.long 1544257904
.long 3219587808
.long 377579543
.long 3219554664
.long 1616385542
.long 3219522945
.long 813783277
.long 3219492562
.long 3940743189
.long 3219463431
.long 2689777499
.long 3219435478
.long 1700977147
.long 3219408632
.long 3169102082
.long 3219382828
.long 327235604
.long 3219358008
.long 1244336319
.long 3219334115
.long 1300311200
.long 3219311099
.long 3095471925
.long 3219288912
.long 2166487928
.long 3219267511
.long 2913108253
.long 3219246854
.long 293672978
.long 3219226904
.long 288737297
.long 3219207624
.long 1810275472
.long 3219188981
.long 174592167
.long 3219170945
.long 3539053052
.long 3219153485
.long 2164392968
.long 3219136576
.long 572345495
.long 1072698681
.long 1998204467
.long 1072709382
.long 3861501553
.long 1072719872
.long 2268192434
.long 1072730162
.long 2981979308
.long 1072740260
.long 270859143
.long 1072750176
.long 2958651392
.long 1072759916
.long 313113243
.long 1072769490
.long 919449400
.long 1072778903
.long 2809328903
.long 1072788162
.long 2222981587
.long 1072797274
.long 2352530781
.long 1072806244
.long 594152517
.long 1072815078
.long 1555767199
.long 1072823780
.long 4282421314
.long 1072832355
.long 2355578597
.long 1072840809
.long 1162590619
.long 1072849145
.long 797864051
.long 1072857367
.long 431273680
.long 1072865479
.long 2669831148
.long 1072873484
.long 733477752
.long 1072881387
.long 4280220604
.long 1072889189
.long 801961634
.long 1072896896
.long 2915370760
.long 1072904508
.long 1159613482
.long 1072912030
.long 2689944798
.long 1072919463
.long 1248687822
.long 1072926811
.long 2967951030
.long 1072934075
.long 630170432
.long 1072941259
.long 3760898254
.long 1072948363
.long 0
.long 1072955392
.long 2370273294
.long 1072962345
.long 1261754802
.long 1072972640
.long 546334065
.long 1072986123
.long 1054893830
.long 1072999340
.long 1571187597
.long 1073012304
.long 1107975175
.long 1073025027
.long 3606909377
.long 1073037519
.long 1113616747
.long 1073049792
.long 4154744632
.long 1073061853
.long 3358931423
.long 1073073713
.long 4060702372
.long 1073085379
.long 747576176
.long 1073096860
.long 3023138255
.long 1073108161
.long 1419988548
.long 1073119291
.long 1914185305
.long 1073130255
.long 294389948
.long 1073141060
.long 3761802570
.long 1073151710
.long 978281566
.long 1073162213
.long 823148820
.long 1073172572
.long 2420954441
.long 1073182792
.long 3815449908
.long 1073192878
.long 2046058587
.long 1073202835
.long 1807524753
.long 1073212666
.long 2628681401
.long 1073222375
.long 3225667357
.long 1073231966
.long 1555307421
.long 1073241443
.long 3454043099
.long 1073250808
.long 1208137896
.long 1073260066
.long 3659916772
.long 1073269218
.long 1886261264
.long 1073278269
.long 3593647839
.long 1073287220
.long 3086012205
.long 1073296075
.long 2769796922
.long 1073304836
.long 888716057
.long 1073317807
.long 2201465623
.long 1073334794
.long 164369365
.long 1073351447
.long 3462666733
.long 1073367780
.long 2773905457
.long 1073383810
.long 1342879088
.long 1073399550
.long 2543933975
.long 1073415012
.long 1684477781
.long 1073430209
.long 3532178543
.long 1073445151
.long 1147747300
.long 1073459850
.long 1928031793
.long 1073474314
.long 2079717015
.long 1073488553
.long 4016765315
.long 1073502575
.long 3670431139
.long 1073516389
.long 3549227225
.long 1073530002
.long 11637607
.long 1073543422
.long 588220169
.long 1073556654
.long 2635407503
.long 1073569705
.long 2042029317
.long 1073582582
.long 1925128962
.long 1073595290
.long 4136375664
.long 1073607834
.long 759964600
.long 1073620221
.long 4257606771
.long 1073632453
.long 297278907
.long 1073644538
.long 3655053093
.long 1073656477
.long 2442253172
.long 1073668277
.long 1111876799
.long 1073679941
.long 3330973139
.long 1073691472
.long 3438879452
.long 1073702875
.long 3671565478
.long 1073714153
.long 1317849547
.long 1073725310
.long 1642364115
.long 1073736348
.long 4050900474
.long 1014427190
.long 1157977860
.long 1016444461
.long 1374568199
.long 1017271387
.long 2809163288
.long 1016882676
.long 3742377377
.long 1013168191
.long 3101606597
.long 1017541672
.long 65224358
.long 1017217597
.long 2691591250
.long 1017266643
.long 4020758549
.long 1017689313
.long 1316310992
.long 1018030788
.long 1031537856
.long 1014090882
.long 3261395239
.long 1016413641
.long 886424999
.long 1016313335
.long 3114776834
.long 1014195875
.long 1681120620
.long 1017825416
.long 1329600273
.long 1016625740
.long 465474623
.long 1017097119
.long 4251633980
.long 1017169077
.long 1986990133
.long 1017710645
.long 752958613
.long 1017159641
.long 2216216792
.long 1018020163
.long 4282860129
.long 1015924861
.long 1557627859
.long 1016039538
.long 3889219754
.long 1018086237
.long 3684996408
.long 1017353275
.long 723532103
.long 1017717141
.long 2951149676
.long 1012528470
.long 831890937
.long 1017830553
.long 1031212645
.long 1017387331
.long 2741737450
.long 1017604974
.long 2863311531
.long 1003776682
.long 4276736099
.long 1013153088
.long 4111778382
.long 1015673686
.long 1728065769
.long 1016413986
.long 2708718031
.long 1018078833
.long 1069335005
.long 1015291224
.long 700037144
.long 1016482032
.long 2904566452
.long 1017226861
.long 4074156649
.long 1017622651
.long 25019565
.long 1015245366
.long 3601952608
.long 1015771755
.long 3267129373
.long 1017904664
.long 503203103
.long 1014921629
.long 2122011730
.long 1018027866
.long 3927295461
.long 1014189456
.long 2790625147
.long 1016024251
.long 1330460186
.long 1016940346
.long 4033568463
.long 1015538390
.long 3695818227
.long 1017509621
.long 257573361
.long 1017208868
.long 3227697852
.long 1017337964
.long 234118548
.long 1017169577
.long 4009025803
.long 1017278524
.long 1948343394
.long 1017749310
.long 678398162
.long 1018144239
.long 3083864863
.long 1016669086
.long 2415453452
.long 1017890370
.long 175467344
.long 1017330033
.long 3197359580
.long 1010339928
.long 2071276951
.long 1015941358
.long 268372543
.long 1016737773
.long 938132959
.long 1017389108
.long 1816750559
.long 1017337448
.long 4119203749
.long 1017152174
.long 2578653878
.long 1013108497
.long 2470331096
.long 1014678606
.long 123855735
.long 1016553320
.long 1265650889
.long 1014782687
.long 3414398172
.long 1017182638
.long 1040773369
.long 1016158401
.long 3483628886
.long 1016886550
.long 4140499405
.long 1016191425
.long 3893477850
.long 1016964495
.long 3935319771
.long 1009634717
.long 2978982660
.long 1015027112
.long 2452709923
.long 1017990229
.long 3190365712
.long 1015835149
.long 4237588139
.long 1015832925
.long 2610678389
.long 1017962711
.long 2127316774
.long 1017405770
.long 824267502
.long 1017959463
.long 2165924042
.long 1017912225
.long 2774007076
.long 1013257418
.long 4123916326
.long 1017582284
.long 1976417958
.long 1016959909
.long 4092806412
.long 1017711279
.long 119251817
.long 1015363631
.long 3475418768
.long 1017675415
.long 1972580503
.long 1015470684
.long 815541017
.long 1017517969
.long 2429917451
.long 1017397776
.long 4062888482
.long 1016749897
.long 68284153
.long 1017925678
.long 2207779246
.long 1016320298
.long 1183466520
.long 1017408657
.long 143326427
.long 1017060403
.long 0
.long 2146435072
.long 0
.long 0
.long 0
.long 4293918720
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 2147483648
.long 0
.long 0
.long 0
.long 1138753536
.long 0
.long 0
.type static_const_table,@object
.size static_const_table,2000
.data
.section .note.GNU-stack, ""
# End

893
libm/x86/s_cos.S Normal file
View File

@ -0,0 +1,893 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// 1. RANGE REDUCTION
//
// We perform an initial range reduction from X to r with
//
// X =~= N * pi/32 + r
//
// so that |r| <= pi/64 + epsilon. We restrict inputs to those
// where |N| <= 932560. Beyond this, the range reduction is
// insufficiently accurate. For extremely small inputs,
// denormalization can occur internally, impacting performance.
// This means that the main path is actually only taken for
// 2^-252 <= |X| < 90112.
//
// To avoid branches, we perform the range reduction to full
// accuracy each time.
//
// X - N * (P_1 + P_2 + P_3)
//
// where P_1 and P_2 are 32-bit numbers (so multiplication by N
// is exact) and P_3 is a 53-bit number. Together, these
// approximate pi well enough for all cases in the restricted
// range.
//
// The main reduction sequence is:
//
// y = 32/pi * x
// N = integer(y)
// (computed by adding and subtracting off SHIFTER)
//
// m_1 = N * P_1
// m_2 = N * P_2
// r_1 = x - m_1
// r = r_1 - m_2
// (this r can be used for most of the calculation)
//
// c_1 = r_1 - r
// m_3 = N * P_3
// c_2 = c_1 - m_2
// c = c_2 - m_3
//
// 2. MAIN ALGORITHM
//
// The algorithm uses a table lookup based on B = M * pi / 32
// where M = N mod 64. The stored values are:
// sigma closest power of 2 to cos(B)
// C_hl 53-bit cos(B) - sigma
// S_hi + S_lo 2 * 53-bit sin(B)
//
// The computation is organized as follows:
//
// sin(B + r + c) = [sin(B) + sigma * r] +
// r * (cos(B) - sigma) +
// sin(B) * [cos(r + c) - 1] +
// cos(B) * [sin(r + c) - r]
//
// which is approximately:
//
// [S_hi + sigma * r] +
// C_hl * r +
// S_lo + S_hi * [(cos(r) - 1) - r * c] +
// (C_hl + sigma) * [(sin(r) - r) + c]
//
// and this is what is actually computed. We separate this sum
// into four parts:
//
// hi + med + pols + corr
//
// where
//
// hi = S_hi + sigma r
// med = C_hl * r
// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r)
// corr = S_lo + c * ((C_hl + sigma) - S_hi * r)
//
// 3. POLYNOMIAL
//
// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) *
// (sin(r) - r) can be rearranged freely, since it is quite
// small, so we exploit parallelism to the fullest.
//
// psc4 = SC_4 * r_1
// msc4 = psc4 * r
// r2 = r * r
// msc2 = SC_2 * r2
// r4 = r2 * r2
// psc3 = SC_3 + msc4
// psc1 = SC_1 + msc2
// msc3 = r4 * psc3
// sincospols = psc1 + msc3
// pols = sincospols *
// <S_hi * r^2 | (C_hl + sigma) * r^3>
//
// 4. CORRECTION TERM
//
// This is where the "c" component of the range reduction is
// taken into account; recall that just "r" is used for most of
// the calculation.
//
// -c = m_3 - c_2
// -d = S_hi * r - (C_hl + sigma)
// corr = -c * -d + S_lo
//
// 5. COMPENSATED SUMMATIONS
//
// The two successive compensated summations add up the high
// and medium parts, leaving just the low parts to add up at
// the end.
//
// rs = sigma * r
// res_int = S_hi + rs
// k_0 = S_hi - res_int
// k_2 = k_0 + rs
// med = C_hl * r
// res_hi = res_int + med
// k_1 = res_int - res_hi
// k_3 = k_1 + med
//
// 6. FINAL SUMMATION
//
// We now add up all the small parts:
//
// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3
//
// Now the overall result is just:
//
// res_hi + res_lo
//
// 7. SMALL ARGUMENTS
//
// Inputs with |X| < 2^-252 are treated specially as
// 1 - |x|.
//
// Special cases:
// cos(NaN) = quiet NaN, and raise invalid exception
// cos(INF) = NaN and raise invalid exception
// cos(0) = 1
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin cos
ENTRY(cos)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $120, %esp
movl %ebx, 56(%esp)
call static_func
movl %eax, %ebx
movsd 128(%esp), %xmm0
pextrw $3, %xmm0, %eax
andl $32767, %eax
subl $12336, %eax
cmpl $4293, %eax
ja .L_2TAG_PACKET_0.0.2
movsd 2160(%ebx), %xmm1
mulsd %xmm0, %xmm1
movapd 2240(%ebx), %xmm5
movsd 2224(%ebx), %xmm4
andpd %xmm0, %xmm4
orps %xmm4, %xmm5
movsd 2128(%ebx), %xmm3
movapd 2112(%ebx), %xmm2
addpd %xmm5, %xmm1
cvttsd2si %xmm1, %edx
cvtsi2sdl %edx, %xmm1
mulsd %xmm1, %xmm3
unpcklpd %xmm1, %xmm1
addl $1865232, %edx
movapd %xmm0, %xmm4
andl $63, %edx
movapd 2096(%ebx), %xmm5
lea (%ebx), %eax
shll $5, %edx
addl %edx, %eax
mulpd %xmm1, %xmm2
subsd %xmm3, %xmm0
mulsd 2144(%ebx), %xmm1
subsd %xmm3, %xmm4
movsd 8(%eax), %xmm7
unpcklpd %xmm0, %xmm0
movapd %xmm4, %xmm3
subsd %xmm2, %xmm4
mulpd %xmm0, %xmm5
subpd %xmm2, %xmm0
movapd 2064(%ebx), %xmm6
mulsd %xmm4, %xmm7
subsd %xmm4, %xmm3
mulpd %xmm0, %xmm5
mulpd %xmm0, %xmm0
subsd %xmm2, %xmm3
movapd (%eax), %xmm2
subsd %xmm3, %xmm1
movsd 24(%eax), %xmm3
addsd %xmm3, %xmm2
subsd %xmm2, %xmm7
mulsd %xmm4, %xmm2
mulpd %xmm0, %xmm6
mulsd %xmm4, %xmm3
mulpd %xmm0, %xmm2
mulpd %xmm0, %xmm0
addpd 2080(%ebx), %xmm5
mulsd (%eax), %xmm4
addpd 2048(%ebx), %xmm6
mulpd %xmm0, %xmm5
movapd %xmm3, %xmm0
addsd 8(%eax), %xmm3
mulpd %xmm7, %xmm1
movapd %xmm4, %xmm7
addsd %xmm3, %xmm4
addpd %xmm5, %xmm6
movsd 8(%eax), %xmm5
subsd %xmm3, %xmm5
subsd %xmm4, %xmm3
addsd 16(%eax), %xmm1
mulpd %xmm2, %xmm6
addsd %xmm0, %xmm5
addsd %xmm7, %xmm3
addsd %xmm5, %xmm1
addsd %xmm3, %xmm1
addsd %xmm6, %xmm1
unpckhpd %xmm6, %xmm6
addsd %xmm6, %xmm1
addsd %xmm1, %xmm4
movsd %xmm4, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_0.0.2:
jg .L_2TAG_PACKET_2.0.2
pextrw $3, %xmm0, %eax
andl $32767, %eax
pinsrw $3, %eax, %xmm0
movsd 2192(%ebx), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_2.0.2:
movl 132(%esp), %eax
andl $2146435072, %eax
cmpl $2146435072, %eax
je .L_2TAG_PACKET_3.0.2
subl $32, %esp
movsd %xmm0, (%esp)
lea 40(%esp), %eax
movl %eax, 8(%esp)
movl $1, %eax
movl %eax, 12(%esp)
call __libm_sincos_huge
addl $32, %esp
fldl 8(%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_3.0.2:
fldl 128(%esp)
fmull 2208(%ebx)
.L_2TAG_PACKET_1.0.2:
movl 56(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(cos)
# -- End cos
# Start file scope ASM
.weak cosl
.equ cosl, cos
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 1072693248
.long 393047345
.long 3212032302
.long 3156849708
.long 1069094822
.long 3758096384
.long 3158189848
.long 0
.long 1072693248
.long 18115067
.long 3214126342
.long 1013556747
.long 1070135480
.long 3221225472
.long 3160567065
.long 0
.long 1072693248
.long 2476548698
.long 3215330282
.long 785751814
.long 1070765062
.long 2684354560
.long 3161838221
.long 0
.long 1072693248
.long 2255197647
.long 3216211105
.long 2796464483
.long 1071152610
.long 3758096384
.long 3160878317
.long 0
.long 1072693248
.long 1945768569
.long 3216915048
.long 939980347
.long 1071524701
.long 536870912
.long 1012796809
.long 0
.long 1072693248
.long 1539668340
.long 3217396327
.long 967731400
.long 1071761211
.long 536870912
.long 1015752157
.long 0
.long 1072693248
.long 1403757309
.long 3217886718
.long 621354454
.long 1071926515
.long 536870912
.long 1013450602
.long 0
.long 1072693248
.long 2583490354
.long 1070236281
.long 1719614413
.long 1072079006
.long 536870912
.long 3163282740
.long 0
.long 1071644672
.long 2485417816
.long 1069626316
.long 1796544321
.long 1072217216
.long 536870912
.long 3162686945
.long 0
.long 1071644672
.long 2598800519
.long 1068266419
.long 688824739
.long 1072339814
.long 3758096384
.long 1010431536
.long 0
.long 1071644672
.long 2140183630
.long 3214756396
.long 4051746225
.long 1072445618
.long 2147483648
.long 3161907377
.long 0
.long 1071644672
.long 1699043957
.long 3216902261
.long 3476196678
.long 1072533611
.long 536870912
.long 1014257638
.long 0
.long 1071644672
.long 1991047213
.long 1067753521
.long 1455828442
.long 1072602945
.long 3758096384
.long 1015505073
.long 0
.long 1070596096
.long 240740309
.long 3215727903
.long 3489094832
.long 1072652951
.long 536870912
.long 1014325783
.long 0
.long 1070596096
.long 257503056
.long 3214647653
.long 2748392742
.long 1072683149
.long 1073741824
.long 3163061750
.long 0
.long 1069547520
.long 0
.long 0
.long 0
.long 1072693248
.long 0
.long 0
.long 0
.long 0
.long 257503056
.long 1067164005
.long 2748392742
.long 1072683149
.long 1073741824
.long 3163061750
.long 0
.long 3217031168
.long 240740309
.long 1068244255
.long 3489094832
.long 1072652951
.long 536870912
.long 1014325783
.long 0
.long 3218079744
.long 1991047213
.long 3215237169
.long 1455828442
.long 1072602945
.long 3758096384
.long 1015505073
.long 0
.long 3218079744
.long 1699043957
.long 1069418613
.long 3476196678
.long 1072533611
.long 536870912
.long 1014257638
.long 0
.long 3219128320
.long 2140183630
.long 1067272748
.long 4051746225
.long 1072445618
.long 2147483648
.long 3161907377
.long 0
.long 3219128320
.long 2598800519
.long 3215750067
.long 688824739
.long 1072339814
.long 3758096384
.long 1010431536
.long 0
.long 3219128320
.long 2485417816
.long 3217109964
.long 1796544321
.long 1072217216
.long 536870912
.long 3162686945
.long 0
.long 3219128320
.long 2583490354
.long 3217719929
.long 1719614413
.long 1072079006
.long 536870912
.long 3163282740
.long 0
.long 3219128320
.long 1403757309
.long 1070403070
.long 621354454
.long 1071926515
.long 536870912
.long 1013450602
.long 0
.long 3220176896
.long 1539668340
.long 1069912679
.long 967731400
.long 1071761211
.long 536870912
.long 1015752157
.long 0
.long 3220176896
.long 1945768569
.long 1069431400
.long 939980347
.long 1071524701
.long 536870912
.long 1012796809
.long 0
.long 3220176896
.long 2255197647
.long 1068727457
.long 2796464483
.long 1071152610
.long 3758096384
.long 3160878317
.long 0
.long 3220176896
.long 2476548698
.long 1067846634
.long 785751814
.long 1070765062
.long 2684354560
.long 3161838221
.long 0
.long 3220176896
.long 18115067
.long 1066642694
.long 1013556747
.long 1070135480
.long 3221225472
.long 3160567065
.long 0
.long 3220176896
.long 393047345
.long 1064548654
.long 3156849708
.long 1069094822
.long 3758096384
.long 3158189848
.long 0
.long 3220176896
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 3220176896
.long 393047345
.long 1064548654
.long 3156849708
.long 3216578470
.long 3758096384
.long 1010706200
.long 0
.long 3220176896
.long 18115067
.long 1066642694
.long 1013556747
.long 3217619128
.long 3221225472
.long 1013083417
.long 0
.long 3220176896
.long 2476548698
.long 1067846634
.long 785751814
.long 3218248710
.long 2684354560
.long 1014354573
.long 0
.long 3220176896
.long 2255197647
.long 1068727457
.long 2796464483
.long 3218636258
.long 3758096384
.long 1013394669
.long 0
.long 3220176896
.long 1945768569
.long 1069431400
.long 939980347
.long 3219008349
.long 536870912
.long 3160280457
.long 0
.long 3220176896
.long 1539668340
.long 1069912679
.long 967731400
.long 3219244859
.long 536870912
.long 3163235805
.long 0
.long 3220176896
.long 1403757309
.long 1070403070
.long 621354454
.long 3219410163
.long 536870912
.long 3160934250
.long 0
.long 3220176896
.long 2583490354
.long 3217719929
.long 1719614413
.long 3219562654
.long 536870912
.long 1015799092
.long 0
.long 3219128320
.long 2485417816
.long 3217109964
.long 1796544321
.long 3219700864
.long 536870912
.long 1015203297
.long 0
.long 3219128320
.long 2598800519
.long 3215750067
.long 688824739
.long 3219823462
.long 3758096384
.long 3157915184
.long 0
.long 3219128320
.long 2140183630
.long 1067272748
.long 4051746225
.long 3219929266
.long 2147483648
.long 1014423729
.long 0
.long 3219128320
.long 1699043957
.long 1069418613
.long 3476196678
.long 3220017259
.long 536870912
.long 3161741286
.long 0
.long 3219128320
.long 1991047213
.long 3215237169
.long 1455828442
.long 3220086593
.long 3758096384
.long 3162988721
.long 0
.long 3218079744
.long 240740309
.long 1068244255
.long 3489094832
.long 3220136599
.long 536870912
.long 3161809431
.long 0
.long 3218079744
.long 257503056
.long 1067164005
.long 2748392742
.long 3220166797
.long 1073741824
.long 1015578102
.long 0
.long 3217031168
.long 0
.long 0
.long 0
.long 3220176896
.long 0
.long 0
.long 0
.long 0
.long 257503056
.long 3214647653
.long 2748392742
.long 3220166797
.long 1073741824
.long 1015578102
.long 0
.long 1069547520
.long 240740309
.long 3215727903
.long 3489094832
.long 3220136599
.long 536870912
.long 3161809431
.long 0
.long 1070596096
.long 1991047213
.long 1067753521
.long 1455828442
.long 3220086593
.long 3758096384
.long 3162988721
.long 0
.long 1070596096
.long 1699043957
.long 3216902261
.long 3476196678
.long 3220017259
.long 536870912
.long 3161741286
.long 0
.long 1071644672
.long 2140183630
.long 3214756396
.long 4051746225
.long 3219929266
.long 2147483648
.long 1014423729
.long 0
.long 1071644672
.long 2598800519
.long 1068266419
.long 688824739
.long 3219823462
.long 3758096384
.long 3157915184
.long 0
.long 1071644672
.long 2485417816
.long 1069626316
.long 1796544321
.long 3219700864
.long 536870912
.long 1015203297
.long 0
.long 1071644672
.long 2583490354
.long 1070236281
.long 1719614413
.long 3219562654
.long 536870912
.long 1015799092
.long 0
.long 1071644672
.long 1403757309
.long 3217886718
.long 621354454
.long 3219410163
.long 536870912
.long 3160934250
.long 0
.long 1072693248
.long 1539668340
.long 3217396327
.long 967731400
.long 3219244859
.long 536870912
.long 3163235805
.long 0
.long 1072693248
.long 1945768569
.long 3216915048
.long 939980347
.long 3219008349
.long 536870912
.long 3160280457
.long 0
.long 1072693248
.long 2255197647
.long 3216211105
.long 2796464483
.long 3218636258
.long 3758096384
.long 1013394669
.long 0
.long 1072693248
.long 2476548698
.long 3215330282
.long 785751814
.long 3218248710
.long 2684354560
.long 1014354573
.long 0
.long 1072693248
.long 18115067
.long 3214126342
.long 1013556747
.long 3217619128
.long 3221225472
.long 1013083417
.long 0
.long 1072693248
.long 393047345
.long 3212032302
.long 3156849708
.long 3216578470
.long 3758096384
.long 1010706200
.long 0
.long 1072693248
.long 1431655765
.long 3217380693
.long 0
.long 3219128320
.long 286331153
.long 1065423121
.long 1431655765
.long 1067799893
.long 436314138
.long 3207201184
.long 381774871
.long 3210133868
.long 2773927732
.long 1053236707
.long 436314138
.long 1056571808
.long 442499072
.long 1032893537
.long 442499072
.long 1032893537
.long 1413480448
.long 1069097467
.long 0
.long 0
.long 771977331
.long 996350346
.long 0
.long 0
.long 1841940611
.long 1076125488
.long 0
.long 0
.long 0
.long 1127743488
.long 0
.long 0
.long 0
.long 1072693248
.long 0
.long 0
.long 0
.long 2147483648
.long 0
.long 0
.long 0
.long 2147483648
.long 0
.long 0
.long 0
.long 1071644672
.long 0
.long 1071644672
.type static_const_table,@object
.size static_const_table,2256
.data
.hidden __libm_sincos_huge
.section .note.GNU-stack, ""
# End

703
libm/x86/s_expm1.S Normal file
View File

@ -0,0 +1,703 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Description:
// Let K = 64 (table size).
//
// Four sub-domains:
// 1. |x| < 1/(2*K)
// expm1(x) ~ P(x)
// 2. 1/(2*K) <= |x| <= 56*log(2)
// x x/log(2) n
// e - 1 = 2 = 2 * T[j] * (1 + P(y)) - 1
// 3. 56*log(2) < x < MAX_LOG
// x x x/log(2) n
// e - 1 ~ e = 2 = 2 * T[j] * (1 + P(y))
// 4. x < -56*log(2)
// x x
// e - 1 = -1 + e ~ -1
// where
// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K]
// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2]
// j/K
// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
//
// P(y) is a minimax polynomial approximation of exp(x)-1
// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
//
// In case 3, to avoid problems with arithmetic overflow and underflow,
// n n1 n2
// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
// and BIAS is a value of exponent bias.
//
// Special cases:
// expm1(NaN) is NaN
// expm1(+INF) is +INF
// expm1(-INF) is -1
// expm1(x) is x for subnormals
// for finite argument, only expm1(0)=0 is exact.
// For IEEE double
// if x > 709.782712893383973096 then expm1(x) overflow
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin expm1
ENTRY(expm1)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $120, %esp
movl %ebx, 64(%esp)
call static_func
movl %eax, %ebx
movsd 128(%esp), %xmm0
unpcklpd %xmm0, %xmm0
movapd 64(%ebx), %xmm1
movapd 48(%ebx), %xmm6
movapd 80(%ebx), %xmm2
movapd 96(%ebx), %xmm3
pextrw $3, %xmm0, %eax
andl $32767, %eax
movl $16527, %edx
subl %eax, %edx
subl $16304, %eax
orl %eax, %edx
cmpl $-2147483648, %edx
jae .L_2TAG_PACKET_0.0.2
mulpd %xmm0, %xmm1
addpd %xmm6, %xmm1
movapd %xmm1, %xmm7
subpd %xmm6, %xmm1
mulpd %xmm1, %xmm2
movapd 112(%ebx), %xmm4
mulpd %xmm1, %xmm3
movapd 128(%ebx), %xmm5
subpd %xmm2, %xmm0
movd %xmm7, %eax
movl %eax, %ecx
andl $63, %ecx
shll $4, %ecx
sarl $6, %eax
movl %eax, %edx
subpd %xmm3, %xmm0
movapd 160(%ebx,%ecx), %xmm2
movsd 144(%ebx), %xmm3
mulpd %xmm0, %xmm4
movapd %xmm0, %xmm1
mulpd %xmm0, %xmm0
mulsd %xmm0, %xmm3
addpd %xmm4, %xmm5
mulsd %xmm0, %xmm0
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm2
movdqa 16(%ebx), %xmm6
pand %xmm6, %xmm7
movdqa 32(%ebx), %xmm6
paddq %xmm6, %xmm7
psllq $46, %xmm7
mulsd %xmm0, %xmm3
mulpd %xmm5, %xmm0
addl $894, %edx
cmpl $1916, %edx
ja .L_2TAG_PACKET_1.0.2
addsd %xmm3, %xmm0
xorpd %xmm3, %xmm3
movl $16368, %eax
pinsrw $3, %eax, %xmm3
orpd %xmm7, %xmm2
mulsd %xmm4, %xmm7
movapd %xmm3, %xmm6
addsd %xmm1, %xmm3
pextrw $3, %xmm2, %edx
pshufd $238, %xmm0, %xmm5
psrlq $38, %xmm3
psllq $38, %xmm3
movapd %xmm2, %xmm4
subsd %xmm3, %xmm6
addsd %xmm5, %xmm0
addsd %xmm6, %xmm1
addsd %xmm7, %xmm4
mulsd %xmm3, %xmm7
mulsd %xmm2, %xmm3
xorpd %xmm5, %xmm5
movl $16368, %eax
pinsrw $3, %eax, %xmm5
addsd %xmm1, %xmm0
movl $17184, %ecx
subl %edx, %ecx
subl $16256, %edx
orl %edx, %ecx
jl .L_2TAG_PACKET_2.0.2
mulsd %xmm4, %xmm0
subsd %xmm5, %xmm3
addsd %xmm7, %xmm0
addsd %xmm3, %xmm0
.L_2TAG_PACKET_3.0.2:
jmp .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_2.0.2:
cmpl $0, %edx
jl .L_2TAG_PACKET_5.0.2
mulsd %xmm4, %xmm0
subsd %xmm5, %xmm7
addsd %xmm7, %xmm0
addsd %xmm3, %xmm0
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_5.0.2:
mulsd %xmm4, %xmm0
addsd %xmm7, %xmm0
addsd %xmm3, %xmm0
subsd %xmm5, %xmm0
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_1.0.2:
movl 132(%esp), %ecx
addsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0
addsd %xmm1, %xmm0
cmpl $0, %ecx
jl .L_2TAG_PACKET_6.0.2
fstcw 24(%esp)
movzwl 24(%esp), %edx
orl $768, %edx
movw %dx, 28(%esp)
fldcw 28(%esp)
movl %eax, %edx
sarl $1, %eax
subl %eax, %edx
movdqa (%ebx), %xmm6
pandn %xmm2, %xmm6
addl $1023, %eax
movd %eax, %xmm3
psllq $52, %xmm3
orpd %xmm3, %xmm6
mulsd %xmm3, %xmm4
movsd %xmm0, 8(%esp)
fldl 8(%esp)
movsd %xmm6, 16(%esp)
fldl 16(%esp)
movsd %xmm4, 16(%esp)
fldl 16(%esp)
addl $1023, %edx
movd %edx, %xmm4
psllq $52, %xmm4
faddp %st, %st(1)
fmul %st, %st(1)
faddp %st, %st(1)
movsd %xmm4, 8(%esp)
fldl 8(%esp)
fmulp %st, %st(1)
fstpl 8(%esp)
movsd 8(%esp), %xmm0
fldcw 24(%esp)
pextrw $3, %xmm0, %ecx
andl $32752, %ecx
cmpl $32752, %ecx
jae .L_2TAG_PACKET_7.0.2
jmp .L_2TAG_PACKET_4.0.2
cmpl $-2147483648, %ecx
jb .L_2TAG_PACKET_7.0.2
jmp .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_7.0.2:
movl $41, %edx
.L_2TAG_PACKET_8.0.2:
movsd %xmm0, (%esp)
movsd 128(%esp), %xmm0
fldl (%esp)
jmp .L_2TAG_PACKET_9.0.2
.L_2TAG_PACKET_10.0.2:
cmpl $2146435072, %eax
jae .L_2TAG_PACKET_11.0.2
movsd 1272(%ebx), %xmm0
mulsd %xmm0, %xmm0
movl $41, %edx
jmp .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_11.0.2:
movl 132(%esp), %eax
movl 128(%esp), %edx
movl %eax, %ecx
andl $2147483647, %eax
cmpl $2146435072, %eax
ja .L_2TAG_PACKET_12.0.2
cmpl $0, %edx
jne .L_2TAG_PACKET_12.0.2
cmpl $0, %ecx
jl .L_2TAG_PACKET_13.0.2
movsd 1256(%ebx), %xmm0
jmp .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_13.0.2:
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_12.0.2:
movsd 128(%esp), %xmm0
addsd %xmm0, %xmm0
jmp .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_14.0.2:
addl $16304, %eax
cmpl $15504, %eax
jb .L_2TAG_PACKET_15.0.2
movapd 1184(%ebx), %xmm2
pshufd $68, %xmm0, %xmm1
movapd 1200(%ebx), %xmm3
movapd 1216(%ebx), %xmm4
movsd 1232(%ebx), %xmm5
mulsd %xmm1, %xmm1
xorpd %xmm6, %xmm6
movl $16352, %eax
pinsrw $3, %eax, %xmm6
mulpd %xmm0, %xmm2
xorpd %xmm7, %xmm7
movl $16368, %edx
pinsrw $3, %edx, %xmm7
addpd %xmm3, %xmm2
mulsd %xmm1, %xmm5
pshufd $228, %xmm1, %xmm3
mulpd %xmm1, %xmm1
mulsd %xmm0, %xmm6
mulpd %xmm0, %xmm2
addpd %xmm4, %xmm2
movapd %xmm7, %xmm4
addsd %xmm6, %xmm7
mulpd %xmm3, %xmm1
psrlq $27, %xmm7
psllq $27, %xmm7
movsd 1288(%ebx), %xmm3
subsd %xmm7, %xmm4
mulpd %xmm1, %xmm2
addsd %xmm4, %xmm6
pshufd $238, %xmm2, %xmm1
addsd %xmm2, %xmm6
andpd %xmm0, %xmm3
movapd %xmm0, %xmm4
addsd %xmm6, %xmm1
subsd %xmm3, %xmm0
addsd %xmm5, %xmm1
mulsd %xmm7, %xmm3
mulsd %xmm7, %xmm0
mulsd %xmm1, %xmm4
addsd %xmm4, %xmm0
addsd %xmm3, %xmm0
jmp .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_15.0.2:
cmpl $16, %eax
jae .L_2TAG_PACKET_3.0.2
movapd %xmm0, %xmm2
movd %xmm0, %eax
psrlq $31, %xmm2
movd %xmm2, %ecx
orl %ecx, %eax
je .L_2TAG_PACKET_3.0.2
movl $16, %edx
xorpd %xmm1, %xmm1
pinsrw $3, %edx, %xmm1
mulsd %xmm1, %xmm1
movl $42, %edx
jmp .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_0.0.2:
cmpl $0, %eax
jl .L_2TAG_PACKET_14.0.2
movl 132(%esp), %eax
cmpl $1083179008, %eax
jge .L_2TAG_PACKET_10.0.2
cmpl $-1048576, %eax
jae .L_2TAG_PACKET_11.0.2
.L_2TAG_PACKET_6.0.2:
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
jmp .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_4.0.2:
movsd %xmm0, 48(%esp)
fldl 48(%esp)
.L_2TAG_PACKET_9.0.2:
movl 64(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(expm1)
# -- End expm1
# Start file scope ASM
.weak expm1l
.equ expm1l, expm1
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 0
.long 4293918720
.long 0
.long 4293918720
.long 4294967232
.long 0
.long 4294967232
.long 0
.long 65472
.long 0
.long 65472
.long 0
.long 0
.long 1127743488
.long 0
.long 1127743488
.long 1697350398
.long 1079448903
.long 1697350398
.long 1079448903
.long 4277796864
.long 1065758274
.long 4277796864
.long 1065758274
.long 3164486458
.long 1025308570
.long 3164486458
.long 1025308570
.long 1963358694
.long 1065423121
.long 1431655765
.long 1069897045
.long 1431655765
.long 1067799893
.long 0
.long 1071644672
.long 381774871
.long 1062650220
.long 381774871
.long 1062650220
.long 0
.long 0
.long 0
.long 0
.long 1000070955
.long 1042145304
.long 1040187392
.long 11418
.long 988267849
.long 1039500660
.long 3539992576
.long 22960
.long 36755401
.long 1042114290
.long 402653184
.long 34629
.long 3634769483
.long 1042178627
.long 1820327936
.long 46424
.long 2155991225
.long 1041560680
.long 847249408
.long 58348
.long 2766913307
.long 1039293264
.long 3489660928
.long 70401
.long 3651174602
.long 1040488175
.long 2927624192
.long 82586
.long 3073892131
.long 1042240606
.long 1006632960
.long 94904
.long 1328391742
.long 1042019037
.long 3942645760
.long 107355
.long 2650893825
.long 1041903210
.long 822083584
.long 119943
.long 2397289153
.long 1041802037
.long 2281701376
.long 132667
.long 430997175
.long 1042110606
.long 1845493760
.long 145530
.long 1230936525
.long 1041801015
.long 1702887424
.long 158533
.long 740675935
.long 1040178913
.long 4110417920
.long 171677
.long 3489810261
.long 1041825986
.long 2793406464
.long 184965
.long 2532600530
.long 1040767882
.long 167772160
.long 198398
.long 3542557060
.long 1041827263
.long 2986344448
.long 211976
.long 1401563777
.long 1041061093
.long 922746880
.long 225703
.long 3129406026
.long 1041852413
.long 880803840
.long 239579
.long 900993572
.long 1039283234
.long 1275068416
.long 253606
.long 2115029358
.long 1042140042
.long 562036736
.long 267786
.long 1086643152
.long 1041785419
.long 1610612736
.long 282120
.long 82864366
.long 1041256244
.long 3045064704
.long 296610
.long 2392968152
.long 1040913683
.long 3573547008
.long 311258
.long 2905856183
.long 1040002214
.long 1988100096
.long 326066
.long 3742008261
.long 1040011137
.long 1451229184
.long 341035
.long 863393794
.long 1040880621
.long 914358272
.long 356167
.long 1446136837
.long 1041372426
.long 3707764736
.long 371463
.long 927855201
.long 1040617636
.long 360710144
.long 386927
.long 1492679939
.long 1041050306
.long 2952790016
.long 402558
.long 608827001
.long 1041582217
.long 2181038080
.long 418360
.long 606260204
.long 1042271987
.long 1711276032
.long 434334
.long 3163044019
.long 1041843851
.long 1006632960
.long 450482
.long 4148747325
.long 1041962972
.long 3900702720
.long 466805
.long 802924201
.long 1041275378
.long 1442840576
.long 483307
.long 3052749833
.long 1041940577
.long 1937768448
.long 499988
.long 2216116399
.long 1041486744
.long 914358272
.long 516851
.long 2729697836
.long 1041445764
.long 2566914048
.long 533897
.long 540608356
.long 1041310907
.long 2600468480
.long 551129
.long 2916344493
.long 1040535661
.long 1107296256
.long 568549
.long 731391814
.long 1039497014
.long 2566914048
.long 586158
.long 1024722704
.long 1041461625
.long 2961178624
.long 603959
.long 3806831748
.long 1041732499
.long 2675965952
.long 621954
.long 238953304
.long 1040316488
.long 2189426688
.long 640145
.long 749123235
.long 1041725785
.long 2063597568
.long 658534
.long 1168187977
.long 1041175214
.long 2986344448
.long 677123
.long 3506096399
.long 1042186095
.long 1426063360
.long 695915
.long 1470221620
.long 1041675499
.long 2566914048
.long 714911
.long 3182425146
.long 1041483134
.long 3087007744
.long 734114
.long 3131698208
.long 1042208657
.long 4068474880
.long 753526
.long 2300504125
.long 1041428596
.long 2415919104
.long 773150
.long 2290297931
.long 1037388400
.long 3716153344
.long 792987
.long 3532148223
.long 1041626194
.long 771751936
.long 813041
.long 1161884404
.long 1042015258
.long 3699376128
.long 833312
.long 876383176
.long 1037968878
.long 1241513984
.long 853805
.long 3379986796
.long 1042213153
.long 3699376128
.long 874520
.long 1545797737
.long 1041681569
.long 58720256
.long 895462
.long 2925146801
.long 1042212567
.long 855638016
.long 916631
.long 1316627971
.long 1038516204
.long 3883925504
.long 938030
.long 3267869137
.long 1040337004
.long 2726297600
.long 959663
.long 3720868999
.long 1041782409
.long 3992977408
.long 981531
.long 433316142
.long 1041994064
.long 1526726656
.long 1003638
.long 781232103
.long 1040093400
.long 2172649472
.long 1025985
.long 2773927732
.long 1053236707
.long 381774871
.long 1062650220
.long 379653899
.long 1056571845
.long 286331153
.long 1065423121
.long 436314138
.long 1059717536
.long 1431655765
.long 1067799893
.long 1431655765
.long 1069897045
.long 0
.long 1071644672
.long 0
.long 1072693248
.long 0
.long 2146435072
.long 0
.long 0
.long 4294967295
.long 2146435071
.long 0
.long 1048576
.long 4227858432
.long 4294967295
.type static_const_table,@object
.size static_const_table,1296
.data
.section .note.GNU-stack, ""
# End

828
libm/x86/s_log1p.S Normal file
View File

@ -0,0 +1,828 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Let x=2^k * mx, mx in [1,2)
//
// Get B~1/mx based on the output of rcpps instruction (B0)
// B = int((B0*2^7+0.5))/2^7
//
// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
//
// Result: k*log(2) - log(B) + p(r)
// p(r) is a degree 7 polynomial
// -log(B) read from data table (high, low parts)
// Result is formed from high and low parts
//
// Special cases:
// log1p(NaN) = quiet NaN, and raise invalid exception
// log1p(+INF) = that INF
// log1p(x) = NaN if x < -1 or x = -INF, and raises invalid exception
// log1p(-1) = -INF, and raises divide-by-zero exception
// log1p(+/-0) = +/-0
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin log1p
ENTRY(log1p)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $104, %esp
movl %ebx, 40(%esp)
call static_func
movl %eax, %ebx
movsd 112(%esp), %xmm0
xorpd %xmm2, %xmm2
movl $16368, %eax
pinsrw $3, %eax, %xmm2
xorpd %xmm3, %xmm3
movl $32768, %ecx
movd %ecx, %xmm4
movsd 2128(%ebx), %xmm5
pshufd $68, %xmm0, %xmm7
movapd %xmm2, %xmm6
pextrw $3, %xmm0, %ecx
addsd %xmm2, %xmm0
movapd %xmm0, %xmm1
pextrw $3, %xmm0, %eax
subsd %xmm0, %xmm6
orpd %xmm2, %xmm0
psllq $5, %xmm0
psrlq $34, %xmm0
subl $16, %eax
cmpl $32736, %eax
jae .L_2TAG_PACKET_0.0.2
addsd %xmm6, %xmm7
rcpss %xmm0, %xmm0
psllq $12, %xmm1
pshufd $228, %xmm5, %xmm6
psrlq $12, %xmm1
andl $32752, %ecx
cmpl $16256, %ecx
jb .L_2TAG_PACKET_1.0.2
andl $32752, %eax
movl $32720, %ecx
subl %eax, %ecx
pinsrw $3, %ecx, %xmm3
.L_2TAG_PACKET_2.0.2:
mulsd %xmm3, %xmm7
paddd %xmm4, %xmm0
xorpd %xmm4, %xmm4
movl $14336, %ecx
pinsrw $3, %ecx, %xmm4
orpd %xmm2, %xmm1
movd %xmm0, %edx
psllq $29, %xmm0
andpd %xmm1, %xmm5
andpd %xmm6, %xmm0
subsd %xmm5, %xmm1
paddd %xmm4, %xmm0
mulsd %xmm0, %xmm5
movl $16352, %ecx
subl %ecx, %eax
cvtsi2sdl %eax, %xmm4
mulsd %xmm0, %xmm7
mulsd %xmm0, %xmm1
movsd 2064(%ebx), %xmm6
movapd 2080(%ebx), %xmm3
subsd %xmm2, %xmm5
andl $16711680, %edx
shrl $12, %edx
movapd (%ebx,%edx), %xmm0
movapd 2096(%ebx), %xmm2
addsd %xmm5, %xmm1
movapd %xmm1, %xmm5
addsd %xmm7, %xmm1
subsd %xmm1, %xmm5
addsd %xmm5, %xmm7
mulsd %xmm4, %xmm6
mulsd 2072(%ebx), %xmm4
mulsd %xmm1, %xmm3
pshufd $68, %xmm1, %xmm5
addsd %xmm6, %xmm0
mulpd %xmm5, %xmm2
mulpd %xmm5, %xmm5
pshufd $228, %xmm0, %xmm6
addsd %xmm1, %xmm0
addpd 2112(%ebx), %xmm2
mulpd %xmm5, %xmm3
subsd %xmm0, %xmm6
mulsd %xmm1, %xmm2
addsd %xmm7, %xmm4
mulsd %xmm1, %xmm7
addsd %xmm6, %xmm1
pshufd $238, %xmm0, %xmm6
mulsd %xmm5, %xmm5
addsd %xmm6, %xmm4
subsd %xmm7, %xmm1
addpd %xmm3, %xmm2
addsd %xmm4, %xmm1
mulpd %xmm5, %xmm2
addsd %xmm2, %xmm1
pshufd $238, %xmm2, %xmm5
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_0.0.2:
movsd 112(%esp), %xmm0
movapd %xmm0, %xmm1
addl $16, %eax
cmpl $32768, %eax
jae .L_2TAG_PACKET_4.0.2
cmpl $0, %eax
je .L_2TAG_PACKET_5.0.2
.L_2TAG_PACKET_6.0.2:
addsd %xmm0, %xmm0
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_7.0.2:
ja .L_2TAG_PACKET_6.0.2
cmpl $0, %edx
ja .L_2TAG_PACKET_6.0.2
jmp .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_4.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
addl %ecx, %ecx
cmpl $-2097152, %ecx
jae .L_2TAG_PACKET_7.0.2
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_5.0.2
.L_2TAG_PACKET_8.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $32752, %eax
pinsrw $3, %eax, %xmm1
movl $141, %edx
mulsd %xmm1, %xmm0
.L_2TAG_PACKET_9.0.2:
movsd %xmm0, (%esp)
movsd 112(%esp), %xmm0
fldl (%esp)
jmp .L_2TAG_PACKET_10.0.2
.L_2TAG_PACKET_5.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
divsd %xmm1, %xmm0
movl $140, %edx
jmp .L_2TAG_PACKET_9.0.2
.L_2TAG_PACKET_1.0.2:
movsd 112(%esp), %xmm0
cmpl $15504, %ecx
jb .L_2TAG_PACKET_11.0.2
movapd 2144(%ebx), %xmm1
pshufd $68, %xmm0, %xmm0
movapd 2160(%ebx), %xmm2
pshufd $68, %xmm0, %xmm4
movapd 2176(%ebx), %xmm3
mulpd %xmm0, %xmm1
xorpd %xmm6, %xmm6
mulpd %xmm4, %xmm4
addpd %xmm2, %xmm1
pshufd $68, %xmm4, %xmm5
mulpd %xmm0, %xmm4
movl $49120, %eax
pinsrw $3, %eax, %xmm6
mulpd %xmm0, %xmm1
mulsd %xmm4, %xmm4
addpd %xmm3, %xmm1
mulsd %xmm6, %xmm5
mulpd %xmm4, %xmm1
pshufd $238, %xmm1, %xmm7
addsd %xmm7, %xmm1
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_11.0.2:
cmpl $16, %ecx
jb .L_2TAG_PACKET_12.0.2
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_12.0.2:
movapd %xmm0, %xmm1
mulsd %xmm1, %xmm1
jmp .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_3.0.2:
movsd %xmm0, 24(%esp)
fldl 24(%esp)
.L_2TAG_PACKET_10.0.2:
movl 40(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(log1p)
# -- End log1p
# Start file scope ASM
.weak log1pl
.equ log1pl, log1p
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 4277811200
.long 1072049730
.long 2479318832
.long 1026487127
.long 2854492160
.long 1072033410
.long 215631550
.long 1025638968
.long 1547061248
.long 1072017216
.long 2886781435
.long 1026423395
.long 649825280
.long 1072001146
.long 4281533405
.long 1024038923
.long 646346752
.long 1071985198
.long 1562735921
.long 1023790276
.long 2203734016
.long 1071969370
.long 1838397691
.long 3173936209
.long 1872169984
.long 1071953661
.long 3981202460
.long 1022325013
.long 669557760
.long 1071938069
.long 4182597802
.long 3173174122
.long 4076413952
.long 1071922591
.long 1209029111
.long 3170736207
.long 556125184
.long 1071907228
.long 821086028
.long 3173437049
.long 204914688
.long 1071891976
.long 2097025986
.long 3171071798
.long 387545088
.long 1071876834
.long 3142936996
.long 3173092218
.long 2912783360
.long 1071861800
.long 2502420140
.long 1024505919
.long 1144260608
.long 1071846874
.long 3315658140
.long 3173469843
.long 1471209472
.long 1071832053
.long 129621009
.long 3172443877
.long 1829683200
.long 1071817336
.long 3885467693
.long 1025535275
.long 288676864
.long 1071802722
.long 86139472
.long 3171639793
.long 3636378624
.long 1071788208
.long 1850238587
.long 1024654342
.long 1606817792
.long 1071773795
.long 3388899795
.long 3173675586
.long 1236164608
.long 1071759480
.long 3983599207
.long 1020046558
.long 1089616896
.long 1071745262
.long 4171974224
.long 1024773198
.long 4143093760
.long 1071731139
.long 2727587401
.long 3173965207
.long 600267776
.long 1071717112
.long 3147685042
.long 3173353031
.long 2249313280
.long 1071703177
.long 125835074
.long 1025255832
.long 3805303808
.long 1071689334
.long 2289991207
.long 1025460331
.long 87278592
.long 1071675583
.long 1106114045
.long 1025933602
.long 3195405312
.long 1071661920
.long 3885316576
.long 3171206239
.long 3853649920
.long 1071648346
.long 2977069852
.long 3171236771
.long 2944026624
.long 1071625048
.long 1008093493
.long 1023444474
.long 3993180160
.long 1071598247
.long 1862355595
.long 1024642533
.long 1454641152
.long 1071571617
.long 1514603089
.long 1026500596
.long 3286085632
.long 1071545154
.long 1400028424
.long 3173279056
.long 438773760
.long 1071518858
.long 120727864
.long 3172148914
.long 1212979200
.long 1071492725
.long 1625055594
.long 3172901933
.long 1189017600
.long 1071466754
.long 3920062376
.long 1025727407
.long 403064832
.long 1071440943
.long 1053271728
.long 3171391427
.long 3343210496
.long 1071415289
.long 3243395502
.long 3173627613
.long 1765777408
.long 1071389792
.long 2145968512
.long 1026354304
.long 461430784
.long 1071364449
.long 4094322285
.long 1026021467
.long 71706624
.long 1071339258
.long 763632021
.long 1024496933
.long 1380503552
.long 1071314217
.long 1383547992
.long 3173088453
.long 1015732224
.long 1071289325
.long 3198646877
.long 1025390322
.long 35977216
.long 1071264580
.long 2141026805
.long 1025754693
.long 3927306240
.long 1071239979
.long 282116272
.long 3173394334
.long 1125341184
.long 1071215523
.long 2768427504
.long 3172279059
.long 1666971648
.long 1071191208
.long 786837629
.long 3172427445
.long 2827694080
.long 1071167033
.long 3857122416
.long 3173014241
.long 2003683328
.long 1071142997
.long 859010954
.long 1026545007
.long 1004017664
.long 1071119098
.long 3356644970
.long 3173458064
.long 1753020416
.long 1071095334
.long 788338552
.long 1026157693
.long 1992718336
.long 1071071704
.long 1239179443
.long 1026394889
.long 3870234624
.long 1071048206
.long 2082614663
.long 1024926053
.long 1050437632
.long 1071024840
.long 660007840
.long 1025548499
.long 188395520
.long 1071001603
.long 3878792704
.long 3173889571
.long 3747176448
.long 1070978493
.long 144991708
.long 3171552042
.long 1405669376
.long 1070955511
.long 3999088879
.long 1025486317
.long 121151488
.long 1070932654
.long 2170865497
.long 1026473584
.long 2652319744
.long 1070909920
.long 453695652
.long 3173916809
.long 3262236672
.long 1070887309
.long 157800053
.long 3173984206
.long 601221120
.long 1070864820
.long 3968917661
.long 1023992886
.long 1999843328
.long 1070842450
.long 3053895004
.long 1024998228
.long 1992167424
.long 1070820199
.long 2968614856
.long 1024552653
.long 3788726272
.long 1070798065
.long 3542170808
.long 3173573242
.long 2094829568
.long 1070776048
.long 1246758132
.long 1026202874
.long 288675840
.long 1070754146
.long 3747328950
.long 1026331585
.long 1829681152
.long 1070732357
.long 3125197546
.long 1024100318
.long 1666869248
.long 1070710681
.long 1363656119
.long 1026336493
.long 3417110528
.long 1070689116
.long 4154791553
.long 1026267853
.long 2183653376
.long 1070667662
.long 1671819292
.long 3173785870
.long 1734434816
.long 1070646317
.long 373091049
.long 1025972363
.long 1615681536
.long 1070625080
.long 384650897
.long 1022926043
.long 1445382144
.long 1070603950
.long 344320330
.long 3172397196
.long 1823715328
.long 1070569756
.long 3389841200
.long 1025231852
.long 3839688704
.long 1070527917
.long 1706790417
.long 3167363349
.long 4293332992
.long 1070486286
.long 1614935088
.long 1019351591
.long 2966720512
.long 1070444861
.long 4145393717
.long 3173711658
.long 4066729984
.long 1070403639
.long 1974925028
.long 3171437182
.long 3337621504
.long 1070362619
.long 3314953170
.long 3169971314
.long 943448064
.long 1070321799
.long 1498682038
.long 3173862340
.long 1465634816
.long 1070281176
.long 1319952810
.long 3171693965
.long 1015734272
.long 1070240749
.long 1347821929
.long 3173544515
.long 118001664
.long 1070200516
.long 1751482746
.long 1026134093
.long 3707174912
.long 1070160474
.long 1486946159
.long 1023930920
.long 3946381312
.long 1070120623
.long 2867408081
.long 3171368276
.long 1699848192
.long 1070080961
.long 2590187139
.long 1025379803
.long 2235846656
.long 1070041485
.long 1888568069
.long 3172754960
.long 2339729408
.long 1070002194
.long 3852214753
.long 3173323149
.long 3196850176
.long 1069963086
.long 742141560
.long 1025101707
.long 1800683520
.long 1069924160
.long 3949500444
.long 3172102179
.long 3835801600
.long 1069885413
.long 3848895943
.long 1025913832
.long 2201202688
.long 1069846845
.long 1425913464
.long 1025868665
.long 2778279936
.long 1069808453
.long 2120889677
.long 3173831128
.long 2954203136
.long 1069770236
.long 592147081
.long 1019621288
.long 210141184
.long 1069732193
.long 3414275233
.long 1023647084
.long 709476352
.long 1069694321
.long 2413027164
.long 1024462115
.long 2116284416
.long 1069656619
.long 1144559924
.long 1026336654
.long 2183651328
.long 1069619086
.long 3459057650
.long 1025634168
.long 3047047168
.long 1069581720
.long 1879674924
.long 3173508573
.long 970711040
.long 1069541521
.long 1335954173
.long 3173332182
.long 2198478848
.long 1069467449
.long 2951103968
.long 3173892200
.long 1669611520
.long 1069393703
.long 531044147
.long 1025149248
.long 29114368
.long 1069320280
.long 3327831251
.long 1025918673
.long 2376949760
.long 1069247176
.long 737634533
.long 3172176000
.long 1085390848
.long 1069174390
.long 3108243400
.long 3171828406
.long 1566130176
.long 1069101918
.long 985483226
.long 1025708380
.long 792780800
.long 1069029758
.long 4184866295
.long 1024426204
.long 183156736
.long 1068957907
.long 2845699378
.long 1022107277
.long 1301782528
.long 1068886362
.long 1012735262
.long 3173804294
.long 1562411008
.long 1068815121
.long 2197086703
.long 3170187813
.long 2815549440
.long 1068744181
.long 2782613207
.long 1026345054
.long 2756124672
.long 1068673540
.long 2929486205
.long 3173037800
.long 3511050240
.long 1068603195
.long 1443733147
.long 3173331549
.long 3047047168
.long 1068533144
.long 1879674924
.long 3172459997
.long 3221667840
.long 1068427825
.long 1338588027
.long 3171815742
.long 3453861888
.long 1068288883
.long 1205348359
.long 3172624626
.long 3506110464
.long 1068150514
.long 893105198
.long 1025571866
.long 346013696
.long 1068012714
.long 3495569021
.long 3172563349
.long 4074029056
.long 1067875476
.long 3961106338
.long 3171065595
.long 3559784448
.long 1067738798
.long 1975385384
.long 3173783155
.long 797769728
.long 1067602675
.long 3760305787
.long 1026047642
.long 2313633792
.long 1067467101
.long 1559353171
.long 1023480256
.long 3960766464
.long 1067213778
.long 1067365107
.long 1025865926
.long 684261376
.long 1066944805
.long 844762164
.long 3173687482
.long 630718464
.long 1066676905
.long 2458269694
.long 1024033081
.long 1486061568
.long 1066410070
.long 115537874
.long 3173243995
.long 2743664640
.long 1065886792
.long 3665098304
.long 3173471607
.long 1971912704
.long 1065357333
.long 2577214440
.long 3171993451
.long 1498939392
.long 1064306693
.long 3409036923
.long 1025599151
.long 0
.long 0
.long 0
.long 2147483648
.long 4277811200
.long 1067855426
.long 2479318832
.long 1022292823
.long 2454267026
.long 1069697316
.long 0
.long 3218079744
.long 1030730101
.long 3217380702
.long 1431655765
.long 1070945621
.long 2576980378
.long 1070176665
.long 0
.long 3219128320
.long 0
.long 4294959104
.long 0
.long 4294959104
.long 0
.long 3217031168
.long 2576980378
.long 1070176665
.long 2454267026
.long 1069697316
.long 0
.long 3218079744
.long 1431655765
.long 3217380693
.long 1431655765
.long 1070945621
.type static_const_table,@object
.size static_const_table,2192
.data
.section .note.GNU-stack, ""
# End

908
libm/x86/s_sin.S Normal file
View File

@ -0,0 +1,908 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// 1. RANGE REDUCTION
//
// We perform an initial range reduction from X to r with
//
// X =~= N * pi/32 + r
//
// so that |r| <= pi/64 + epsilon. We restrict inputs to those
// where |N| <= 932560. Beyond this, the range reduction is
// insufficiently accurate. For extremely small inputs,
// denormalization can occur internally, impacting performance.
// This means that the main path is actually only taken for
// 2^-252 <= |X| < 90112.
//
// To avoid branches, we perform the range reduction to full
// accuracy each time.
//
// X - N * (P_1 + P_2 + P_3)
//
// where P_1 and P_2 are 32-bit numbers (so multiplication by N
// is exact) and P_3 is a 53-bit number. Together, these
// approximate pi well enough for all cases in the restricted
// range.
//
// The main reduction sequence is:
//
// y = 32/pi * x
// N = integer(y)
// (computed by adding and subtracting off SHIFTER)
//
// m_1 = N * P_1
// m_2 = N * P_2
// r_1 = x - m_1
// r = r_1 - m_2
// (this r can be used for most of the calculation)
//
// c_1 = r_1 - r
// m_3 = N * P_3
// c_2 = c_1 - m_2
// c = c_2 - m_3
//
// 2. MAIN ALGORITHM
//
// The algorithm uses a table lookup based on B = M * pi / 32
// where M = N mod 64. The stored values are:
// sigma closest power of 2 to cos(B)
// C_hl 53-bit cos(B) - sigma
// S_hi + S_lo 2 * 53-bit sin(B)
//
// The computation is organized as follows:
//
// sin(B + r + c) = [sin(B) + sigma * r] +
// r * (cos(B) - sigma) +
// sin(B) * [cos(r + c) - 1] +
// cos(B) * [sin(r + c) - r]
//
// which is approximately:
//
// [S_hi + sigma * r] +
// C_hl * r +
// S_lo + S_hi * [(cos(r) - 1) - r * c] +
// (C_hl + sigma) * [(sin(r) - r) + c]
//
// and this is what is actually computed. We separate this sum
// into four parts:
//
// hi + med + pols + corr
//
// where
//
// hi = S_hi + sigma r
// med = C_hl * r
// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r)
// corr = S_lo + c * ((C_hl + sigma) - S_hi * r)
//
// 3. POLYNOMIAL
//
// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) *
// (sin(r) - r) can be rearranged freely, since it is quite
// small, so we exploit parallelism to the fullest.
//
// psc4 = SC_4 * r_1
// msc4 = psc4 * r
// r2 = r * r
// msc2 = SC_2 * r2
// r4 = r2 * r2
// psc3 = SC_3 + msc4
// psc1 = SC_1 + msc2
// msc3 = r4 * psc3
// sincospols = psc1 + msc3
// pols = sincospols *
// <S_hi * r^2 | (C_hl + sigma) * r^3>
//
// 4. CORRECTION TERM
//
// This is where the "c" component of the range reduction is
// taken into account; recall that just "r" is used for most of
// the calculation.
//
// -c = m_3 - c_2
// -d = S_hi * r - (C_hl + sigma)
// corr = -c * -d + S_lo
//
// 5. COMPENSATED SUMMATIONS
//
// The two successive compensated summations add up the high
// and medium parts, leaving just the low parts to add up at
// the end.
//
// rs = sigma * r
// res_int = S_hi + rs
// k_0 = S_hi - res_int
// k_2 = k_0 + rs
// med = C_hl * r
// res_hi = res_int + med
// k_1 = res_int - res_hi
// k_3 = k_1 + med
//
// 6. FINAL SUMMATION
//
// We now add up all the small parts:
//
// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3
//
// Now the overall result is just:
//
// res_hi + res_lo
//
// 7. SMALL ARGUMENTS
//
// If |x| < SNN (SNN meaning the smallest normal number), we
// simply perform 0.1111111 cdots 1111 * x. For SNN <= |x|, we
// do 2^-55 * (2^55 * x - x).
//
// Special cases:
// sin(NaN) = quiet NaN, and raise invalid exception
// sin(INF) = NaN and raise invalid exception
// sin(+/-0) = +/-0
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin static_func
.text
.align __bionic_asm_align
.type static_func, @function
static_func:
..B1.1:
call ..L2
..L2:
popl %eax
lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax
lea static_const_table@GOTOFF(%eax), %eax
ret
.size static_func,.-static_func
# -- End static_func
# -- Begin sin
ENTRY(sin)
# parameter 1: 8 + %ebp
..B2.1:
..B2.2:
pushl %ebp
movl %esp, %ebp
subl $120, %esp
movl %ebx, 56(%esp)
call static_func
movl %eax, %ebx
movsd 128(%esp), %xmm0
pextrw $3, %xmm0, %eax
andl $32767, %eax
subl $12336, %eax
cmpl $4293, %eax
ja .L_2TAG_PACKET_0.0.2
movsd 2160(%ebx), %xmm1
mulsd %xmm0, %xmm1
movsd 2272(%ebx), %xmm5
movapd 2256(%ebx), %xmm4
andpd %xmm0, %xmm4
orps %xmm4, %xmm5
movsd 2128(%ebx), %xmm3
movapd 2112(%ebx), %xmm2
addpd %xmm5, %xmm1
cvttsd2si %xmm1, %edx
cvtsi2sdl %edx, %xmm1
mulsd %xmm1, %xmm3
unpcklpd %xmm1, %xmm1
addl $1865216, %edx
movapd %xmm0, %xmm4
andl $63, %edx
movapd 2096(%ebx), %xmm5
lea (%ebx), %eax
shll $5, %edx
addl %edx, %eax
mulpd %xmm1, %xmm2
subsd %xmm3, %xmm0
mulsd 2144(%ebx), %xmm1
subsd %xmm3, %xmm4
movsd 8(%eax), %xmm7
unpcklpd %xmm0, %xmm0
movapd %xmm4, %xmm3
subsd %xmm2, %xmm4
mulpd %xmm0, %xmm5
subpd %xmm2, %xmm0
movapd 2064(%ebx), %xmm6
mulsd %xmm4, %xmm7
subsd %xmm4, %xmm3
mulpd %xmm0, %xmm5
mulpd %xmm0, %xmm0
subsd %xmm2, %xmm3
movapd (%eax), %xmm2
subsd %xmm3, %xmm1
movsd 24(%eax), %xmm3
addsd %xmm3, %xmm2
subsd %xmm2, %xmm7
mulsd %xmm4, %xmm2
mulpd %xmm0, %xmm6
mulsd %xmm4, %xmm3
mulpd %xmm0, %xmm2
mulpd %xmm0, %xmm0
addpd 2080(%ebx), %xmm5
mulsd (%eax), %xmm4
addpd 2048(%ebx), %xmm6
mulpd %xmm0, %xmm5
movapd %xmm3, %xmm0
addsd 8(%eax), %xmm3
mulpd %xmm7, %xmm1
movapd %xmm4, %xmm7
addsd %xmm3, %xmm4
addpd %xmm5, %xmm6
movsd 8(%eax), %xmm5
subsd %xmm3, %xmm5
subsd %xmm4, %xmm3
addsd 16(%eax), %xmm1
mulpd %xmm2, %xmm6
addsd %xmm0, %xmm5
addsd %xmm7, %xmm3
addsd %xmm5, %xmm1
addsd %xmm3, %xmm1
addsd %xmm6, %xmm1
unpckhpd %xmm6, %xmm6
addsd %xmm6, %xmm1
addsd %xmm1, %xmm4
movsd %xmm4, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_0.0.2:
jg .L_2TAG_PACKET_2.0.2
shrl $4, %eax
cmpl $268434685, %eax
jne .L_2TAG_PACKET_3.0.2
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_3.0.2:
movsd 2192(%ebx), %xmm3
mulsd %xmm0, %xmm3
subsd %xmm0, %xmm3
mulsd 2208(%ebx), %xmm3
movsd %xmm0, (%esp)
fldl (%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_2.0.2:
movl 132(%esp), %eax
andl $2146435072, %eax
cmpl $2146435072, %eax
je .L_2TAG_PACKET_4.0.2
subl $32, %esp
movsd %xmm0, (%esp)
lea 40(%esp), %eax
movl %eax, 8(%esp)
movl $2, %eax
movl %eax, 12(%esp)
call __libm_sincos_huge
addl $32, %esp
fldl 16(%esp)
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_4.0.2:
fldl 128(%esp)
fmull 2240(%ebx)
.L_2TAG_PACKET_1.0.2:
movl 56(%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
..B2.3:
END(sin)
# -- End sin
# Start file scope ASM
.weak sinl
.equ sinl, sin
# End file scope ASM
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 1072693248
.long 393047345
.long 3212032302
.long 3156849708
.long 1069094822
.long 3758096384
.long 3158189848
.long 0
.long 1072693248
.long 18115067
.long 3214126342
.long 1013556747
.long 1070135480
.long 3221225472
.long 3160567065
.long 0
.long 1072693248
.long 2476548698
.long 3215330282
.long 785751814
.long 1070765062
.long 2684354560
.long 3161838221
.long 0
.long 1072693248
.long 2255197647
.long 3216211105
.long 2796464483
.long 1071152610
.long 3758096384
.long 3160878317
.long 0
.long 1072693248
.long 1945768569
.long 3216915048
.long 939980347
.long 1071524701
.long 536870912
.long 1012796809
.long 0
.long 1072693248
.long 1539668340
.long 3217396327
.long 967731400
.long 1071761211
.long 536870912
.long 1015752157
.long 0
.long 1072693248
.long 1403757309
.long 3217886718
.long 621354454
.long 1071926515
.long 536870912
.long 1013450602
.long 0
.long 1072693248
.long 2583490354
.long 1070236281
.long 1719614413
.long 1072079006
.long 536870912
.long 3163282740
.long 0
.long 1071644672
.long 2485417816
.long 1069626316
.long 1796544321
.long 1072217216
.long 536870912
.long 3162686945
.long 0
.long 1071644672
.long 2598800519
.long 1068266419
.long 688824739
.long 1072339814
.long 3758096384
.long 1010431536
.long 0
.long 1071644672
.long 2140183630
.long 3214756396
.long 4051746225
.long 1072445618
.long 2147483648
.long 3161907377
.long 0
.long 1071644672
.long 1699043957
.long 3216902261
.long 3476196678
.long 1072533611
.long 536870912
.long 1014257638
.long 0
.long 1071644672
.long 1991047213
.long 1067753521
.long 1455828442
.long 1072602945
.long 3758096384
.long 1015505073
.long 0
.long 1070596096
.long 240740309
.long 3215727903
.long 3489094832
.long 1072652951
.long 536870912
.long 1014325783
.long 0
.long 1070596096
.long 257503056
.long 3214647653
.long 2748392742
.long 1072683149
.long 1073741824
.long 3163061750
.long 0
.long 1069547520
.long 0
.long 0
.long 0
.long 1072693248
.long 0
.long 0
.long 0
.long 0
.long 257503056
.long 1067164005
.long 2748392742
.long 1072683149
.long 1073741824
.long 3163061750
.long 0
.long 3217031168
.long 240740309
.long 1068244255
.long 3489094832
.long 1072652951
.long 536870912
.long 1014325783
.long 0
.long 3218079744
.long 1991047213
.long 3215237169
.long 1455828442
.long 1072602945
.long 3758096384
.long 1015505073
.long 0
.long 3218079744
.long 1699043957
.long 1069418613
.long 3476196678
.long 1072533611
.long 536870912
.long 1014257638
.long 0
.long 3219128320
.long 2140183630
.long 1067272748
.long 4051746225
.long 1072445618
.long 2147483648
.long 3161907377
.long 0
.long 3219128320
.long 2598800519
.long 3215750067
.long 688824739
.long 1072339814
.long 3758096384
.long 1010431536
.long 0
.long 3219128320
.long 2485417816
.long 3217109964
.long 1796544321
.long 1072217216
.long 536870912
.long 3162686945
.long 0
.long 3219128320
.long 2583490354
.long 3217719929
.long 1719614413
.long 1072079006
.long 536870912
.long 3163282740
.long 0
.long 3219128320
.long 1403757309
.long 1070403070
.long 621354454
.long 1071926515
.long 536870912
.long 1013450602
.long 0
.long 3220176896
.long 1539668340
.long 1069912679
.long 967731400
.long 1071761211
.long 536870912
.long 1015752157
.long 0
.long 3220176896
.long 1945768569
.long 1069431400
.long 939980347
.long 1071524701
.long 536870912
.long 1012796809
.long 0
.long 3220176896
.long 2255197647
.long 1068727457
.long 2796464483
.long 1071152610
.long 3758096384
.long 3160878317
.long 0
.long 3220176896
.long 2476548698
.long 1067846634
.long 785751814
.long 1070765062
.long 2684354560
.long 3161838221
.long 0
.long 3220176896
.long 18115067
.long 1066642694
.long 1013556747
.long 1070135480
.long 3221225472
.long 3160567065
.long 0
.long 3220176896
.long 393047345
.long 1064548654
.long 3156849708
.long 1069094822
.long 3758096384
.long 3158189848
.long 0
.long 3220176896
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 3220176896
.long 393047345
.long 1064548654
.long 3156849708
.long 3216578470
.long 3758096384
.long 1010706200
.long 0
.long 3220176896
.long 18115067
.long 1066642694
.long 1013556747
.long 3217619128
.long 3221225472
.long 1013083417
.long 0
.long 3220176896
.long 2476548698
.long 1067846634
.long 785751814
.long 3218248710
.long 2684354560
.long 1014354573
.long 0
.long 3220176896
.long 2255197647
.long 1068727457
.long 2796464483
.long 3218636258
.long 3758096384
.long 1013394669
.long 0
.long 3220176896
.long 1945768569
.long 1069431400
.long 939980347
.long 3219008349
.long 536870912
.long 3160280457
.long 0
.long 3220176896
.long 1539668340
.long 1069912679
.long 967731400
.long 3219244859
.long 536870912
.long 3163235805
.long 0
.long 3220176896
.long 1403757309
.long 1070403070
.long 621354454
.long 3219410163
.long 536870912
.long 3160934250
.long 0
.long 3220176896
.long 2583490354
.long 3217719929
.long 1719614413
.long 3219562654
.long 536870912
.long 1015799092
.long 0
.long 3219128320
.long 2485417816
.long 3217109964
.long 1796544321
.long 3219700864
.long 536870912
.long 1015203297
.long 0
.long 3219128320
.long 2598800519
.long 3215750067
.long 688824739
.long 3219823462
.long 3758096384
.long 3157915184
.long 0
.long 3219128320
.long 2140183630
.long 1067272748
.long 4051746225
.long 3219929266
.long 2147483648
.long 1014423729
.long 0
.long 3219128320
.long 1699043957
.long 1069418613
.long 3476196678
.long 3220017259
.long 536870912
.long 3161741286
.long 0
.long 3219128320
.long 1991047213
.long 3215237169
.long 1455828442
.long 3220086593
.long 3758096384
.long 3162988721
.long 0
.long 3218079744
.long 240740309
.long 1068244255
.long 3489094832
.long 3220136599
.long 536870912
.long 3161809431
.long 0
.long 3218079744
.long 257503056
.long 1067164005
.long 2748392742
.long 3220166797
.long 1073741824
.long 1015578102
.long 0
.long 3217031168
.long 0
.long 0
.long 0
.long 3220176896
.long 0
.long 0
.long 0
.long 0
.long 257503056
.long 3214647653
.long 2748392742
.long 3220166797
.long 1073741824
.long 1015578102
.long 0
.long 1069547520
.long 240740309
.long 3215727903
.long 3489094832
.long 3220136599
.long 536870912
.long 3161809431
.long 0
.long 1070596096
.long 1991047213
.long 1067753521
.long 1455828442
.long 3220086593
.long 3758096384
.long 3162988721
.long 0
.long 1070596096
.long 1699043957
.long 3216902261
.long 3476196678
.long 3220017259
.long 536870912
.long 3161741286
.long 0
.long 1071644672
.long 2140183630
.long 3214756396
.long 4051746225
.long 3219929266
.long 2147483648
.long 1014423729
.long 0
.long 1071644672
.long 2598800519
.long 1068266419
.long 688824739
.long 3219823462
.long 3758096384
.long 3157915184
.long 0
.long 1071644672
.long 2485417816
.long 1069626316
.long 1796544321
.long 3219700864
.long 536870912
.long 1015203297
.long 0
.long 1071644672
.long 2583490354
.long 1070236281
.long 1719614413
.long 3219562654
.long 536870912
.long 1015799092
.long 0
.long 1071644672
.long 1403757309
.long 3217886718
.long 621354454
.long 3219410163
.long 536870912
.long 3160934250
.long 0
.long 1072693248
.long 1539668340
.long 3217396327
.long 967731400
.long 3219244859
.long 536870912
.long 3163235805
.long 0
.long 1072693248
.long 1945768569
.long 3216915048
.long 939980347
.long 3219008349
.long 536870912
.long 3160280457
.long 0
.long 1072693248
.long 2255197647
.long 3216211105
.long 2796464483
.long 3218636258
.long 3758096384
.long 1013394669
.long 0
.long 1072693248
.long 2476548698
.long 3215330282
.long 785751814
.long 3218248710
.long 2684354560
.long 1014354573
.long 0
.long 1072693248
.long 18115067
.long 3214126342
.long 1013556747
.long 3217619128
.long 3221225472
.long 1013083417
.long 0
.long 1072693248
.long 393047345
.long 3212032302
.long 3156849708
.long 3216578470
.long 3758096384
.long 1010706200
.long 0
.long 1072693248
.long 1431655765
.long 3217380693
.long 0
.long 3219128320
.long 286331153
.long 1065423121
.long 1431655765
.long 1067799893
.long 436314138
.long 3207201184
.long 381774871
.long 3210133868
.long 2773927732
.long 1053236707
.long 436314138
.long 1056571808
.long 442499072
.long 1032893537
.long 442499072
.long 1032893537
.long 1413480448
.long 1069097467
.long 0
.long 0
.long 771977331
.long 996350346
.long 0
.long 0
.long 1841940611
.long 1076125488
.long 0
.long 0
.long 0
.long 1127743488
.long 0
.long 0
.long 0
.long 1130364928
.long 0
.long 0
.long 0
.long 1015021568
.long 0
.long 0
.long 4294967295
.long 1072693247
.long 0
.long 0
.long 0
.long 2147483648
.long 0
.long 0
.long 0
.long 2147483648
.long 0
.long 2147483648
.long 0
.long 1071644672
.long 0
.long 1071644672
.type static_const_table,@object
.size static_const_table,2288
.data
.hidden __libm_sincos_huge
.section .note.GNU-stack, ""
# End

1767
libm/x86/s_tan.S Normal file

File diff suppressed because it is too large Load Diff

1362
libm/x86/s_tanh.S Normal file

File diff suppressed because it is too large Load Diff

1957
libm/x86_64/e_acos.S Normal file

File diff suppressed because it is too large Load Diff

2036
libm/x86_64/e_asin.S Normal file

File diff suppressed because it is too large Load Diff

1242
libm/x86_64/e_atan2.S Normal file

File diff suppressed because it is too large Load Diff

1372
libm/x86_64/e_cosh.S Normal file

File diff suppressed because it is too large Load Diff

636
libm/x86_64/e_exp.S Normal file
View File

@ -0,0 +1,636 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Description:
// Let K = 64 (table size).
// x x/log(2) n
// e = 2 = 2 * T[j] * (1 + P(y))
// where
// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K]
// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2]
// j/K
// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
//
// P(y) is a minimax polynomial approximation of exp(x)-1
// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
//
// To avoid problems with arithmetic overflow and underflow,
// n n1 n2
// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
// where BIAS is a value of exponent bias.
//
// Special cases:
// exp(NaN) = NaN
// exp(+INF) = +INF
// exp(-INF) = 0
// exp(x) = 1 for subnormals
// for finite argument, only exp(0)=1 is exact
// For IEEE double
// if x > 709.782712893383973096 then exp(x) overflow
// if x < -745.133219101941108420 then exp(x) underflow
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin exp
ENTRY(exp)
# parameter 1: %xmm0
..B1.1:
..___tag_value_exp.1:
subq $24, %rsp
..___tag_value_exp.3:
movsd %xmm0, 8(%rsp)
..B1.2:
unpcklpd %xmm0, %xmm0
movapd cv(%rip), %xmm1
movapd Shifter(%rip), %xmm6
movapd 16+cv(%rip), %xmm2
movapd 32+cv(%rip), %xmm3
pextrw $3, %xmm0, %eax
andl $32767, %eax
movl $16527, %edx
subl %eax, %edx
subl $15504, %eax
orl %eax, %edx
cmpl $-2147483648, %edx
jae .L_2TAG_PACKET_0.0.2
mulpd %xmm0, %xmm1
addpd %xmm6, %xmm1
movapd %xmm1, %xmm7
subpd %xmm6, %xmm1
mulpd %xmm1, %xmm2
movapd 64+cv(%rip), %xmm4
mulpd %xmm1, %xmm3
movapd 80+cv(%rip), %xmm5
subpd %xmm2, %xmm0
movd %xmm7, %eax
movl %eax, %ecx
andl $63, %ecx
shll $4, %ecx
sarl $6, %eax
movl %eax, %edx
movdqa mmask(%rip), %xmm6
pand %xmm6, %xmm7
movdqa bias(%rip), %xmm6
paddq %xmm6, %xmm7
psllq $46, %xmm7
subpd %xmm3, %xmm0
lea Tbl_addr(%rip), %r8
movapd (%rcx,%r8), %xmm2
mulpd %xmm0, %xmm4
movapd %xmm0, %xmm6
movapd %xmm0, %xmm1
mulpd %xmm6, %xmm6
mulpd %xmm6, %xmm0
addpd %xmm4, %xmm5
mulsd %xmm6, %xmm0
mulpd 48+cv(%rip), %xmm6
addsd %xmm2, %xmm1
unpckhpd %xmm2, %xmm2
mulpd %xmm5, %xmm0
addsd %xmm0, %xmm1
orpd %xmm7, %xmm2
unpckhpd %xmm0, %xmm0
addsd %xmm1, %xmm0
addsd %xmm6, %xmm0
addl $894, %edx
cmpl $1916, %edx
ja .L_2TAG_PACKET_1.0.2
mulsd %xmm2, %xmm0
addsd %xmm2, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_1.0.2:
xorpd %xmm3, %xmm3
movapd ALLONES(%rip), %xmm4
movl $-1022, %edx
subl %eax, %edx
movd %edx, %xmm5
psllq %xmm5, %xmm4
movl %eax, %ecx
sarl $1, %eax
pinsrw $3, %eax, %xmm3
movapd ebias(%rip), %xmm6
psllq $4, %xmm3
psubd %xmm3, %xmm2
mulsd %xmm2, %xmm0
cmpl $52, %edx
jg .L_2TAG_PACKET_2.0.2
andpd %xmm2, %xmm4
paddd %xmm6, %xmm3
subsd %xmm4, %xmm2
addsd %xmm2, %xmm0
cmpl $1023, %ecx
jge .L_2TAG_PACKET_3.0.2
pextrw $3, %xmm0, %ecx
andl $32768, %ecx
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_4.0.2
movapd %xmm0, %xmm6
addsd %xmm4, %xmm0
mulsd %xmm3, %xmm0
pextrw $3, %xmm0, %ecx
andl $32752, %ecx
cmpl $0, %ecx
je .L_2TAG_PACKET_5.0.2
jmp ..B1.5
.L_2TAG_PACKET_5.0.2:
mulsd %xmm3, %xmm6
mulsd %xmm3, %xmm4
movq %xmm6, %xmm0
pxor %xmm4, %xmm6
psrad $31, %xmm6
pshufd $85, %xmm6, %xmm6
psllq $1, %xmm0
psrlq $1, %xmm0
pxor %xmm6, %xmm0
psrlq $63, %xmm6
paddq %xmm6, %xmm0
paddq %xmm4, %xmm0
movl $15, (%rsp)
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_4.0.2:
addsd %xmm4, %xmm0
mulsd %xmm3, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_3.0.2:
addsd %xmm4, %xmm0
mulsd %xmm3, %xmm0
pextrw $3, %xmm0, %ecx
andl $32752, %ecx
cmpl $32752, %ecx
jnb .L_2TAG_PACKET_7.0.2
jmp ..B1.5
.L_2TAG_PACKET_2.0.2:
paddd %xmm6, %xmm3
addpd %xmm2, %xmm0
mulsd %xmm3, %xmm0
movl $15, (%rsp)
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_8.0.2:
cmpl $2146435072, %eax
jae .L_2TAG_PACKET_9.0.2
movl 12(%rsp), %eax
cmpl $-2147483648, %eax
jae .L_2TAG_PACKET_10.0.2
movsd XMAX(%rip), %xmm0
mulsd %xmm0, %xmm0
.L_2TAG_PACKET_7.0.2:
movl $14, (%rsp)
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_10.0.2:
movsd XMIN(%rip), %xmm0
mulsd %xmm0, %xmm0
movl $15, (%rsp)
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_9.0.2:
movl 8(%rsp), %edx
cmpl $2146435072, %eax
ja .L_2TAG_PACKET_11.0.2
cmpl $0, %edx
jne .L_2TAG_PACKET_11.0.2
movl 12(%rsp), %eax
cmpl $2146435072, %eax
jne .L_2TAG_PACKET_12.0.2
movsd INF(%rip), %xmm0
jmp ..B1.5
.L_2TAG_PACKET_12.0.2:
movsd ZERO(%rip), %xmm0
jmp ..B1.5
.L_2TAG_PACKET_11.0.2:
movsd 8(%rsp), %xmm0
addsd %xmm0, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_0.0.2:
movl 12(%rsp), %eax
andl $2147483647, %eax
cmpl $1083179008, %eax
jae .L_2TAG_PACKET_8.0.2
movsd 8(%rsp), %xmm0
addsd ONE_val(%rip), %xmm0
jmp ..B1.5
.L_2TAG_PACKET_6.0.2:
movq %xmm0, 16(%rsp)
..B1.3:
movq 16(%rsp), %xmm0
.L_2TAG_PACKET_13.0.2:
..B1.5:
addq $24, %rsp
..___tag_value_exp.4:
ret
..___tag_value_exp.5:
END(exp)
# -- End exp
.section .rodata, "a"
.align 16
.align 16
cv:
.long 1697350398
.long 1079448903
.long 1697350398
.long 1079448903
.long 4277796864
.long 1065758274
.long 4277796864
.long 1065758274
.long 3164486458
.long 1025308570
.long 3164486458
.long 1025308570
.long 4294967294
.long 1071644671
.long 4294967294
.long 1071644671
.long 3811088480
.long 1062650204
.long 1432067621
.long 1067799893
.long 3230715663
.long 1065423125
.long 1431604129
.long 1069897045
.type cv,@object
.size cv,96
.align 16
Shifter:
.long 0
.long 1127743488
.long 0
.long 1127743488
.type Shifter,@object
.size Shifter,16
.align 16
mmask:
.long 4294967232
.long 0
.long 4294967232
.long 0
.type mmask,@object
.size mmask,16
.align 16
bias:
.long 65472
.long 0
.long 65472
.long 0
.type bias,@object
.size bias,16
.align 16
Tbl_addr:
.long 0
.long 0
.long 0
.long 0
.long 235107661
.long 1018002367
.long 1048019040
.long 11418
.long 896005651
.long 1015861842
.long 3541402996
.long 22960
.long 1642514529
.long 1012987726
.long 410360776
.long 34629
.long 1568897900
.long 1016568486
.long 1828292879
.long 46424
.long 1882168529
.long 1010744893
.long 852742562
.long 58348
.long 509852888
.long 1017336174
.long 3490863952
.long 70401
.long 653277307
.long 1017431380
.long 2930322911
.long 82586
.long 1649557430
.long 1017729363
.long 1014845818
.long 94904
.long 1058231231
.long 1015777676
.long 3949972341
.long 107355
.long 1044000607
.long 1016786167
.long 828946858
.long 119943
.long 1151779725
.long 1015705409
.long 2288159958
.long 132667
.long 3819481236
.long 1016499965
.long 1853186616
.long 145530
.long 2552227826
.long 1015039787
.long 1709341917
.long 158533
.long 1829350193
.long 1015216097
.long 4112506593
.long 171677
.long 1913391795
.long 1015756674
.long 2799960843
.long 184965
.long 1303423926
.long 1015238005
.long 171030293
.long 198398
.long 1574172746
.long 1016061241
.long 2992903935
.long 211976
.long 3424156969
.long 1017196428
.long 926591434
.long 225703
.long 1938513547
.long 1017631273
.long 887463926
.long 239579
.long 2804567149
.long 1015390024
.long 1276261410
.long 253606
.long 631083525
.long 1017690182
.long 569847337
.long 267786
.long 1623370770
.long 1011049453
.long 1617004845
.long 282120
.long 3667985273
.long 1013894369
.long 3049340112
.long 296610
.long 3145379760
.long 1014403278
.long 3577096743
.long 311258
.long 2603100681
.long 1017152460
.long 1990012070
.long 326066
.long 3249202951
.long 1017448880
.long 1453150081
.long 341035
.long 419288974
.long 1016280325
.long 917841882
.long 356167
.long 3793507337
.long 1016095713
.long 3712504873
.long 371463
.long 728023093
.long 1016345318
.long 363667784
.long 386927
.long 2582678538
.long 1017123460
.long 2956612996
.long 402558
.long 7592966
.long 1016721543
.long 2186617380
.long 418360
.long 228611441
.long 1016696141
.long 1719614412
.long 434334
.long 2261665670
.long 1017457593
.long 1013258798
.long 450482
.long 544148907
.long 1017323666
.long 3907805043
.long 466805
.long 2383914918
.long 1017143586
.long 1447192520
.long 483307
.long 1176412038
.long 1017267372
.long 1944781190
.long 499988
.long 2882956373
.long 1013312481
.long 919555682
.long 516851
.long 3154077648
.long 1016528543
.long 2571947538
.long 533897
.long 348651999
.long 1016405780
.long 2604962540
.long 551129
.long 3253791412
.long 1015920431
.long 1110089947
.long 568549
.long 1509121860
.long 1014756995
.long 2568320822
.long 586158
.long 2617649212
.long 1017340090
.long 2966275556
.long 603959
.long 553214634
.long 1016457425
.long 2682146383
.long 621954
.long 730975783
.long 1014083580
.long 2191782032
.long 640145
.long 1486499517
.long 1016818996
.long 2069751140
.long 658534
.long 2595788928
.long 1016407932
.long 2990417244
.long 677123
.long 1853053619
.long 1015310724
.long 1434058175
.long 695915
.long 2462790535
.long 1015814775
.long 2572866477
.long 714911
.long 3693944214
.long 1017259110
.long 3092190714
.long 734114
.long 2979333550
.long 1017188654
.long 4076559942
.long 753526
.long 174054861
.long 1014300631
.long 2420883922
.long 773150
.long 816778419
.long 1014197934
.long 3716502172
.long 792987
.long 3507050924
.long 1015341199
.long 777507147
.long 813041
.long 1821514088
.long 1013410604
.long 3706687593
.long 833312
.long 920623539
.long 1016295433
.long 1242007931
.long 853805
.long 2789017511
.long 1014276997
.long 3707479175
.long 874520
.long 3586233004
.long 1015962192
.long 64696965
.long 895462
.long 474650514
.long 1016642419
.long 863738718
.long 916631
.long 1614448851
.long 1014281732
.long 3884662774
.long 938030
.long 2450082086
.long 1016164135
.long 2728693977
.long 959663
.long 1101668360
.long 1015989180
.long 3999357479
.long 981531
.long 835814894
.long 1015702697
.long 1533953344
.long 1003638
.long 1301400989
.long 1014466875
.long 2174652632
.long 1025985
.type Tbl_addr,@object
.size Tbl_addr,1024
.align 16
ALLONES:
.long 4294967295
.long 4294967295
.long 4294967295
.long 4294967295
.type ALLONES,@object
.size ALLONES,16
.align 16
ebias:
.long 0
.long 1072693248
.long 0
.long 1072693248
.type ebias,@object
.size ebias,16
.align 4
XMAX:
.long 4294967295
.long 2146435071
.type XMAX,@object
.size XMAX,8
.align 4
XMIN:
.long 0
.long 1048576
.type XMIN,@object
.size XMIN,8
.align 4
INF:
.long 0
.long 2146435072
.type INF,@object
.size INF,8
.align 4
ZERO:
.long 0
.long 0
.type ZERO,@object
.size ZERO,8
.align 4
ONE_val:
.long 0
.long 1072693248
.type ONE_val,@object
.size ONE_val,8
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x0000001c
.4byte 0x0000001c
.4byte ..___tag_value_exp.1-.
.4byte ..___tag_value_exp.5-..___tag_value_exp.1
.2byte 0x0400
.4byte ..___tag_value_exp.3-..___tag_value_exp.1
.2byte 0x200e
.byte 0x04
.4byte ..___tag_value_exp.4-..___tag_value_exp.3
.2byte 0x080e
.byte 0x00
# End

210
libm/x86_64/e_hypot.S Normal file
View File

@ -0,0 +1,210 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// X87 version:
// Use 80-bit FPU precision fmul, fsqrt to compute square and sqrt.
//
// SSE version:
// Swap x, y if |x|<|y|
// For x=2^k*x, get y=y*2^(-k)
// Get S ~ sqrt(x^2+y^2) (leading 1 + leading 25 mantissa bits)
//
// Get D = ( RN(x^2+y^2) - S^2 ) + ( x^2 - RN(x^2) ) +
// + ( y^2 - ((RN(x^2+y^2)-RN(x^2)) )
//
// Result is 2^k*(S + Se), where Se = S*e
// S*e is approximated as (D/2S)*( 1 - (D/2S)^2*1.0/S )
//
// Return 2^k*(S+Se)
//
// For |y/x|<2^(-64), return x
//
// For cases where maximum biased exponent is either greater than 7fdh or
// below 32, take a special path to check for special cases (0, NaN, Inf),
// possible overflow, and more accurate computation for denormal results
//
// Special cases:
// hypot(x,y), hypot(y,x), and hypot(x,-y) are equivalent
// hypot(x,+-0) is equivalent to fabs(x)
// hypot(x,y) = y if (x==NaN or x==INF) and y==INF
// hypot(x,y) = x if (x==NaN or x==INF) and y!=INF (even if y==NaN!)
// hypot(x,y) = y if (x!=NaN and x!=INF) and (y==NaN or y==INF)
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin hypot
ENTRY(hypot)
# parameter 1: %xmm0
# parameter 2: %xmm1
..B1.1:
..___tag_value_hypot.1:
..___tag_value_hypot.3:
..B1.2:
subq $64, %rsp
movapd static_const_table(%rip), %xmm3
movsd %xmm0, 48(%rsp)
movsd %xmm1, 56(%rsp)
andpd %xmm3, %xmm0
andpd %xmm3, %xmm1
pextrw $3, %xmm0, %eax
pextrw $3, %xmm1, %edx
cmpl $24528, %eax
ja .L_2TAG_PACKET_0.0.1
cmpl $24528, %edx
ja .L_2TAG_PACKET_0.0.1
.L_2TAG_PACKET_1.0.1:
fldl 48(%rsp)
fldl 56(%rsp)
fxch %st(1)
fmul %st(0), %st
fxch %st(1)
nop
fmul %st(0), %st
faddp %st, %st(1)
fsqrt
jmp .L_2TAG_PACKET_2.0.1
.L_2TAG_PACKET_0.0.1:
cmpl $32752, %eax
movl %eax, %ecx
jae .L_2TAG_PACKET_3.0.1
subl %edx, %ecx
cmpl $32752, %edx
jae .L_2TAG_PACKET_3.0.1
addl $928, %ecx
addl %edx, %eax
cmpl $1856, %ecx
ja .L_2TAG_PACKET_4.0.1
cmpl $49056, %eax
jb .L_2TAG_PACKET_1.0.1
fldl 48(%rsp)
fldl 56(%rsp)
fxch %st(1)
fmul %st(0), %st
fxch %st(1)
nop
fmul %st(0), %st
faddp %st, %st(1)
fsqrt
.L_2TAG_PACKET_5.0.1:
fstl (%rsp)
fstpt 16(%rsp)
xorl %eax, %eax
movw 24(%rsp), %ax
cmpl $17407, %eax
jae .L_2TAG_PACKET_6.0.1
fldl (%rsp)
jmp .L_2TAG_PACKET_7.0.1
.L_2TAG_PACKET_4.0.1:
movsd %xmm0, 32(%rsp)
movsd %xmm1, 40(%rsp)
fldl 32(%rsp)
faddl 40(%rsp)
jmp .L_2TAG_PACKET_5.0.1
.L_2TAG_PACKET_6.0.1:
fldl (%rsp)
jmp .L_2TAG_PACKET_7.0.1
.L_2TAG_PACKET_3.0.1:
shufpd $0, %xmm1, %xmm0
movdqa %xmm0, %xmm2
movdqa 16+static_const_table(%rip), %xmm3
movsd %xmm0, 32(%rsp)
movsd %xmm1, 40(%rsp)
cmppd $3, %xmm0, %xmm2
cmppd $0, %xmm0, %xmm3
movmskpd %xmm2, %edx
movmskpd %xmm3, %rax
testl %edx, %edx
je .L_2TAG_PACKET_8.0.1
fldl 32(%rsp)
fmull 40(%rsp)
testq $1, %rax
jne .L_2TAG_PACKET_9.0.1
testq $2, %rax
jne .L_2TAG_PACKET_10.0.1
jmp .L_2TAG_PACKET_2.0.1
.L_2TAG_PACKET_8.0.1:
fldl 32(%rsp)
faddl 40(%rsp)
jmp .L_2TAG_PACKET_2.0.1
.L_2TAG_PACKET_9.0.1:
fstpl 40(%rsp)
fldl 32(%rsp)
jmp .L_2TAG_PACKET_7.0.1
.L_2TAG_PACKET_10.0.1:
fstpl 32(%rsp)
fldl 40(%rsp)
jmp .L_2TAG_PACKET_7.0.1
.L_2TAG_PACKET_2.0.1:
.L_2TAG_PACKET_7.0.1:
fstpl 16(%rsp)
movq 16(%rsp), %xmm0
addq $64, %rsp
ret
..B1.3:
..___tag_value_hypot.4:
END(hypot)
# -- End hypot
.section .rodata, "a"
.align 16
.align 16
static_const_table:
.long 4294967295
.long 2147483647
.long 4294967295
.long 2147483647
.long 0
.long 2146435072
.long 0
.long 2146435072
.type static_const_table,@object
.size static_const_table,32
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x00000014
.4byte 0x0000001c
.4byte ..___tag_value_hypot.1-.
.4byte ..___tag_value_hypot.4-..___tag_value_hypot.1
.2byte 0x0400
.4byte ..___tag_value_hypot.3-..___tag_value_hypot.1
.2byte 0x100e
# End

779
libm/x86_64/e_log.S Normal file
View File

@ -0,0 +1,779 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// x=2^k * mx, mx in [1,2)
//
// Get B~1/mx based on the output of rcpss instruction (B0)
// B = int((B0*2^7+0.5))/2^7
//
// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
//
// Result: k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6) and
// p(r) is a degree 7 polynomial
// -log(B) read from data table (high, low parts)
// Result is formed from high and low parts
//
// Special cases:
// log(NaN) = quiet NaN, and raise invalid exception
// log(+INF) = that INF
// log(0) = -INF with divide-by-zero exception raised
// log(1) = +0
// log(x) = NaN with invalid exception raised if x < -0, including -INF
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin log
ENTRY(log)
# parameter 1: %xmm0
..B1.1:
..___tag_value_log.1:
subq $24, %rsp
..___tag_value_log.3:
movsd %xmm0, (%rsp)
..B1.2:
movq $0x3ff0000000000000, %rax
movd %rax, %xmm2
movq $0x77f0000000000000, %rdx
movd %rdx, %xmm3
movl $32768, %ecx
movd %rcx, %xmm4
movq $0xffffe00000000000, %r8
movd %r8, %xmm5
movq %xmm0, %xmm1
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
movl $16352, %ecx
psrlq $27, %xmm0
lea L_tbl(%rip), %r11
psrld $2, %xmm0
rcpps %xmm0, %xmm0
psllq $12, %xmm1
pshufd $228, %xmm5, %xmm6
psrlq $12, %xmm1
subl $16, %eax
cmpl $32736, %eax
jae .L_2TAG_PACKET_0.0.2
.L_2TAG_PACKET_1.0.2:
paddd %xmm4, %xmm0
orpd %xmm3, %xmm1
movd %xmm0, %edx
psllq $29, %xmm0
andpd %xmm1, %xmm5
andpd %xmm6, %xmm0
subsd %xmm5, %xmm1
mulpd %xmm0, %xmm5
andl $32752, %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm7
mulsd %xmm0, %xmm1
movq log2(%rip), %xmm6
movapd coeff(%rip), %xmm3
subsd %xmm2, %xmm5
andl $16711680, %edx
shrl $12, %edx
movapd (%r11,%rdx), %xmm0
movapd 16+coeff(%rip), %xmm4
addsd %xmm5, %xmm1
movapd 32+coeff(%rip), %xmm2
mulsd %xmm7, %xmm6
movddup %xmm1, %xmm5
mulsd 8+log2(%rip), %xmm7
mulsd %xmm1, %xmm3
addsd %xmm6, %xmm0
mulpd %xmm5, %xmm4
mulpd %xmm5, %xmm5
movddup %xmm0, %xmm6
addsd %xmm1, %xmm0
addpd %xmm2, %xmm4
mulpd %xmm5, %xmm3
subsd %xmm0, %xmm6
mulsd %xmm1, %xmm4
pshufd $238, %xmm0, %xmm2
addsd %xmm6, %xmm1
mulsd %xmm5, %xmm5
addsd %xmm2, %xmm7
addpd %xmm3, %xmm4
addsd %xmm7, %xmm1
mulpd %xmm5, %xmm4
addsd %xmm4, %xmm1
pshufd $238, %xmm4, %xmm5
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_0.0.2:
movq (%rsp), %xmm0
movq (%rsp), %xmm1
addl $16, %eax
cmpl $32768, %eax
jae .L_2TAG_PACKET_2.0.2
cmpl $16, %eax
jb .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_4.0.2:
addsd %xmm0, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_5.0.2:
ja .L_2TAG_PACKET_4.0.2
cmpl $0, %edx
ja .L_2TAG_PACKET_4.0.2
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_3.0.2:
xorpd %xmm1, %xmm1
addsd %xmm0, %xmm1
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_7.0.2
xorpd %xmm1, %xmm1
movl $18416, %eax
pinsrw $3, %eax, %xmm1
mulsd %xmm1, %xmm0
movq %xmm0, %xmm1
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
psrlq $27, %xmm0
movl $18416, %ecx
psrld $2, %xmm0
rcpps %xmm0, %xmm0
psllq $12, %xmm1
pshufd $228, %xmm5, %xmm6
psrlq $12, %xmm1
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_2.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
addl %ecx, %ecx
cmpl $-2097152, %ecx
jae .L_2TAG_PACKET_5.0.2
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_6.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $32752, %eax
pinsrw $3, %eax, %xmm1
mulsd %xmm1, %xmm0
movl $3, 16(%rsp)
jmp .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_7.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
divsd %xmm1, %xmm0
movl $2, 16(%rsp)
.L_2TAG_PACKET_8.0.2:
movq %xmm0, 8(%rsp)
..B1.3:
movq 8(%rsp), %xmm0
.L_2TAG_PACKET_9.0.2:
..B1.5:
addq $24, %rsp
..___tag_value_log.4:
ret
..___tag_value_log.5:
END(log)
# -- End log
.section .rodata, "a"
.align 16
.align 16
L_tbl:
.long 4277811200
.long 1072049730
.long 2479318832
.long 1026487127
.long 2854492160
.long 1072033410
.long 215631550
.long 1025638968
.long 1547061248
.long 1072017216
.long 2886781435
.long 1026423395
.long 649825280
.long 1072001146
.long 4281533405
.long 1024038923
.long 646346752
.long 1071985198
.long 1562735921
.long 1023790276
.long 2203734016
.long 1071969370
.long 1838397691
.long 3173936209
.long 1872169984
.long 1071953661
.long 3981202460
.long 1022325013
.long 669557760
.long 1071938069
.long 4182597802
.long 3173174122
.long 4076413952
.long 1071922591
.long 1209029111
.long 3170736207
.long 556125184
.long 1071907228
.long 821086028
.long 3173437049
.long 204914688
.long 1071891976
.long 2097025986
.long 3171071798
.long 387545088
.long 1071876834
.long 3142936996
.long 3173092218
.long 2912783360
.long 1071861800
.long 2502420140
.long 1024505919
.long 1144260608
.long 1071846874
.long 3315658140
.long 3173469843
.long 1471209472
.long 1071832053
.long 129621009
.long 3172443877
.long 1829683200
.long 1071817336
.long 3885467693
.long 1025535275
.long 288676864
.long 1071802722
.long 86139472
.long 3171639793
.long 3636378624
.long 1071788208
.long 1850238587
.long 1024654342
.long 1606817792
.long 1071773795
.long 3388899795
.long 3173675586
.long 1236164608
.long 1071759480
.long 3983599207
.long 1020046558
.long 1089616896
.long 1071745262
.long 4171974224
.long 1024773198
.long 4143093760
.long 1071731139
.long 2727587401
.long 3173965207
.long 600267776
.long 1071717112
.long 3147685042
.long 3173353031
.long 2249313280
.long 1071703177
.long 125835074
.long 1025255832
.long 3805303808
.long 1071689334
.long 2289991207
.long 1025460331
.long 87278592
.long 1071675583
.long 1106114045
.long 1025933602
.long 3195405312
.long 1071661920
.long 3885316576
.long 3171206239
.long 3853649920
.long 1071648346
.long 2977069852
.long 3171236771
.long 2944026624
.long 1071625048
.long 1008093493
.long 1023444474
.long 3993180160
.long 1071598247
.long 1862355595
.long 1024642533
.long 1454641152
.long 1071571617
.long 1514603089
.long 1026500596
.long 3286085632
.long 1071545154
.long 1400028424
.long 3173279056
.long 438773760
.long 1071518858
.long 120727864
.long 3172148914
.long 1212979200
.long 1071492725
.long 1625055594
.long 3172901933
.long 1189017600
.long 1071466754
.long 3920062376
.long 1025727407
.long 403064832
.long 1071440943
.long 1053271728
.long 3171391427
.long 3343210496
.long 1071415289
.long 3243395502
.long 3173627613
.long 1765777408
.long 1071389792
.long 2145968512
.long 1026354304
.long 461430784
.long 1071364449
.long 4094322285
.long 1026021467
.long 71706624
.long 1071339258
.long 763632021
.long 1024496933
.long 1380503552
.long 1071314217
.long 1383547992
.long 3173088453
.long 1015732224
.long 1071289325
.long 3198646877
.long 1025390322
.long 35977216
.long 1071264580
.long 2141026805
.long 1025754693
.long 3927306240
.long 1071239979
.long 282116272
.long 3173394334
.long 1125341184
.long 1071215523
.long 2768427504
.long 3172279059
.long 1666971648
.long 1071191208
.long 786837629
.long 3172427445
.long 2827694080
.long 1071167033
.long 3857122416
.long 3173014241
.long 2003683328
.long 1071142997
.long 859010954
.long 1026545007
.long 1004017664
.long 1071119098
.long 3356644970
.long 3173458064
.long 1753020416
.long 1071095334
.long 788338552
.long 1026157693
.long 1992718336
.long 1071071704
.long 1239179443
.long 1026394889
.long 3870234624
.long 1071048206
.long 2082614663
.long 1024926053
.long 1050437632
.long 1071024840
.long 660007840
.long 1025548499
.long 188395520
.long 1071001603
.long 3878792704
.long 3173889571
.long 3747176448
.long 1070978493
.long 144991708
.long 3171552042
.long 1405669376
.long 1070955511
.long 3999088879
.long 1025486317
.long 121151488
.long 1070932654
.long 2170865497
.long 1026473584
.long 2652319744
.long 1070909920
.long 453695652
.long 3173916809
.long 3262236672
.long 1070887309
.long 157800053
.long 3173984206
.long 601221120
.long 1070864820
.long 3968917661
.long 1023992886
.long 1999843328
.long 1070842450
.long 3053895004
.long 1024998228
.long 1992167424
.long 1070820199
.long 2968614856
.long 1024552653
.long 3788726272
.long 1070798065
.long 3542170808
.long 3173573242
.long 2094829568
.long 1070776048
.long 1246758132
.long 1026202874
.long 288675840
.long 1070754146
.long 3747328950
.long 1026331585
.long 1829681152
.long 1070732357
.long 3125197546
.long 1024100318
.long 1666869248
.long 1070710681
.long 1363656119
.long 1026336493
.long 3417110528
.long 1070689116
.long 4154791553
.long 1026267853
.long 2183653376
.long 1070667662
.long 1671819292
.long 3173785870
.long 1734434816
.long 1070646317
.long 373091049
.long 1025972363
.long 1615681536
.long 1070625080
.long 384650897
.long 1022926043
.long 1445382144
.long 1070603950
.long 344320330
.long 3172397196
.long 1823715328
.long 1070569756
.long 3389841200
.long 1025231852
.long 3839688704
.long 1070527917
.long 1706790417
.long 3167363349
.long 4293332992
.long 1070486286
.long 1614935088
.long 1019351591
.long 2966720512
.long 1070444861
.long 4145393717
.long 3173711658
.long 4066729984
.long 1070403639
.long 1974925028
.long 3171437182
.long 3337621504
.long 1070362619
.long 3314953170
.long 3169971314
.long 943448064
.long 1070321799
.long 1498682038
.long 3173862340
.long 1465634816
.long 1070281176
.long 1319952810
.long 3171693965
.long 1015734272
.long 1070240749
.long 1347821929
.long 3173544515
.long 118001664
.long 1070200516
.long 1751482746
.long 1026134093
.long 3707174912
.long 1070160474
.long 1486946159
.long 1023930920
.long 3946381312
.long 1070120623
.long 2867408081
.long 3171368276
.long 1699848192
.long 1070080961
.long 2590187139
.long 1025379803
.long 2235846656
.long 1070041485
.long 1888568069
.long 3172754960
.long 2339729408
.long 1070002194
.long 3852214753
.long 3173323149
.long 3196850176
.long 1069963086
.long 742141560
.long 1025101707
.long 1800683520
.long 1069924160
.long 3949500444
.long 3172102179
.long 3835801600
.long 1069885413
.long 3848895943
.long 1025913832
.long 2201202688
.long 1069846845
.long 1425913464
.long 1025868665
.long 2778279936
.long 1069808453
.long 2120889677
.long 3173831128
.long 2954203136
.long 1069770236
.long 592147081
.long 1019621288
.long 210141184
.long 1069732193
.long 3414275233
.long 1023647084
.long 709476352
.long 1069694321
.long 2413027164
.long 1024462115
.long 2116284416
.long 1069656619
.long 1144559924
.long 1026336654
.long 2183651328
.long 1069619086
.long 3459057650
.long 1025634168
.long 3047047168
.long 1069581720
.long 1879674924
.long 3173508573
.long 970711040
.long 1069541521
.long 1335954173
.long 3173332182
.long 2198478848
.long 1069467449
.long 2951103968
.long 3173892200
.long 1669611520
.long 1069393703
.long 531044147
.long 1025149248
.long 29114368
.long 1069320280
.long 3327831251
.long 1025918673
.long 2376949760
.long 1069247176
.long 737634533
.long 3172176000
.long 1085390848
.long 1069174390
.long 3108243400
.long 3171828406
.long 1566130176
.long 1069101918
.long 985483226
.long 1025708380
.long 792780800
.long 1069029758
.long 4184866295
.long 1024426204
.long 183156736
.long 1068957907
.long 2845699378
.long 1022107277
.long 1301782528
.long 1068886362
.long 1012735262
.long 3173804294
.long 1562411008
.long 1068815121
.long 2197086703
.long 3170187813
.long 2815549440
.long 1068744181
.long 2782613207
.long 1026345054
.long 2756124672
.long 1068673540
.long 2929486205
.long 3173037800
.long 3511050240
.long 1068603195
.long 1443733147
.long 3173331549
.long 3047047168
.long 1068533144
.long 1879674924
.long 3172459997
.long 3221667840
.long 1068427825
.long 1338588027
.long 3171815742
.long 3453861888
.long 1068288883
.long 1205348359
.long 3172624626
.long 3506110464
.long 1068150514
.long 893105198
.long 1025571866
.long 346013696
.long 1068012714
.long 3495569021
.long 3172563349
.long 4074029056
.long 1067875476
.long 3961106338
.long 3171065595
.long 3559784448
.long 1067738798
.long 1975385384
.long 3173783155
.long 797769728
.long 1067602675
.long 3760305787
.long 1026047642
.long 2313633792
.long 1067467101
.long 1559353171
.long 1023480256
.long 3960766464
.long 1067213778
.long 1067365107
.long 1025865926
.long 684261376
.long 1066944805
.long 844762164
.long 3173687482
.long 630718464
.long 1066676905
.long 2458269694
.long 1024033081
.long 1486061568
.long 1066410070
.long 115537874
.long 3173243995
.long 2743664640
.long 1065886792
.long 3665098304
.long 3173471607
.long 1971912704
.long 1065357333
.long 2577214440
.long 3171993451
.long 1498939392
.long 1064306693
.long 3409036923
.long 1025599151
.long 0
.long 0
.long 0
.long 2147483648
.type L_tbl,@object
.size L_tbl,2064
.align 16
log2:
.long 4277811200
.long 1067855426
.long 2479318832
.long 1022292823
.type log2,@object
.size log2,16
.align 16
coeff:
.long 2454267026
.long 1069697316
.long 0
.long 3218079744
.long 1030730101
.long 3217380702
.long 1431655765
.long 1070945621
.long 2576980378
.long 1070176665
.long 0
.long 3219128320
.type coeff,@object
.size coeff,48
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x0000001c
.4byte 0x0000001c
.4byte ..___tag_value_log.1-.
.4byte ..___tag_value_log.5-..___tag_value_log.1
.2byte 0x0400
.4byte ..___tag_value_log.3-..___tag_value_log.1
.2byte 0x200e
.byte 0x04
.4byte ..___tag_value_log.4-..___tag_value_log.3
.2byte 0x080e
.byte 0x00
# End

807
libm/x86_64/e_log10.S Normal file
View File

@ -0,0 +1,807 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Let x=2^k * mx, mx in [1,2)
//
// Get B~1/mx based on the output of rcpss instruction (B0)
// B = int((B0*LH*2^7+0.5))/2^7
// LH is a short approximation for log10(e)
//
// Reduced argument: r=B*mx-LH (computed accurately in high and low parts)
//
// Result: k*log10(2) - log(B) + p(r)
// p(r) is a degree 7 polynomial
// -log(B) read from data table (high, low parts)
// Result is formed from high and low parts
//
// Special cases:
// log10(0) = -INF with divide-by-zero exception raised
// log10(1) = +0
// log10(x) = NaN with invalid exception raised if x < -0, including -INF
// log10(+INF) = +INF
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin log10
ENTRY(log10)
# parameter 1: %xmm0
..B1.1:
..___tag_value_log10.1:
subq $24, %rsp
..___tag_value_log10.3:
movsd %xmm0, (%rsp)
..B1.2:
xorpd %xmm2, %xmm2
movl $16368, %eax
pinsrw $3, %eax, %xmm2
movl $1054736384, %ecx
movd %ecx, %xmm7
xorpd %xmm3, %xmm3
movl $30704, %edx
pinsrw $3, %edx, %xmm3
movq %xmm0, %xmm1
movl $32768, %edx
movd %edx, %xmm4
movapd HIGHSIGMASK(%rip), %xmm5
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
movl $16352, %ecx
psrlq $27, %xmm0
movq LOG10_E(%rip), %xmm2
psrld $2, %xmm0
rcpps %xmm0, %xmm0
psllq $12, %xmm1
pshufd $78, %xmm5, %xmm6
psrlq $12, %xmm1
subl $16, %eax
cmpl $32736, %eax
jae .L_2TAG_PACKET_0.0.2
.L_2TAG_PACKET_1.0.2:
mulss %xmm7, %xmm0
orpd %xmm3, %xmm1
lea L_tbl(%rip), %r11
andpd %xmm1, %xmm5
paddd %xmm4, %xmm0
subsd %xmm5, %xmm1
movd %xmm0, %edx
psllq $29, %xmm0
andpd %xmm6, %xmm0
andl $32752, %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm7
mulpd %xmm0, %xmm5
mulsd %xmm0, %xmm1
movq log2(%rip), %xmm6
movapd coeff(%rip), %xmm3
subsd %xmm2, %xmm5
andl $16711680, %edx
shrl $12, %edx
movapd -1504(%r11,%rdx), %xmm0
movapd 16+coeff(%rip), %xmm4
addsd %xmm5, %xmm1
movapd 32+coeff(%rip), %xmm2
mulsd %xmm7, %xmm6
pshufd $68, %xmm1, %xmm5
mulsd 8+log2(%rip), %xmm7
mulsd %xmm1, %xmm3
addsd %xmm6, %xmm0
mulpd %xmm5, %xmm4
movq 8+LOG10_E(%rip), %xmm6
mulpd %xmm5, %xmm5
addpd %xmm2, %xmm4
mulpd %xmm5, %xmm3
pshufd $228, %xmm0, %xmm2
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm4
subsd %xmm0, %xmm2
mulsd %xmm1, %xmm6
addsd %xmm2, %xmm1
pshufd $238, %xmm0, %xmm2
mulsd %xmm5, %xmm5
addsd %xmm2, %xmm7
addsd %xmm6, %xmm1
addpd %xmm3, %xmm4
addsd %xmm7, %xmm1
mulpd %xmm5, %xmm4
addsd %xmm4, %xmm1
pshufd $238, %xmm4, %xmm5
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_0.0.2:
movq (%rsp), %xmm0
movq (%rsp), %xmm1
addl $16, %eax
cmpl $32768, %eax
jae .L_2TAG_PACKET_2.0.2
cmpl $16, %eax
jb .L_2TAG_PACKET_3.0.2
.L_2TAG_PACKET_4.0.2:
addsd %xmm0, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_5.0.2:
ja .L_2TAG_PACKET_4.0.2
cmpl $0, %edx
ja .L_2TAG_PACKET_4.0.2
jmp .L_2TAG_PACKET_6.0.2
.L_2TAG_PACKET_3.0.2:
xorpd %xmm1, %xmm1
addsd %xmm0, %xmm1
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_7.0.2
xorpd %xmm1, %xmm1
movl $18416, %eax
pinsrw $3, %eax, %xmm1
mulsd %xmm1, %xmm0
xorpd %xmm2, %xmm2
movl $16368, %eax
pinsrw $3, %eax, %xmm2
movq %xmm0, %xmm1
pextrw $3, %xmm0, %eax
orpd %xmm2, %xmm0
movl $18416, %ecx
psrlq $27, %xmm0
movq LOG10_E(%rip), %xmm2
psrld $2, %xmm0
rcpps %xmm0, %xmm0
psllq $12, %xmm1
pshufd $78, %xmm5, %xmm6
psrlq $12, %xmm1
jmp .L_2TAG_PACKET_1.0.2
.L_2TAG_PACKET_2.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
addl %ecx, %ecx
cmpl $-2097152, %ecx
jae .L_2TAG_PACKET_5.0.2
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_6.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $32752, %eax
pinsrw $3, %eax, %xmm1
mulsd %xmm1, %xmm0
movl $9, 16(%rsp)
jmp .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_7.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
divsd %xmm1, %xmm0
movl $8, 16(%rsp)
.L_2TAG_PACKET_8.0.2:
movq %xmm0, 8(%rsp)
..B1.3:
movq 8(%rsp), %xmm0
.L_2TAG_PACKET_9.0.2:
..B1.5:
addq $24, %rsp
..___tag_value_log10.4:
ret
..___tag_value_log10.5:
END(log10)
# -- End log10
.section .rodata, "a"
.align 16
.align 16
HIGHSIGMASK:
.long 4160749568
.long 4294967295
.long 0
.long 4294959104
.type HIGHSIGMASK,@object
.size HIGHSIGMASK,16
.align 16
LOG10_E:
.long 0
.long 1071366144
.long 3207479560
.long 1062894188
.type LOG10_E,@object
.size LOG10_E,16
.align 16
L_tbl:
.long 1352628224
.long 1070810131
.long 521319256
.long 1025503025
.long 2150839296
.long 1070801944
.long 3329350096
.long 3170190015
.long 1360613376
.long 1070793794
.long 2024059075
.long 1024991594
.long 1875350528
.long 1070785680
.long 2163882141
.long 3163564137
.long 2312126464
.long 1070777602
.long 1975711076
.long 1023674196
.long 1306336256
.long 1070769560
.long 3524899523
.long 3170508164
.long 1806334976
.long 1070761553
.long 4254777025
.long 1025238739
.long 2483193856
.long 1070753581
.long 3800671317
.long 3172916830
.long 2025350144
.long 1070745644
.long 1731514745
.long 1025501083
.long 3433285632
.long 1070737741
.long 2551857336
.long 3169662186
.long 1134317568
.long 1070729873
.long 3426297655
.long 3172637891
.long 2457152512
.long 1070722038
.long 63549415
.long 1025415416
.long 1861803008
.long 1070714237
.long 1910171636
.long 1023977580
.long 2414140416
.long 1070706469
.long 4002514337
.long 3170841618
.long 2900726784
.long 1070698734
.long 3268064083
.long 1022459609
.long 2123517952
.long 1070691032
.long 1767031218
.long 1022448156
.long 3194569728
.long 1070683362
.long 3402332618
.long 3171671160
.long 650882048
.long 1070675725
.long 4146023905
.long 3171023038
.long 1928988672
.long 1070668119
.long 1438617867
.long 1016360491
.long 1594908672
.long 1070660545
.long 971389377
.long 1024763979
.long 2818746368
.long 1070653002
.long 3555925341
.long 3172434821
.long 194584576
.long 1070645491
.long 943919215
.long 3172950063
.long 1215096832
.long 1070638010
.long 2283358588
.long 1022335098
.long 501519360
.long 1070630560
.long 480904295
.long 1024437959
.long 1278266368
.long 1070623140
.long 2755806066
.long 3172342012
.long 2487812096
.long 1070615750
.long 2489653202
.long 3172481099
.long 3085451264
.long 1070608390
.long 3759184951
.long 3172574892
.long 2039090176
.long 1070601060
.long 1361176676
.long 3172355319
.long 953057280
.long 1070591423
.long 1176587546
.long 3166422018
.long 3370524672
.long 1070576879
.long 3669570051
.long 1025376630
.long 749742080
.long 1070562394
.long 707700964
.long 3170814058
.long 4008353792
.long 1070547965
.long 3247327652
.long 1022431400
.long 2612455424
.long 1070533594
.long 2453457344
.long 3172322969
.long 3230920704
.long 1070519279
.long 1296781801
.long 1025115335
.long 3965253632
.long 1070505020
.long 373075289
.long 1017938528
.long 2593157120
.long 1070476669
.long 1068054086
.long 1021616576
.long 925962240
.long 1070448537
.long 850121213
.long 1023928989
.long 1732556800
.long 1070420620
.long 1305206740
.long 3172665570
.long 3815630848
.long 1070392915
.long 192642943
.long 3172699907
.long 2001758208
.long 1070365420
.long 2820786683
.long 1024704867
.long 16746496
.long 1070338131
.long 1399573110
.long 3171372773
.long 1886492672
.long 1070311044
.long 3621428075
.long 3172974358
.long 3338196992
.long 1070284157
.long 3793882035
.long 1025124701
.long 381769728
.long 1070257468
.long 3877933342
.long 3170195490
.long 2186491904
.long 1070230972
.long 1838687089
.long 1017927292
.long 1008330752
.long 1070204668
.long 2228321664
.long 1025352196
.long 2247065600
.long 1070178552
.long 1413900906
.long 3170902532
.long 2964070400
.long 1070152622
.long 3590454629
.long 1025016844
.long 465154048
.long 1070126876
.long 2079688550
.long 3172268183
.long 883615744
.long 1070101310
.long 989244452
.long 3171900485
.long 1993768960
.long 1070075922
.long 1124327841
.long 3172964992
.long 1794471936
.long 1070050710
.long 1140575046
.long 1022673726
.long 2797932544
.long 1070025671
.long 1894836933
.long 3172544059
.long 3433797632
.long 1070000803
.long 3221831166
.long 3171921685
.long 2338371584
.long 1069976104
.long 3732461053
.long 3164513518
.long 2644013056
.long 1069951571
.long 2519460462
.long 3172548740
.long 3383814144
.long 1069927202
.long 2290997657
.long 1025499649
.long 3781380096
.long 1069902995
.long 380479405
.long 1025184136
.long 3245785088
.long 1069878948
.long 1096398261
.long 3169885192
.long 1366712320
.long 1069855059
.long 2218343715
.long 3170281628
.long 2204717056
.long 1069831325
.long 2668334011
.long 1025264524
.long 1401772032
.long 1069807745
.long 4103993159
.long 1022925721
.long 3356721152
.long 1069784316
.long 3573790772
.long 3172186527
.long 4041148416
.long 1069761037
.long 4027691910
.long 3171276990
.long 3880151040
.long 1069737906
.long 4087118786
.long 3172710734
.long 3453364224
.long 1069714921
.long 99014299
.long 3172003077
.long 3491092480
.long 1069692080
.long 3801836701
.long 3172989287
.long 575580160
.long 1069669382
.long 1920406012
.long 3170874125
.long 22282240
.long 1069646824
.long 964193370
.long 1019363159
.long 2991429632
.long 1069624404
.long 3372589890
.long 1023425053
.long 2189645824
.long 1069602122
.long 2610503872
.long 1023652442
.long 3341467648
.long 1069579975
.long 1190292004
.long 1022425665
.long 3711293440
.long 1069557962
.long 1104795356
.long 1023625829
.long 1380401152
.long 1069524644
.long 1156998217
.long 1025100499
.long 765710336
.long 1069481144
.long 1736649113
.long 1024999439
.long 849412096
.long 1069437902
.long 2618178330
.long 3170853629
.long 1433104384
.long 1069394915
.long 43477267
.long 3170378811
.long 2548596736
.long 1069352180
.long 3967367063
.long 1025246584
.long 157577216
.long 1069309695
.long 100402533
.long 3172825502
.long 3326238720
.long 1069267455
.long 1176892909
.long 1025464099
.long 4155494400
.long 1069225459
.long 3713707617
.long 3172630046
.long 3545804800
.long 1069183704
.long 857007315
.long 1024965777
.long 2602520576
.long 1069142187
.long 2588758347
.long 1022463131
.long 2631196672
.long 1069100905
.long 2118424235
.long 1022490989
.long 838135808
.long 1069059856
.long 4117002727
.long 1024874520
.long 3210903552
.long 1069019036
.long 650070125
.long 3172012966
.long 3039211520
.long 1068978444
.long 438055812
.long 1017743757
.long 2385633280
.long 1068938077
.long 3011990369
.long 3171312044
.long 3491618816
.long 1068897932
.long 712813818
.long 3172720400
.long 183644160
.long 1068858008
.long 4287006742
.long 1022379728
.long 3639214080
.long 1068818300
.long 353762279
.long 3172980009
.long 3728416768
.long 1068778808
.long 1851367730
.long 1025486574
.long 3370094592
.long 1068739529
.long 4046594913
.long 3172567047
.long 1348407296
.long 1068700461
.long 143189675
.long 1025397632
.long 899403776
.long 1068661601
.long 3753687842
.long 3170772772
.long 1117708288
.long 1068622947
.long 1857340812
.long 3170782678
.long 1248276480
.long 1068584497
.long 1289858203
.long 1025222289
.long 683237376
.long 1068546249
.long 2356679608
.long 3171629170
.long 3253764096
.long 1068508200
.long 3267136556
.long 1018554987
.long 94478336
.long 1068441756
.long 1927868814
.long 3169378180
.long 3233144832
.long 1068366445
.long 2682188854
.long 1023964004
.long 2940297216
.long 1068291522
.long 275301289
.long 1023944679
.long 3677708288
.long 1068216982
.long 302658771
.long 1024465567
.long 1576968192
.long 1068142822
.long 3672035940
.long 3172254610
.long 1614069760
.long 1068069037
.long 480052905
.long 3172692062
.long 424435712
.long 1067995624
.long 2207869657
.long 3170965436
.long 3477782528
.long 1067922578
.long 2980661858
.long 3164990018
.long 3598401536
.long 1067849897
.long 1974393034
.long 3171357083
.long 2435235840
.long 1067777577
.long 1385289011
.long 1024615823
.long 1867333632
.long 1067705614
.long 3442236633
.long 1025334384
.long 3999301632
.long 1067634004
.long 3506472073
.long 1025132546
.long 2566971392
.long 1067562745
.long 1425757592
.long 3172358463
.long 112943104
.long 1067491833
.long 1693407156
.long 3172426603
.long 3079929856
.long 1067392159
.long 3999942455
.long 1018549369
.long 2443837440
.long 1067251701
.long 974534460
.long 1023963412
.long 359366656
.long 1067111917
.long 2204915018
.long 1013514416
.long 3564519424
.long 1066972799
.long 3977441659
.long 3170879860
.long 2011086848
.long 1066834343
.long 590145514
.long 1025390011
.long 3216982016
.long 1066696541
.long 3629120110
.long 1024330313
.long 2194128896
.long 1066559388
.long 2367098512
.long 3172260338
.long 2916220928
.long 1066422877
.long 2262431886
.long 1021229446
.long 2263941120
.long 1066172214
.long 3118507287
.long 1021484970
.long 3076292608
.long 1065901726
.long 1411737803
.long 3172957147
.long 1186136064
.long 1065632488
.long 3109349337
.long 1025397383
.long 3085303808
.long 1065364487
.long 584715031
.long 3172596519
.long 1821048832
.long 1064842211
.long 2182246895
.long 3172536214
.long 697368576
.long 1064311094
.long 3157561765
.long 3172716357
.long 894042112
.long 1063260131
.long 3237958154
.long 3172587292
.long 0
.long 0
.long 0
.long 0
.type L_tbl,@object
.size L_tbl,2064
.align 16
log2:
.long 1352628224
.long 1066615827
.long 521319256
.long 1021308721
.type log2,@object
.size log2,16
.align 16
coeff:
.long 3248877870
.long 1077250164
.long 1691676429
.long 3221787401
.long 945132465
.long 3223701783
.long 3700831335
.long 1073506818
.long 2141010593
.long 1075227551
.long 3698831637
.long 3220339442
.type coeff,@object
.size coeff,48
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x0000001c
.4byte 0x0000001c
.4byte ..___tag_value_log10.1-.
.4byte ..___tag_value_log10.5-..___tag_value_log10.1
.2byte 0x0400
.4byte ..___tag_value_log10.3-..___tag_value_log10.1
.2byte 0x200e
.byte 0x04
.4byte ..___tag_value_log10.4-..___tag_value_log10.3
.2byte 0x080e
.byte 0x00
# End

4282
libm/x86_64/e_pow.S Normal file

File diff suppressed because it is too large Load Diff

1430
libm/x86_64/e_sinh.S Normal file

File diff suppressed because it is too large Load Diff

927
libm/x86_64/s_atan.S Normal file
View File

@ -0,0 +1,927 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// This implementation uses the main path for |x| in [2^{-5},2^65).
// For |x| in [2^{-64},2^{-5}), a secondary path is used.
// For the biased exponent of X within 3FFH-64 and 3FF+64, we use one branch.
// We use the following definition of B and X` so that the formula
// atan(X) = Tau + atan( (X`-B) / (One + BX) ) is correct
//
// X = (-1)^s * 2^k * 1. x1 x2 ... x52
//
// Define X` = 0 if k >= 5; and X` = |X| otherwise
// Define One = 0 if k >= 5; and One = 1 otherwise
// Define B = 0 if k <= -6; B = 2^k * 1.x1 x2 x3 x4 1 if -5 <= k <= 4
// Define B = 2^5 * 1.0 0 ... 0 if k >= 5
//
// Tau is 0 if k <= -6;
// Tau is atan( B ) if -5 <= k <= 4
// Tau is pi/2 if k >= 5
//
// Special cases:
// atan(NaN) = quiet NaN
// atan(+/-INF) = +/-Pi/2
// atan(+/-0) = +/-0
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin atan
ENTRY(atan)
# parameter 1: %xmm0
..B1.1:
..___tag_value_atan.1:
pushq %rsi
..___tag_value_atan.3:
movsd %xmm0, (%rsp)
..B1.2:
movq $0xffff000000000000, %r8
movd %r8, %xmm3
movq ONEMASK(%rip), %xmm5
movq $0x800000000000, %r9
movd %r9, %xmm4
pextrw $3, %xmm0, %edx
andpd %xmm0, %xmm3
pshufd $68, %xmm0, %xmm1
orpd %xmm4, %xmm3
movl %edx, %eax
andl $32767, %edx
subl $16288, %edx
cmpl $159, %edx
ja .L_2TAG_PACKET_0.0.1
mulsd %xmm3, %xmm1
subsd %xmm3, %xmm0
addsd %xmm5, %xmm1
divsd %xmm1, %xmm0
addl $1, %edx
movq a2(%rip), %xmm2
movq b2(%rip), %xmm4
andl $32768, %eax
xorpd %xmm7, %xmm7
pinsrw $3, %eax, %xmm7
addl %edx, %edx
lea atan_tbl(%rip), %r8
movq (%r8,%rdx,8), %xmm6
movq 8(%r8,%rdx,8), %xmm5
xorpd %xmm7, %xmm5
xorpd %xmm7, %xmm6
movq 8+a2(%rip), %xmm7
movddup %xmm0, %xmm1
mulsd %xmm0, %xmm0
movddup %xmm1, %xmm3
addsd %xmm6, %xmm1
mulsd %xmm0, %xmm2
addsd %xmm0, %xmm4
subsd %xmm1, %xmm6
mulsd %xmm0, %xmm4
addsd %xmm7, %xmm2
mulsd %xmm3, %xmm0
addsd %xmm3, %xmm6
mulsd %xmm2, %xmm0
addsd 8+b2(%rip), %xmm4
addsd %xmm5, %xmm6
mulsd %xmm4, %xmm0
addsd %xmm6, %xmm0
addsd %xmm1, %xmm0
jmp .L_2TAG_PACKET_1.0.1
.L_2TAG_PACKET_0.0.1:
addl $944, %edx
cmpl $1103, %edx
ja .L_2TAG_PACKET_2.0.1
movq a2(%rip), %xmm4
movq b2(%rip), %xmm7
movq (%rsp), %xmm0
mulsd %xmm1, %xmm1
movq 8+a2(%rip), %xmm2
movq 8+b2(%rip), %xmm5
mulsd %xmm1, %xmm4
addsd %xmm1, %xmm7
movq %xmm1, %xmm6
mulsd %xmm0, %xmm1
addsd %xmm4, %xmm2
mulsd %xmm6, %xmm7
mulsd %xmm1, %xmm2
addsd %xmm5, %xmm7
mulsd %xmm7, %xmm2
addsd %xmm2, %xmm0
jmp .L_2TAG_PACKET_1.0.1
.L_2TAG_PACKET_2.0.1:
addl $15344, %edx
cmpl $16368, %edx
ja .L_2TAG_PACKET_3.0.1
movq (%rsp), %xmm0
movq (%rsp), %xmm1
cmpl $16, %edx
jae .L_2TAG_PACKET_1.0.1
mulsd %xmm0, %xmm1
jmp .L_2TAG_PACKET_1.0.1
.L_2TAG_PACKET_3.0.1:
cmpl $17392, %edx
jae .L_2TAG_PACKET_4.0.1
movq $0xbff0000000000000, %r8
movd %r8, %xmm1
divsd %xmm0, %xmm1
movq a2(%rip), %xmm2
movq b2(%rip), %xmm4
andl $32768, %eax
xorpd %xmm7, %xmm7
pinsrw $3, %eax, %xmm7
addl %edx, %edx
movq pi_table(%rip), %xmm6
movq 8+pi_table(%rip), %xmm5
xorpd %xmm7, %xmm5
xorpd %xmm7, %xmm6
movq 8+a2(%rip), %xmm7
movddup %xmm1, %xmm0
mulsd %xmm1, %xmm1
movddup %xmm0, %xmm3
addsd %xmm6, %xmm0
mulsd %xmm1, %xmm2
addsd %xmm1, %xmm4
subsd %xmm0, %xmm6
mulsd %xmm1, %xmm4
addsd %xmm7, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm3, %xmm6
mulsd %xmm2, %xmm1
addsd 8+b2(%rip), %xmm4
addsd %xmm5, %xmm6
mulsd %xmm4, %xmm1
addsd %xmm6, %xmm1
addsd %xmm1, %xmm0
jmp .L_2TAG_PACKET_1.0.1
.L_2TAG_PACKET_4.0.1:
movq (%rsp), %xmm4
movq SGNMASK(%rip), %xmm0
movq pi_table(%rip), %xmm2
movq 8+pi_table(%rip), %xmm3
movd %xmm1, %eax
psrlq $32, %xmm1
movd %xmm1, %edx
andl $2147483647, %edx
cmpl $2146435072, %edx
jae .L_2TAG_PACKET_5.0.1
.L_2TAG_PACKET_6.0.1:
andnpd %xmm4, %xmm0
orpd %xmm0, %xmm2
orpd %xmm3, %xmm0
addsd %xmm2, %xmm0
jmp .L_2TAG_PACKET_1.0.1
.L_2TAG_PACKET_5.0.1:
subl $2146435072, %edx
orl %edx, %eax
cmpl $0, %eax
je .L_2TAG_PACKET_6.0.1
movq %xmm4, %xmm0
addsd %xmm0, %xmm0
.L_2TAG_PACKET_1.0.1:
..B1.3:
popq %rcx
..___tag_value_atan.4:
ret
..___tag_value_atan.5:
END(atan)
# -- End atan
.section .rodata, "a"
.align 4
.align 4
ONEMASK:
.long 0
.long 1072693248
.type ONEMASK,@object
.size ONEMASK,8
.align 4
a2:
.long 2006262985
.long 1069310863
.long 2358449471
.long 3217342131
.type a2,@object
.size a2,16
.align 4
b2:
.long 3845454352
.long 1069952297
.long 2829679149
.long 1073771565
.type b2,@object
.size b2,16
.align 4
atan_tbl:
.long 0
.long 0
.long 0
.long 0
.long 3819695742
.long 1067482761
.long 2398680355
.long 3155462074
.long 2998791009
.long 1067548225
.long 3868465248
.long 3157182472
.long 3339424991
.long 1067613680
.long 3296670360
.long 1010752543
.long 2710002256
.long 1067679126
.long 3403896007
.long 1010910768
.long 3275701428
.long 1067744562
.long 119959933
.long 1011482843
.long 2908636881
.long 1067809988
.long 2464489612
.long 1011545526
.long 3777889398
.long 1067875403
.long 3262682165
.long 1009703919
.long 3759667419
.long 1067940807
.long 1838130851
.long 3157373556
.long 732369940
.long 1068006200
.long 1203428313
.long 1010055371
.long 1166616461
.long 1068071580
.long 2901274051
.long 3158549977
.long 2945472892
.long 1068136947
.long 3726120658
.long 1009762715
.long 3954480976
.long 1068202301
.long 1289173457
.long 1009429861
.long 2081752829
.long 1068267642
.long 1836909874
.long 1006212095
.long 3807999788
.long 1068332968
.long 2172459940
.long 3156162078
.long 2731789884
.long 1068398280
.long 3450718392
.long 3159216547
.long 1044477961
.long 1068463577
.long 2230553229
.long 1011424339
.long 1486930287
.long 1068530218
.long 2861547474
.long 1012041376
.long 2293016881
.long 1068595466
.long 136843272
.long 1012684797
.long 201518157
.long 1068660680
.long 63231984
.long 1012427198
.long 4054234584
.long 1068725856
.long 3927006960
.long 1011878955
.long 1246477213
.long 1068790995
.long 1494265652
.long 3155219350
.long 678186699
.long 1068856093
.long 1264361424
.long 3159256693
.long 2690594995
.long 1068921148
.long 3906996379
.long 1009288267
.long 3362611517
.long 1068986159
.long 1650970041
.long 3158331771
.long 3102162111
.long 1069051124
.long 365917035
.long 3160264153
.long 2352611067
.long 1069116041
.long 4008970190
.long 3159478182
.long 1594134794
.long 1069180908
.long 466690178
.long 1012526501
.long 1345079306
.long 1069245723
.long 2268273568
.long 3160164092
.long 2163300970
.long 1069310484
.long 2750834800
.long 3158113482
.long 352522716
.long 1069375190
.long 1750411372
.long 1011790845
.long 848541647
.long 1069439838
.long 2164207573
.long 1011698350
.long 40647312
.long 1069504427
.long 2949165434
.long 3159107267
.long 2216766270
.long 1069574357
.long 2197920765
.long 3161055954
.long 1090914384
.long 1069638757
.long 2330454674
.long 1013365998
.long 387601244
.long 1069703022
.long 3185681168
.long 1013434071
.long 3991640484
.long 1069767144
.long 1313211590
.long 3161087959
.long 3322489502
.long 1069831118
.long 3013977995
.long 1013053011
.long 3121698570
.long 1069894936
.long 4069015667
.long 1013023362
.long 4289964660
.long 1069958591
.long 1736191156
.long 3158266731
.long 3903312386
.long 1070022077
.long 1833592413
.long 3159731471
.long 3818449864
.long 1070085387
.long 851036429
.long 3159730451
.long 2097480306
.long 1070148515
.long 3506390884
.long 3160462302
.long 1611694502
.long 1070211454
.long 2785735540
.long 3160465144
.long 1464694796
.long 1070274198
.long 4229277299
.long 3159907000
.long 1299612775
.long 1070336741
.long 4116653788
.long 3160427739
.long 1310544789
.long 1070399077
.long 1064430331
.long 1013218202
.long 2253168030
.long 1070461200
.long 1405044609
.long 3157623179
.long 1159567373
.long 1070523105
.long 2353445521
.long 3159992176
.long 1359373750
.long 1070605818
.long 1748171336
.long 3161879263
.long 908341706
.long 1070667034
.long 3372710815
.long 3161775245
.long 1743027350
.long 1070727765
.long 687089934
.long 3160507171
.long 2055355646
.long 1070787992
.long 2392855242
.long 1013682469
.long 690426164
.long 1070847697
.long 1103926666
.long 1014052810
.long 1483247847
.long 1070906862
.long 2082645847
.long 3161345479
.long 392040270
.long 1070965472
.long 2407720023
.long 1014053754
.long 2673846014
.long 1071023511
.long 1293605532
.long 3158464385
.long 1384215810
.long 1071080967
.long 2446095872
.long 3159216407
.long 3101660631
.long 1071137826
.long 698040758
.long 1014855328
.long 2094057058
.long 1071194078
.long 2282048339
.long 1014040385
.long 1712750594
.long 1071249712
.long 1204372378
.long 3162276464
.long 1411515787
.long 1071304719
.long 949080808
.long 1015006403
.long 931538085
.long 1071359091
.long 3027127039
.long 1014307233
.long 179139065
.long 1071412821
.long 4285547492
.long 3161934731
.long 3387721259
.long 1071465902
.long 373225773
.long 1013486625
.long 2132236852
.long 1071544299
.long 3250533429
.long 1014031677
.long 1942070284
.long 1071645596
.long 1237964179
.long 3163239113
.long 1532707802
.long 1071695380
.long 330645583
.long 1012495610
.long 2294184979
.long 1071743834
.long 3959472897
.long 1015833116
.long 3805060714
.long 1071790961
.long 2671256142
.long 1013727772
.long 2215037898
.long 1071836770
.long 2683359117
.long 1015831902
.long 483661594
.long 1071881273
.long 836288326
.long 3162648643
.long 1534679894
.long 1071924486
.long 373258696
.long 3162470096
.long 1538714628
.long 1071966430
.long 3199433068
.long 1015325501
.long 527642555
.long 1072007128
.long 3636832592
.long 3161843145
.long 291339150
.long 1072046605
.long 890169537
.long 3160586117
.long 2450210201
.long 1072084888
.long 1636353294
.long 3163193400
.long 2411367951
.long 1072122007
.long 374899873
.long 1011331750
.long 681549971
.long 1072157992
.long 506411689
.long 1015373954
.long 1466745541
.long 1072192873
.long 2143860931
.long 1013364334
.long 2845622366
.long 1072226682
.long 2869178209
.long 3162423682
.long 2838871438
.long 1072275456
.long 3742223599
.long 1014338577
.long 4200275274
.long 1072337034
.long 1566539915
.long 3161839550
.long 3034733530
.long 1072394897
.long 652621408
.long 3162261964
.long 3207412993
.long 1072449290
.long 3206124665
.long 1014408733
.long 624461478
.long 1072500450
.long 932437485
.long 1015204343
.long 767665908
.long 1072548600
.long 1037911952
.long 3163527627
.long 1110773639
.long 1072593952
.long 2371517912
.long 3160465741
.long 1940828530
.long 1072636704
.long 2731408428
.long 3162895795
.long 1911329388
.long 1072677041
.long 1773089615
.long 3159569267
.long 1764715788
.long 1072704191
.long 691346949
.long 3164069946
.long 3332979233
.long 1072722195
.long 3550733983
.long 1014770628
.long 1321870254
.long 1072739231
.long 1415315820
.long 1016224052
.long 3657429030
.long 1072755365
.long 3910539033
.long 1015966402
.long 4197624557
.long 1072770661
.long 2333399254
.long 3164546480
.long 1512059493
.long 1072785177
.long 2701510318
.long 1016178092
.long 453379037
.long 1072798965
.long 4046344253
.long 3162814364
.long 1942345162
.long 1072818388
.long 621134147
.long 1016335195
.long 4210176273
.long 1072842164
.long 2701013387
.long 3164326619
.long 4185644010
.long 1072863795
.long 4163699341
.long 1016203112
.long 679688788
.long 1072883543
.long 4147276762
.long 1014066750
.long 29432865
.long 1072901630
.long 970415797
.long 1016902063
.long 4070721092
.long 1072918247
.long 2539004411
.long 3163736096
.long 2252468843
.long 1072933561
.long 3424082887
.long 3163407177
.long 2929724825
.long 1072947712
.long 3661482235
.long 3163846989
.long 1377513368
.long 1072960824
.long 3987926680
.long 1013647908
.long 1031632908
.long 1072973003
.long 3672217151
.long 1016614619
.long 2516508130
.long 1072984342
.long 545855020
.long 3162728930
.long 3792452178
.long 1072994923
.long 3420119467
.long 1016471430
.long 3147791459
.long 1073004818
.long 1342204979
.long 1013937254
.long 999189752
.long 1073014090
.long 1006335472
.long 3162850919
.long 711011011
.long 1073022794
.long 4633488
.long 3162966895
.long 15640363
.long 1073030980
.long 1686389560
.long 3164376226
.long 1218463589
.long 1073042382
.long 1526837110
.long 3163533985
.long 2538470555
.long 1073056144
.long 2273304406
.long 3163784996
.long 1229720947
.long 1073068489
.long 2971628206
.long 3162356540
.long 3115427016
.long 1073079621
.long 4215132957
.long 3164282762
.long 4030612557
.long 1073089709
.long 1913251691
.long 3163671292
.long 2728521257
.long 1073098892
.long 2861089500
.long 1015454459
.long 1118696283
.long 1073107285
.long 1628948053
.long 1016179658
.long 2682711255
.long 1073114984
.long 2906306266
.long 1014142643
.long 2073898081
.long 1073122072
.long 1322740454
.long 3164497217
.long 1403700297
.long 1073128618
.long 416137895
.long 3162781466
.long 2502685617
.long 1073134681
.long 3242008732
.long 1014593495
.long 1531926851
.long 1073140313
.long 1362708094
.long 1016517604
.long 3572814411
.long 1073145557
.long 3709790527
.long 1012646874
.long 1695536111
.long 1073150453
.long 3980346340
.long 1016705136
.long 2363057203
.long 1073155033
.long 2551194792
.long 1012569695
.long 2873365682
.long 1073159327
.long 3181154748
.long 1017041450
.long 1053384691
.long 1073165288
.long 3074536879
.long 1016965660
.long 3270542712
.long 1073172451
.long 2535319415
.long 3163051778
.long 1353631484
.long 1073178850
.long 1173833755
.long 1015534537
.long 3511218460
.long 1073184599
.long 1243608109
.long 3161592122
.long 4121259284
.long 1073189793
.long 398584912
.long 3163829923
.long 1193862106
.long 1073194509
.long 1873745539
.long 3163802819
.long 3861949790
.long 1073198808
.long 3841261147
.long 1015587248
.long 1486904578
.long 1073202745
.long 1634726776
.long 3163847886
.long 2879153715
.long 1073206362
.long 200456242
.long 3164138657
.long 385353253
.long 1073209698
.long 1186355517
.long 1014887155
.long 1125865839
.long 1073212783
.long 203561262
.long 3161244927
.long 1221361475
.long 1073215645
.long 3382476563
.long 1014936138
.long 2077323573
.long 1073218307
.long 1005121005
.long 3164430752
.long 215611373
.long 1073220790
.long 353198764
.long 3164485137
.long 2347419265
.long 1073223110
.long 1103143360
.long 1016542137
.long 1379112765
.long 1073225284
.long 381583533
.long 3162870833
.long 3891198463
.long 1073228298
.long 1771275754
.long 1014654681
.long 3395914051
.long 1073231917
.long 2350900914
.long 3164013978
.long 2799919478
.long 1073235146
.long 2893950164
.long 3163260901
.long 1138673476
.long 1073238045
.long 2622204785
.long 3164174388
.long 3408855940
.long 1073240661
.long 2800881650
.long 1016008624
.long 2044858738
.long 1073243035
.long 604544785
.long 1017022901
.long 2578795176
.long 1073245198
.long 2557332925
.long 1016135165
.long 4196285314
.long 1073247177
.long 2032365307
.long 1016194735
.long 224877747
.long 1073248996
.long 497926916
.long 1016947111
.long 3271386490
.long 1073250671
.long 2689994846
.long 1016631513
.long 813635989
.long 1073252221
.long 747035277
.long 3164530136
.long 369829519
.long 1073253658
.long 2182033858
.long 3163190340
.long 1187679052
.long 1073254994
.long 673954443
.long 1016149821
.long 4232586098
.long 1073256239
.long 497775200
.long 3162179015
.long 426690558
.long 1073257404
.long 3063343247
.long 1016865578
.long 1624065902
.long 1073258494
.long 1354224996
.long 3163503778
.long 1413754136
.long 1073291771
.long 856972295
.long 1016178214
.type atan_tbl,@object
.size atan_tbl,2592
.align 4
pi_table:
.long 1413754136
.long 1073291771
.long 856972295
.long 1016178214
.type pi_table,@object
.size pi_table,16
.align 4
SGNMASK:
.long 4294967295
.long 2147483647
.type SGNMASK,@object
.size SGNMASK,8
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x0000001c
.4byte 0x0000001c
.4byte ..___tag_value_atan.1-.
.4byte ..___tag_value_atan.5-..___tag_value_atan.1
.2byte 0x0400
.4byte ..___tag_value_atan.3-..___tag_value_atan.1
.2byte 0x100e
.byte 0x04
.4byte ..___tag_value_atan.4-..___tag_value_atan.3
.2byte 0x080e
.byte 0x00
# End

754
libm/x86_64/s_cbrt.S Normal file
View File

@ -0,0 +1,754 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Assume x=2^{3*k+j} * 1.b1 b2 ... b5 b6 ... b52, where j = 0,1,2.
// Let r=(x*2^{-3k-j} - 1.b1 b2 ... b5 1)* rcp[b1 b2 ..b5],
// where rcp[b1 b2 .. b5]=1/(1.b1 b2 b3 b4 b5 1) in double precision
// cbrt(2^j * 1. b1 b2 .. b5 1) is approximated as T[j][b1..b5]+D[j][b1..b5]
// (T stores the high 53 bits, D stores the low order bits)
// Result=2^k*T+(2^k*T*r)*P+2^k*D
// where P=p1+p2*r+..+p8*r^7
//
// Special cases:
// cbrt(NaN) = quiet NaN, and raise invalid exception
// cbrt(INF) = that INF
// cbrt(+/-0) = +/-0
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin cbrt
ENTRY(cbrt)
# parameter 1: %xmm0
..B1.1:
..___tag_value_cbrt.1:
subq $24, %rsp
..___tag_value_cbrt.3:
movsd %xmm0, (%rsp)
..B1.2:
movq %xmm0, %xmm7
movl $524032, %edx
movsd EXP_MSK3(%rip), %xmm5
movsd EXP_MSK2(%rip), %xmm3
psrlq $44, %xmm7
pextrw $0, %xmm7, %ecx
movd %xmm7, %eax
movsd EXP_MASK(%rip), %xmm1
movsd SIG_MASK(%rip), %xmm2
andl $248, %ecx
lea rcp_table(%rip), %r8
movsd (%rcx,%r8), %xmm4
movq %rax, %r9
andl %eax, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_0.0.1
cmpl $524032, %edx
je .L_2TAG_PACKET_1.0.1
shrl $8, %edx
shrq $8, %r9
andpd %xmm0, %xmm2
andpd %xmm5, %xmm0
orpd %xmm2, %xmm3
orpd %xmm0, %xmm1
movapd coeff_table(%rip), %xmm5
movl $5462, %eax
movapd 16+coeff_table(%rip), %xmm6
mull %edx
movq %r9, %rdx
andq $2047, %r9
shrl $14, %eax
andl $2048, %edx
subq %rax, %r9
subq %rax, %r9
subq %rax, %r9
shlq $8, %r9
addl $682, %eax
orl %edx, %eax
movd %eax, %xmm7
addq %r9, %rcx
psllq $52, %xmm7
.L_2TAG_PACKET_2.0.1:
movapd 32+coeff_table(%rip), %xmm2
movapd 48+coeff_table(%rip), %xmm0
subsd %xmm3, %xmm1
movq %xmm7, %xmm3
lea cbrt_table(%rip), %r8
mulsd (%rcx,%r8), %xmm7
mulsd %xmm4, %xmm1
lea D_table(%rip), %r8
mulsd (%rcx,%r8), %xmm3
movapd %xmm1, %xmm4
unpcklpd %xmm1, %xmm1
mulpd %xmm1, %xmm5
mulpd %xmm1, %xmm6
mulpd %xmm1, %xmm1
addpd %xmm5, %xmm2
addpd %xmm6, %xmm0
mulpd %xmm1, %xmm2
mulpd %xmm1, %xmm1
mulsd %xmm7, %xmm4
addpd %xmm2, %xmm0
mulsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm4, %xmm0
addsd %xmm3, %xmm0
addsd %xmm7, %xmm0
jmp ..B1.4
.L_2TAG_PACKET_0.0.1:
mulsd SCALE63(%rip), %xmm0
movq %xmm0, %xmm7
movl $524032, %edx
psrlq $44, %xmm7
pextrw $0, %xmm7, %ecx
movd %xmm7, %eax
andl $248, %ecx
lea rcp_table(%rip), %r8
movsd (%rcx,%r8), %xmm4
movq %rax, %r9
andl %eax, %edx
shrl $8, %edx
shrq $8, %r9
cmpl $0, %edx
je .L_2TAG_PACKET_3.0.1
andpd %xmm0, %xmm2
andpd %xmm5, %xmm0
orpd %xmm2, %xmm3
orpd %xmm0, %xmm1
movapd coeff_table(%rip), %xmm5
movl $5462, %eax
movapd 16+coeff_table(%rip), %xmm6
mull %edx
movq %r9, %rdx
andq $2047, %r9
shrl $14, %eax
andl $2048, %edx
subq %rax, %r9
subq %rax, %r9
subq %rax, %r9
shlq $8, %r9
addl $661, %eax
orl %edx, %eax
movd %eax, %xmm7
addq %r9, %rcx
psllq $52, %xmm7
jmp .L_2TAG_PACKET_2.0.1
.L_2TAG_PACKET_3.0.1:
cmpq $0, %r9
jne .L_2TAG_PACKET_4.0.1
xorpd %xmm0, %xmm0
jmp ..B1.4
.L_2TAG_PACKET_4.0.1:
movsd ZERON(%rip), %xmm0
jmp ..B1.4
.L_2TAG_PACKET_1.0.1:
movl 4(%rsp), %eax
movl (%rsp), %edx
movl %eax, %ecx
andl $2147483647, %ecx
cmpl $2146435072, %ecx
ja .L_2TAG_PACKET_5.0.1
cmpl $0, %edx
jne .L_2TAG_PACKET_5.0.1
cmpl $2146435072, %eax
jne .L_2TAG_PACKET_6.0.1
movsd INF(%rip), %xmm0
jmp ..B1.4
.L_2TAG_PACKET_6.0.1:
movsd NEG_INF(%rip), %xmm0
jmp ..B1.4
.L_2TAG_PACKET_5.0.1:
movsd (%rsp), %xmm0
addsd %xmm0, %xmm0
movq %xmm0, 8(%rsp)
.L_2TAG_PACKET_7.0.1:
..B1.4:
addq $24, %rsp
..___tag_value_cbrt.4:
ret
..___tag_value_cbrt.5:
END(cbrt)
# -- End cbrt
.section .rodata, "a"
.align 16
.align 16
coeff_table:
.long 1553778919
.long 3213899486
.long 3534952507
.long 3215266280
.long 1646371399
.long 3214412045
.long 477218588
.long 3216798151
.long 3582521621
.long 1066628362
.long 1007461464
.long 1068473053
.long 889629714
.long 1067378449
.long 1431655765
.long 1070945621
.type coeff_table,@object
.size coeff_table,64
.align 4
EXP_MSK3:
.long 4294967295
.long 1048575
.type EXP_MSK3,@object
.size EXP_MSK3,8
.align 4
EXP_MSK2:
.long 0
.long 3220193280
.type EXP_MSK2,@object
.size EXP_MSK2,8
.align 4
EXP_MASK:
.long 0
.long 3220176896
.type EXP_MASK,@object
.size EXP_MASK,8
.align 4
SIG_MASK:
.long 0
.long 1032192
.type SIG_MASK,@object
.size SIG_MASK,8
.align 4
rcp_table:
.long 528611360
.long 3220144632
.long 2884679527
.long 3220082993
.long 1991868891
.long 3220024928
.long 2298714891
.long 3219970134
.long 58835168
.long 3219918343
.long 3035110223
.long 3219869313
.long 1617585086
.long 3219822831
.long 2500867033
.long 3219778702
.long 4241943008
.long 3219736752
.long 258732970
.long 3219696825
.long 404232216
.long 3219658776
.long 2172167368
.long 3219622476
.long 1544257904
.long 3219587808
.long 377579543
.long 3219554664
.long 1616385542
.long 3219522945
.long 813783277
.long 3219492562
.long 3940743189
.long 3219463431
.long 2689777499
.long 3219435478
.long 1700977147
.long 3219408632
.long 3169102082
.long 3219382828
.long 327235604
.long 3219358008
.long 1244336319
.long 3219334115
.long 1300311200
.long 3219311099
.long 3095471925
.long 3219288912
.long 2166487928
.long 3219267511
.long 2913108253
.long 3219246854
.long 293672978
.long 3219226904
.long 288737297
.long 3219207624
.long 1810275472
.long 3219188981
.long 174592167
.long 3219170945
.long 3539053052
.long 3219153485
.long 2164392968
.long 3219136576
.type rcp_table,@object
.size rcp_table,256
.align 4
cbrt_table:
.long 572345495
.long 1072698681
.long 1998204467
.long 1072709382
.long 3861501553
.long 1072719872
.long 2268192434
.long 1072730162
.long 2981979308
.long 1072740260
.long 270859143
.long 1072750176
.long 2958651392
.long 1072759916
.long 313113243
.long 1072769490
.long 919449400
.long 1072778903
.long 2809328903
.long 1072788162
.long 2222981587
.long 1072797274
.long 2352530781
.long 1072806244
.long 594152517
.long 1072815078
.long 1555767199
.long 1072823780
.long 4282421314
.long 1072832355
.long 2355578597
.long 1072840809
.long 1162590619
.long 1072849145
.long 797864051
.long 1072857367
.long 431273680
.long 1072865479
.long 2669831148
.long 1072873484
.long 733477752
.long 1072881387
.long 4280220604
.long 1072889189
.long 801961634
.long 1072896896
.long 2915370760
.long 1072904508
.long 1159613482
.long 1072912030
.long 2689944798
.long 1072919463
.long 1248687822
.long 1072926811
.long 2967951030
.long 1072934075
.long 630170432
.long 1072941259
.long 3760898254
.long 1072948363
.long 0
.long 1072955392
.long 2370273294
.long 1072962345
.long 1261754802
.long 1072972640
.long 546334065
.long 1072986123
.long 1054893830
.long 1072999340
.long 1571187597
.long 1073012304
.long 1107975175
.long 1073025027
.long 3606909377
.long 1073037519
.long 1113616747
.long 1073049792
.long 4154744632
.long 1073061853
.long 3358931423
.long 1073073713
.long 4060702372
.long 1073085379
.long 747576176
.long 1073096860
.long 3023138255
.long 1073108161
.long 1419988548
.long 1073119291
.long 1914185305
.long 1073130255
.long 294389948
.long 1073141060
.long 3761802570
.long 1073151710
.long 978281566
.long 1073162213
.long 823148820
.long 1073172572
.long 2420954441
.long 1073182792
.long 3815449908
.long 1073192878
.long 2046058587
.long 1073202835
.long 1807524753
.long 1073212666
.long 2628681401
.long 1073222375
.long 3225667357
.long 1073231966
.long 1555307421
.long 1073241443
.long 3454043099
.long 1073250808
.long 1208137896
.long 1073260066
.long 3659916772
.long 1073269218
.long 1886261264
.long 1073278269
.long 3593647839
.long 1073287220
.long 3086012205
.long 1073296075
.long 2769796922
.long 1073304836
.long 888716057
.long 1073317807
.long 2201465623
.long 1073334794
.long 164369365
.long 1073351447
.long 3462666733
.long 1073367780
.long 2773905457
.long 1073383810
.long 1342879088
.long 1073399550
.long 2543933975
.long 1073415012
.long 1684477781
.long 1073430209
.long 3532178543
.long 1073445151
.long 1147747300
.long 1073459850
.long 1928031793
.long 1073474314
.long 2079717015
.long 1073488553
.long 4016765315
.long 1073502575
.long 3670431139
.long 1073516389
.long 3549227225
.long 1073530002
.long 11637607
.long 1073543422
.long 588220169
.long 1073556654
.long 2635407503
.long 1073569705
.long 2042029317
.long 1073582582
.long 1925128962
.long 1073595290
.long 4136375664
.long 1073607834
.long 759964600
.long 1073620221
.long 4257606771
.long 1073632453
.long 297278907
.long 1073644538
.long 3655053093
.long 1073656477
.long 2442253172
.long 1073668277
.long 1111876799
.long 1073679941
.long 3330973139
.long 1073691472
.long 3438879452
.long 1073702875
.long 3671565478
.long 1073714153
.long 1317849547
.long 1073725310
.long 1642364115
.long 1073736348
.type cbrt_table,@object
.size cbrt_table,768
.align 4
D_table:
.long 4050900474
.long 1014427190
.long 1157977860
.long 1016444461
.long 1374568199
.long 1017271387
.long 2809163288
.long 1016882676
.long 3742377377
.long 1013168191
.long 3101606597
.long 1017541672
.long 65224358
.long 1017217597
.long 2691591250
.long 1017266643
.long 4020758549
.long 1017689313
.long 1316310992
.long 1018030788
.long 1031537856
.long 1014090882
.long 3261395239
.long 1016413641
.long 886424999
.long 1016313335
.long 3114776834
.long 1014195875
.long 1681120620
.long 1017825416
.long 1329600273
.long 1016625740
.long 465474623
.long 1017097119
.long 4251633980
.long 1017169077
.long 1986990133
.long 1017710645
.long 752958613
.long 1017159641
.long 2216216792
.long 1018020163
.long 4282860129
.long 1015924861
.long 1557627859
.long 1016039538
.long 3889219754
.long 1018086237
.long 3684996408
.long 1017353275
.long 723532103
.long 1017717141
.long 2951149676
.long 1012528470
.long 831890937
.long 1017830553
.long 1031212645
.long 1017387331
.long 2741737450
.long 1017604974
.long 2863311531
.long 1003776682
.long 4276736099
.long 1013153088
.long 4111778382
.long 1015673686
.long 1728065769
.long 1016413986
.long 2708718031
.long 1018078833
.long 1069335005
.long 1015291224
.long 700037144
.long 1016482032
.long 2904566452
.long 1017226861
.long 4074156649
.long 1017622651
.long 25019565
.long 1015245366
.long 3601952608
.long 1015771755
.long 3267129373
.long 1017904664
.long 503203103
.long 1014921629
.long 2122011730
.long 1018027866
.long 3927295461
.long 1014189456
.long 2790625147
.long 1016024251
.long 1330460186
.long 1016940346
.long 4033568463
.long 1015538390
.long 3695818227
.long 1017509621
.long 257573361
.long 1017208868
.long 3227697852
.long 1017337964
.long 234118548
.long 1017169577
.long 4009025803
.long 1017278524
.long 1948343394
.long 1017749310
.long 678398162
.long 1018144239
.long 3083864863
.long 1016669086
.long 2415453452
.long 1017890370
.long 175467344
.long 1017330033
.long 3197359580
.long 1010339928
.long 2071276951
.long 1015941358
.long 268372543
.long 1016737773
.long 938132959
.long 1017389108
.long 1816750559
.long 1017337448
.long 4119203749
.long 1017152174
.long 2578653878
.long 1013108497
.long 2470331096
.long 1014678606
.long 123855735
.long 1016553320
.long 1265650889
.long 1014782687
.long 3414398172
.long 1017182638
.long 1040773369
.long 1016158401
.long 3483628886
.long 1016886550
.long 4140499405
.long 1016191425
.long 3893477850
.long 1016964495
.long 3935319771
.long 1009634717
.long 2978982660
.long 1015027112
.long 2452709923
.long 1017990229
.long 3190365712
.long 1015835149
.long 4237588139
.long 1015832925
.long 2610678389
.long 1017962711
.long 2127316774
.long 1017405770
.long 824267502
.long 1017959463
.long 2165924042
.long 1017912225
.long 2774007076
.long 1013257418
.long 4123916326
.long 1017582284
.long 1976417958
.long 1016959909
.long 4092806412
.long 1017711279
.long 119251817
.long 1015363631
.long 3475418768
.long 1017675415
.long 1972580503
.long 1015470684
.long 815541017
.long 1017517969
.long 2429917451
.long 1017397776
.long 4062888482
.long 1016749897
.long 68284153
.long 1017925678
.long 2207779246
.long 1016320298
.long 1183466520
.long 1017408657
.long 143326427
.long 1017060403
.type D_table,@object
.size D_table,768
.align 4
SCALE63:
.long 0
.long 1138753536
.type SCALE63,@object
.size SCALE63,8
.align 4
ZERON:
.long 0
.long 2147483648
.type ZERON,@object
.size ZERON,8
.align 4
INF:
.long 0
.long 2146435072
.type INF,@object
.size INF,8
.align 4
NEG_INF:
.long 0
.long 4293918720
.type NEG_INF,@object
.size NEG_INF,8
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x0000001c
.4byte 0x0000001c
.4byte ..___tag_value_cbrt.1-.
.4byte ..___tag_value_cbrt.5-..___tag_value_cbrt.1
.2byte 0x0400
.4byte ..___tag_value_cbrt.3-..___tag_value_cbrt.1
.2byte 0x200e
.byte 0x04
.4byte ..___tag_value_cbrt.4-..___tag_value_cbrt.3
.2byte 0x080e
.byte 0x00
# End

1275
libm/x86_64/s_cos.S Normal file

File diff suppressed because it is too large Load Diff

727
libm/x86_64/s_expm1.S Normal file
View File

@ -0,0 +1,727 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Description:
// Let K = 64 (table size).
//
// Four sub-domains:
// 1. |x| < 1/(2*K)
// expm1(x) ~ P(x)
// 2. 1/(2*K) <= |x| <= 56*log(2)
// x x/log(2) n
// e - 1 = 2 = 2 * T[j] * (1 + P(y)) - 1
// 3. 56*log(2) < x < MAX_LOG
// x x x/log(2) n
// e - 1 ~ e = 2 = 2 * T[j] * (1 + P(y))
// 4. x < -56*log(2)
// x x
// e - 1 = -1 + e ~ -1
// where
// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K]
// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2]
// j/K
// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]).
//
// P(y) is a minimax polynomial approximation of exp(x)-1
// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V).
//
// In case 3, to avoid problems with arithmetic overflow and underflow,
// n n1 n2
// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2]
// and BIAS is a value of exponent bias.
//
// Special cases:
// expm1(NaN) is NaN
// expm1(+INF) is +INF
// expm1(-INF) is -1
// expm1(x) is x for subnormals
// for finite argument, only expm1(0)=0 is exact.
// For IEEE double
// if x > 709.782712893383973096 then expm1(x) overflow
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin expm1
ENTRY(expm1)
# parameter 1: %xmm0
..B1.1:
..___tag_value_expm1.1:
subq $56, %rsp
..___tag_value_expm1.3:
movsd %xmm0, 32(%rsp)
..B1.2:
unpcklpd %xmm0, %xmm0
movapd cv(%rip), %xmm1
movapd Shifter(%rip), %xmm6
movapd 16+cv(%rip), %xmm2
movapd 32+cv(%rip), %xmm3
pextrw $3, %xmm0, %eax
andl $32767, %eax
movl $16527, %edx
subl %eax, %edx
subl $16304, %eax
orl %eax, %edx
cmpl $-2147483648, %edx
jae .L_2TAG_PACKET_0.0.2
mulpd %xmm0, %xmm1
addpd %xmm6, %xmm1
movapd %xmm1, %xmm7
subpd %xmm6, %xmm1
mulpd %xmm1, %xmm2
movapd 48+cv(%rip), %xmm4
mulpd %xmm1, %xmm3
movapd 64+cv(%rip), %xmm5
subpd %xmm2, %xmm0
movd %xmm7, %eax
movl %eax, %ecx
andl $63, %ecx
shll $4, %ecx
sarl $6, %eax
movl %eax, %edx
subpd %xmm3, %xmm0
lea Tbl_addr(%rip), %r11
movapd (%rcx,%r11), %xmm2
movq 80+cv(%rip), %xmm3
mulpd %xmm0, %xmm4
movapd %xmm0, %xmm1
mulpd %xmm0, %xmm0
mulsd %xmm0, %xmm3
addpd %xmm4, %xmm5
mulsd %xmm0, %xmm0
movq %xmm2, %xmm4
unpckhpd %xmm2, %xmm2
movdqa mmask(%rip), %xmm6
pand %xmm6, %xmm7
movdqa bias(%rip), %xmm6
paddq %xmm6, %xmm7
psllq $46, %xmm7
mulsd %xmm0, %xmm3
mulpd %xmm5, %xmm0
addl $894, %edx
cmpl $1916, %edx
ja .L_2TAG_PACKET_1.0.2
addsd %xmm3, %xmm0
xorpd %xmm3, %xmm3
movl $16368, %eax
pinsrw $3, %eax, %xmm3
orpd %xmm7, %xmm2
mulsd %xmm4, %xmm7
movq %xmm3, %xmm6
addsd %xmm1, %xmm3
pextrw $3, %xmm2, %edx
pshufd $238, %xmm0, %xmm5
psrlq $38, %xmm3
psllq $38, %xmm3
movq %xmm2, %xmm4
subsd %xmm3, %xmm6
addsd %xmm5, %xmm0
addsd %xmm6, %xmm1
addsd %xmm7, %xmm4
mulsd %xmm3, %xmm7
mulsd %xmm2, %xmm3
xorpd %xmm5, %xmm5
movl $16368, %eax
pinsrw $3, %eax, %xmm5
addsd %xmm1, %xmm0
movl $17184, %ecx
subl %edx, %ecx
subl $16256, %edx
orl %edx, %ecx
jl .L_2TAG_PACKET_2.0.2
mulsd %xmm4, %xmm0
subsd %xmm5, %xmm3
addsd %xmm7, %xmm0
addsd %xmm3, %xmm0
.L_2TAG_PACKET_3.0.2:
jmp ..B1.5
.L_2TAG_PACKET_2.0.2:
cmpl $0, %edx
jl .L_2TAG_PACKET_4.0.2
mulsd %xmm4, %xmm0
subsd %xmm5, %xmm7
addsd %xmm7, %xmm0
addsd %xmm3, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_4.0.2:
mulsd %xmm4, %xmm0
addsd %xmm7, %xmm0
addsd %xmm3, %xmm0
subsd %xmm5, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_1.0.2:
movl 36(%rsp), %ecx
addsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0
addsd %xmm1, %xmm0
cmpl $0, %ecx
jl .L_2TAG_PACKET_5.0.2
fstcw (%rsp)
movw (%rsp), %dx
orw $768, %dx
movw %dx, 4(%rsp)
fldcw 4(%rsp)
movl %eax, %edx
sarl $1, %eax
subl %eax, %edx
movdqa emask(%rip), %xmm6
pandn %xmm2, %xmm6
addl $1023, %eax
movd %eax, %xmm3
psllq $52, %xmm3
orpd %xmm3, %xmm6
mulsd %xmm3, %xmm4
movsd %xmm0, 16(%rsp)
fldl 16(%rsp)
movsd %xmm6, 24(%rsp)
fldl 24(%rsp)
movsd %xmm4, 16(%rsp)
fldl 16(%rsp)
addl $1023, %edx
movd %edx, %xmm4
psllq $52, %xmm4
faddp %st, %st(1)
fmul %st, %st(1)
faddp %st, %st(1)
movsd %xmm4, 24(%rsp)
fldl 24(%rsp)
fmulp %st, %st(1)
fstpl 16(%rsp)
movsd 16(%rsp), %xmm0
fldcw (%rsp)
pextrw $3, %xmm0, %ecx
andl $32752, %ecx
cmpl $32752, %ecx
jae .L_2TAG_PACKET_6.0.2
jmp ..B1.5
cmpl $-2147483648, %ecx
jb .L_2TAG_PACKET_6.0.2
jmp ..B1.5
.L_2TAG_PACKET_6.0.2:
movl $41, 8(%rsp)
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_8.0.2:
cmpl $2146435072, %eax
jae .L_2TAG_PACKET_9.0.2
movsd XMAX(%rip), %xmm0
mulsd %xmm0, %xmm0
movl $41, 8(%rsp)
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_9.0.2:
movl 36(%rsp), %eax
movl 32(%rsp), %edx
movl %eax, %ecx
andl $2147483647, %eax
cmpl $2146435072, %eax
ja .L_2TAG_PACKET_10.0.2
cmpl $0, %edx
jne .L_2TAG_PACKET_10.0.2
cmpl $0, %ecx
jl .L_2TAG_PACKET_11.0.2
movq INF(%rip), %xmm0
jmp ..B1.5
.L_2TAG_PACKET_11.0.2:
jmp .L_2TAG_PACKET_5.0.2
.L_2TAG_PACKET_10.0.2:
movsd 32(%rsp), %xmm0
addsd %xmm0, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_12.0.2:
addl $16304, %eax
cmpl $15504, %eax
jb .L_2TAG_PACKET_13.0.2
movapd cvl(%rip), %xmm2
pshufd $68, %xmm0, %xmm1
movapd 16+cvl(%rip), %xmm3
movapd 32+cvl(%rip), %xmm4
movq 48+cvl(%rip), %xmm5
mulsd %xmm1, %xmm1
xorpd %xmm6, %xmm6
movl $16352, %eax
pinsrw $3, %eax, %xmm6
mulpd %xmm0, %xmm2
xorpd %xmm7, %xmm7
movl $16368, %edx
pinsrw $3, %edx, %xmm7
addpd %xmm3, %xmm2
mulsd %xmm1, %xmm5
pshufd $228, %xmm1, %xmm3
mulpd %xmm1, %xmm1
mulsd %xmm0, %xmm6
mulpd %xmm0, %xmm2
addpd %xmm4, %xmm2
movq %xmm7, %xmm4
addsd %xmm6, %xmm7
mulpd %xmm3, %xmm1
psrlq $27, %xmm7
psllq $27, %xmm7
movq HIGHMASK(%rip), %xmm3
subsd %xmm7, %xmm4
mulpd %xmm1, %xmm2
addsd %xmm4, %xmm6
pshufd $238, %xmm2, %xmm1
addsd %xmm2, %xmm6
andpd %xmm0, %xmm3
movq %xmm0, %xmm4
addsd %xmm6, %xmm1
subsd %xmm3, %xmm0
addsd %xmm5, %xmm1
mulsd %xmm7, %xmm3
mulsd %xmm7, %xmm0
mulsd %xmm1, %xmm4
addsd %xmm4, %xmm0
addsd %xmm3, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_13.0.2:
cmpl $16, %eax
jae .L_2TAG_PACKET_3.0.2
movq %xmm0, %xmm2
movd %xmm0, %eax
psrlq $31, %xmm2
movd %xmm2, %ecx
orl %ecx, %eax
je .L_2TAG_PACKET_3.0.2
movl $16, %edx
xorpd %xmm1, %xmm1
pinsrw $3, %edx, %xmm1
mulsd %xmm1, %xmm1
movl $42, 8(%rsp)
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_0.0.2:
cmpl $0, %eax
jl .L_2TAG_PACKET_12.0.2
movl 36(%rsp), %eax
cmpl $1083179008, %eax
jge .L_2TAG_PACKET_8.0.2
cmpl $-1048576, %eax
jae .L_2TAG_PACKET_9.0.2
.L_2TAG_PACKET_5.0.2:
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_7.0.2:
movq %xmm0, 40(%rsp)
..B1.3:
movq 40(%rsp), %xmm0
.L_2TAG_PACKET_14.0.2:
..B1.5:
addq $56, %rsp
..___tag_value_expm1.4:
ret
..___tag_value_expm1.5:
END(expm1)
# -- End expm1
.section .rodata, "a"
.align 16
.align 16
cv:
.long 1697350398
.long 1079448903
.long 1697350398
.long 1079448903
.long 4277796864
.long 1065758274
.long 4277796864
.long 1065758274
.long 3164486458
.long 1025308570
.long 3164486458
.long 1025308570
.long 1963358694
.long 1065423121
.long 1431655765
.long 1069897045
.long 1431655765
.long 1067799893
.long 0
.long 1071644672
.long 381774871
.long 1062650220
.long 381774871
.long 1062650220
.type cv,@object
.size cv,96
.align 16
Shifter:
.long 0
.long 1127743488
.long 0
.long 1127743488
.type Shifter,@object
.size Shifter,16
.align 16
Tbl_addr:
.long 0
.long 0
.long 0
.long 0
.long 1000070955
.long 1042145304
.long 1040187392
.long 11418
.long 988267849
.long 1039500660
.long 3539992576
.long 22960
.long 36755401
.long 1042114290
.long 402653184
.long 34629
.long 3634769483
.long 1042178627
.long 1820327936
.long 46424
.long 2155991225
.long 1041560680
.long 847249408
.long 58348
.long 2766913307
.long 1039293264
.long 3489660928
.long 70401
.long 3651174602
.long 1040488175
.long 2927624192
.long 82586
.long 3073892131
.long 1042240606
.long 1006632960
.long 94904
.long 1328391742
.long 1042019037
.long 3942645760
.long 107355
.long 2650893825
.long 1041903210
.long 822083584
.long 119943
.long 2397289153
.long 1041802037
.long 2281701376
.long 132667
.long 430997175
.long 1042110606
.long 1845493760
.long 145530
.long 1230936525
.long 1041801015
.long 1702887424
.long 158533
.long 740675935
.long 1040178913
.long 4110417920
.long 171677
.long 3489810261
.long 1041825986
.long 2793406464
.long 184965
.long 2532600530
.long 1040767882
.long 167772160
.long 198398
.long 3542557060
.long 1041827263
.long 2986344448
.long 211976
.long 1401563777
.long 1041061093
.long 922746880
.long 225703
.long 3129406026
.long 1041852413
.long 880803840
.long 239579
.long 900993572
.long 1039283234
.long 1275068416
.long 253606
.long 2115029358
.long 1042140042
.long 562036736
.long 267786
.long 1086643152
.long 1041785419
.long 1610612736
.long 282120
.long 82864366
.long 1041256244
.long 3045064704
.long 296610
.long 2392968152
.long 1040913683
.long 3573547008
.long 311258
.long 2905856183
.long 1040002214
.long 1988100096
.long 326066
.long 3742008261
.long 1040011137
.long 1451229184
.long 341035
.long 863393794
.long 1040880621
.long 914358272
.long 356167
.long 1446136837
.long 1041372426
.long 3707764736
.long 371463
.long 927855201
.long 1040617636
.long 360710144
.long 386927
.long 1492679939
.long 1041050306
.long 2952790016
.long 402558
.long 608827001
.long 1041582217
.long 2181038080
.long 418360
.long 606260204
.long 1042271987
.long 1711276032
.long 434334
.long 3163044019
.long 1041843851
.long 1006632960
.long 450482
.long 4148747325
.long 1041962972
.long 3900702720
.long 466805
.long 802924201
.long 1041275378
.long 1442840576
.long 483307
.long 3052749833
.long 1041940577
.long 1937768448
.long 499988
.long 2216116399
.long 1041486744
.long 914358272
.long 516851
.long 2729697836
.long 1041445764
.long 2566914048
.long 533897
.long 540608356
.long 1041310907
.long 2600468480
.long 551129
.long 2916344493
.long 1040535661
.long 1107296256
.long 568549
.long 731391814
.long 1039497014
.long 2566914048
.long 586158
.long 1024722704
.long 1041461625
.long 2961178624
.long 603959
.long 3806831748
.long 1041732499
.long 2675965952
.long 621954
.long 238953304
.long 1040316488
.long 2189426688
.long 640145
.long 749123235
.long 1041725785
.long 2063597568
.long 658534
.long 1168187977
.long 1041175214
.long 2986344448
.long 677123
.long 3506096399
.long 1042186095
.long 1426063360
.long 695915
.long 1470221620
.long 1041675499
.long 2566914048
.long 714911
.long 3182425146
.long 1041483134
.long 3087007744
.long 734114
.long 3131698208
.long 1042208657
.long 4068474880
.long 753526
.long 2300504125
.long 1041428596
.long 2415919104
.long 773150
.long 2290297931
.long 1037388400
.long 3716153344
.long 792987
.long 3532148223
.long 1041626194
.long 771751936
.long 813041
.long 1161884404
.long 1042015258
.long 3699376128
.long 833312
.long 876383176
.long 1037968878
.long 1241513984
.long 853805
.long 3379986796
.long 1042213153
.long 3699376128
.long 874520
.long 1545797737
.long 1041681569
.long 58720256
.long 895462
.long 2925146801
.long 1042212567
.long 855638016
.long 916631
.long 1316627971
.long 1038516204
.long 3883925504
.long 938030
.long 3267869137
.long 1040337004
.long 2726297600
.long 959663
.long 3720868999
.long 1041782409
.long 3992977408
.long 981531
.long 433316142
.long 1041994064
.long 1526726656
.long 1003638
.long 781232103
.long 1040093400
.long 2172649472
.long 1025985
.type Tbl_addr,@object
.size Tbl_addr,1024
.align 16
mmask:
.long 4294967232
.long 0
.long 4294967232
.long 0
.type mmask,@object
.size mmask,16
.align 16
bias:
.long 65472
.long 0
.long 65472
.long 0
.type bias,@object
.size bias,16
.align 16
emask:
.long 0
.long 4293918720
.long 0
.long 4293918720
.type emask,@object
.size emask,16
.align 16
cvl:
.long 2773927732
.long 1053236707
.long 381774871
.long 1062650220
.long 379653899
.long 1056571845
.long 286331153
.long 1065423121
.long 436314138
.long 1059717536
.long 1431655765
.long 1067799893
.long 1431655765
.long 1069897045
.long 0
.long 1071644672
.type cvl,@object
.size cvl,64
.align 8
XMAX:
.long 4294967295
.long 2146435071
.type XMAX,@object
.size XMAX,8
.align 8
INF:
.long 0
.long 2146435072
.type INF,@object
.size INF,8
.align 8
HIGHMASK:
.long 4227858432
.long 4294967295
.type HIGHMASK,@object
.size HIGHMASK,8
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x0000001c
.4byte 0x0000001c
.4byte ..___tag_value_expm1.1-.
.4byte ..___tag_value_expm1.5-..___tag_value_expm1.1
.2byte 0x0400
.4byte ..___tag_value_expm1.3-..___tag_value_expm1.1
.2byte 0x400e
.byte 0x04
.4byte ..___tag_value_expm1.4-..___tag_value_expm1.3
.2byte 0x080e
.byte 0x00
# End

829
libm/x86_64/s_log1p.S Normal file
View File

@ -0,0 +1,829 @@
/*
Copyright (c) 2014, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************/
// ALGORITHM DESCRIPTION
// ---------------------
//
// Let x=2^k * mx, mx in [1,2)
//
// Get B~1/mx based on the output of rcpps instruction (B0)
// B = int((B0*2^7+0.5))/2^7
//
// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts)
//
// Result: k*log(2) - log(B) + p(r)
// p(r) is a degree 7 polynomial
// -log(B) read from data table (high, low parts)
// Result is formed from high and low parts
//
// Special cases:
// log1p(NaN) = quiet NaN, and raise invalid exception
// log1p(+INF) = that INF
// log1p(x) = NaN if x < -1 or x = -INF, and raises invalid exception
// log1p(-1) = -INF, and raises divide-by-zero exception
// log1p(+/-0) = +/-0
//
/******************************************************************************/
#include <private/bionic_asm.h>
# -- Begin log1p
ENTRY(log1p)
# parameter 1: %xmm0
..B1.1:
..___tag_value_log1p.1:
subq $24, %rsp
..___tag_value_log1p.3:
movsd %xmm0, 8(%rsp)
..B1.2:
movq $0x3ff0000000000000, %rax
movd %rax, %xmm2
xorpd %xmm3, %xmm3
movl $32768, %ecx
movd %rcx, %xmm4
movq $0xffffe00000000000, %r8
movd %r8, %xmm5
movddup %xmm0, %xmm7
pshufd $68, %xmm2, %xmm6
pextrw $3, %xmm0, %ecx
addsd %xmm2, %xmm0
movq %xmm0, %xmm1
pextrw $3, %xmm0, %eax
subsd %xmm0, %xmm6
orpd %xmm2, %xmm0
psrlq $27, %xmm0
lea L_tbl(%rip), %r11
psrld $2, %xmm0
subl $16, %eax
cmpl $32736, %eax
jae .L_2TAG_PACKET_0.0.2
addsd %xmm6, %xmm7
rcpps %xmm0, %xmm0
psllq $12, %xmm1
pshufd $228, %xmm5, %xmm6
psrlq $12, %xmm1
andl $32752, %ecx
cmpl $16256, %ecx
jb .L_2TAG_PACKET_1.0.2
andl $32752, %eax
movl $32720, %ecx
subl %eax, %ecx
pinsrw $3, %ecx, %xmm3
.L_2TAG_PACKET_2.0.2:
mulsd %xmm3, %xmm7
paddd %xmm4, %xmm0
movq $0x3800000000000000, %rcx
movd %rcx, %xmm4
orpd %xmm2, %xmm1
movd %xmm0, %edx
psllq $29, %xmm0
andpd %xmm1, %xmm5
andpd %xmm6, %xmm0
subsd %xmm5, %xmm1
paddd %xmm4, %xmm0
mulsd %xmm0, %xmm5
movl $16352, %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm4
mulsd %xmm0, %xmm7
mulsd %xmm0, %xmm1
movq log2(%rip), %xmm6
movapd coeff(%rip), %xmm3
subsd %xmm2, %xmm5
andl $16711680, %edx
shrl $12, %edx
movapd (%r11,%rdx), %xmm0
movapd 16+coeff(%rip), %xmm2
addsd %xmm5, %xmm1
movq %xmm1, %xmm5
addsd %xmm7, %xmm1
subsd %xmm1, %xmm5
addsd %xmm5, %xmm7
mulsd %xmm4, %xmm6
mulsd 8+log2(%rip), %xmm4
mulsd %xmm1, %xmm3
movddup %xmm1, %xmm5
addsd %xmm6, %xmm0
mulpd %xmm5, %xmm2
mulpd %xmm5, %xmm5
movddup %xmm0, %xmm6
addsd %xmm1, %xmm0
addpd 32+coeff(%rip), %xmm2
mulpd %xmm5, %xmm3
subsd %xmm0, %xmm6
mulsd %xmm1, %xmm2
addsd %xmm7, %xmm4
mulsd %xmm1, %xmm7
addsd %xmm6, %xmm1
pshufd $238, %xmm0, %xmm6
mulsd %xmm5, %xmm5
addsd %xmm6, %xmm4
subsd %xmm7, %xmm1
addpd %xmm3, %xmm2
addsd %xmm4, %xmm1
mulpd %xmm5, %xmm2
addsd %xmm2, %xmm1
pshufd $238, %xmm2, %xmm5
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_0.0.2:
movq 8(%rsp), %xmm0
movq 8(%rsp), %xmm1
addl $16, %eax
cmpl $32768, %eax
jae .L_2TAG_PACKET_3.0.2
cmpl $0, %eax
je .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_5.0.2:
addsd %xmm0, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_6.0.2:
ja .L_2TAG_PACKET_5.0.2
cmpl $0, %edx
ja .L_2TAG_PACKET_5.0.2
jmp .L_2TAG_PACKET_7.0.2
.L_2TAG_PACKET_3.0.2:
movd %xmm1, %edx
psrlq $32, %xmm1
movd %xmm1, %ecx
addl %ecx, %ecx
cmpl $-2097152, %ecx
jae .L_2TAG_PACKET_6.0.2
orl %ecx, %edx
cmpl $0, %edx
je .L_2TAG_PACKET_4.0.2
.L_2TAG_PACKET_7.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $32752, %eax
pinsrw $3, %eax, %xmm1
movl $141, (%rsp)
mulsd %xmm1, %xmm0
jmp .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_4.0.2:
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
movl $49136, %eax
pinsrw $3, %eax, %xmm0
divsd %xmm1, %xmm0
movl $140, (%rsp)
jmp .L_2TAG_PACKET_8.0.2
.L_2TAG_PACKET_1.0.2:
movq 8(%rsp), %xmm0
cmpl $15504, %ecx
jb .L_2TAG_PACKET_9.0.2
movapd coeff2(%rip), %xmm1
pshufd $68, %xmm0, %xmm0
movapd 16+coeff2(%rip), %xmm2
pshufd $68, %xmm0, %xmm4
movapd 32+coeff2(%rip), %xmm3
mulpd %xmm0, %xmm1
xorpd %xmm6, %xmm6
mulpd %xmm4, %xmm4
addpd %xmm2, %xmm1
pshufd $68, %xmm4, %xmm5
mulpd %xmm0, %xmm4
movl $49120, %eax
pinsrw $3, %eax, %xmm6
mulpd %xmm0, %xmm1
mulsd %xmm4, %xmm4
addpd %xmm3, %xmm1
mulsd %xmm6, %xmm5
mulpd %xmm4, %xmm1
pshufd $238, %xmm1, %xmm7
addsd %xmm7, %xmm1
addsd %xmm5, %xmm1
addsd %xmm1, %xmm0
jmp ..B1.5
.L_2TAG_PACKET_9.0.2:
cmpl $16, %ecx
jb .L_2TAG_PACKET_10.0.2
jmp ..B1.5
.L_2TAG_PACKET_10.0.2:
movq %xmm0, %xmm1
mulsd %xmm1, %xmm1
jmp ..B1.5
.L_2TAG_PACKET_8.0.2:
movq %xmm0, 16(%rsp)
..B1.3:
movq 16(%rsp), %xmm0
.L_2TAG_PACKET_11.0.2:
..B1.5:
addq $24, %rsp
..___tag_value_log1p.4:
ret
..___tag_value_log1p.5:
END(log1p)
# -- End log1p
.section .rodata, "a"
.align 16
.align 16
L_tbl:
.long 4277811200
.long 1072049730
.long 2479318832
.long 1026487127
.long 2854492160
.long 1072033410
.long 215631550
.long 1025638968
.long 1547061248
.long 1072017216
.long 2886781435
.long 1026423395
.long 649825280
.long 1072001146
.long 4281533405
.long 1024038923
.long 646346752
.long 1071985198
.long 1562735921
.long 1023790276
.long 2203734016
.long 1071969370
.long 1838397691
.long 3173936209
.long 1872169984
.long 1071953661
.long 3981202460
.long 1022325013
.long 669557760
.long 1071938069
.long 4182597802
.long 3173174122
.long 4076413952
.long 1071922591
.long 1209029111
.long 3170736207
.long 556125184
.long 1071907228
.long 821086028
.long 3173437049
.long 204914688
.long 1071891976
.long 2097025986
.long 3171071798
.long 387545088
.long 1071876834
.long 3142936996
.long 3173092218
.long 2912783360
.long 1071861800
.long 2502420140
.long 1024505919
.long 1144260608
.long 1071846874
.long 3315658140
.long 3173469843
.long 1471209472
.long 1071832053
.long 129621009
.long 3172443877
.long 1829683200
.long 1071817336
.long 3885467693
.long 1025535275
.long 288676864
.long 1071802722
.long 86139472
.long 3171639793
.long 3636378624
.long 1071788208
.long 1850238587
.long 1024654342
.long 1606817792
.long 1071773795
.long 3388899795
.long 3173675586
.long 1236164608
.long 1071759480
.long 3983599207
.long 1020046558
.long 1089616896
.long 1071745262
.long 4171974224
.long 1024773198
.long 4143093760
.long 1071731139
.long 2727587401
.long 3173965207
.long 600267776
.long 1071717112
.long 3147685042
.long 3173353031
.long 2249313280
.long 1071703177
.long 125835074
.long 1025255832
.long 3805303808
.long 1071689334
.long 2289991207
.long 1025460331
.long 87278592
.long 1071675583
.long 1106114045
.long 1025933602
.long 3195405312
.long 1071661920
.long 3885316576
.long 3171206239
.long 3853649920
.long 1071648346
.long 2977069852
.long 3171236771
.long 2944026624
.long 1071625048
.long 1008093493
.long 1023444474
.long 3993180160
.long 1071598247
.long 1862355595
.long 1024642533
.long 1454641152
.long 1071571617
.long 1514603089
.long 1026500596
.long 3286085632
.long 1071545154
.long 1400028424
.long 3173279056
.long 438773760
.long 1071518858
.long 120727864
.long 3172148914
.long 1212979200
.long 1071492725
.long 1625055594
.long 3172901933
.long 1189017600
.long 1071466754
.long 3920062376
.long 1025727407
.long 403064832
.long 1071440943
.long 1053271728
.long 3171391427
.long 3343210496
.long 1071415289
.long 3243395502
.long 3173627613
.long 1765777408
.long 1071389792
.long 2145968512
.long 1026354304
.long 461430784
.long 1071364449
.long 4094322285
.long 1026021467
.long 71706624
.long 1071339258
.long 763632021
.long 1024496933
.long 1380503552
.long 1071314217
.long 1383547992
.long 3173088453
.long 1015732224
.long 1071289325
.long 3198646877
.long 1025390322
.long 35977216
.long 1071264580
.long 2141026805
.long 1025754693
.long 3927306240
.long 1071239979
.long 282116272
.long 3173394334
.long 1125341184
.long 1071215523
.long 2768427504
.long 3172279059
.long 1666971648
.long 1071191208
.long 786837629
.long 3172427445
.long 2827694080
.long 1071167033
.long 3857122416
.long 3173014241
.long 2003683328
.long 1071142997
.long 859010954
.long 1026545007
.long 1004017664
.long 1071119098
.long 3356644970
.long 3173458064
.long 1753020416
.long 1071095334
.long 788338552
.long 1026157693
.long 1992718336
.long 1071071704
.long 1239179443
.long 1026394889
.long 3870234624
.long 1071048206
.long 2082614663
.long 1024926053
.long 1050437632
.long 1071024840
.long 660007840
.long 1025548499
.long 188395520
.long 1071001603
.long 3878792704
.long 3173889571
.long 3747176448
.long 1070978493
.long 144991708
.long 3171552042
.long 1405669376
.long 1070955511
.long 3999088879
.long 1025486317
.long 121151488
.long 1070932654
.long 2170865497
.long 1026473584
.long 2652319744
.long 1070909920
.long 453695652
.long 3173916809
.long 3262236672
.long 1070887309
.long 157800053
.long 3173984206
.long 601221120
.long 1070864820
.long 3968917661
.long 1023992886
.long 1999843328
.long 1070842450
.long 3053895004
.long 1024998228
.long 1992167424
.long 1070820199
.long 2968614856
.long 1024552653
.long 3788726272
.long 1070798065
.long 3542170808
.long 3173573242
.long 2094829568
.long 1070776048
.long 1246758132
.long 1026202874
.long 288675840
.long 1070754146
.long 3747328950
.long 1026331585
.long 1829681152
.long 1070732357
.long 3125197546
.long 1024100318
.long 1666869248
.long 1070710681
.long 1363656119
.long 1026336493
.long 3417110528
.long 1070689116
.long 4154791553
.long 1026267853
.long 2183653376
.long 1070667662
.long 1671819292
.long 3173785870
.long 1734434816
.long 1070646317
.long 373091049
.long 1025972363
.long 1615681536
.long 1070625080
.long 384650897
.long 1022926043
.long 1445382144
.long 1070603950
.long 344320330
.long 3172397196
.long 1823715328
.long 1070569756
.long 3389841200
.long 1025231852
.long 3839688704
.long 1070527917
.long 1706790417
.long 3167363349
.long 4293332992
.long 1070486286
.long 1614935088
.long 1019351591
.long 2966720512
.long 1070444861
.long 4145393717
.long 3173711658
.long 4066729984
.long 1070403639
.long 1974925028
.long 3171437182
.long 3337621504
.long 1070362619
.long 3314953170
.long 3169971314
.long 943448064
.long 1070321799
.long 1498682038
.long 3173862340
.long 1465634816
.long 1070281176
.long 1319952810
.long 3171693965
.long 1015734272
.long 1070240749
.long 1347821929
.long 3173544515
.long 118001664
.long 1070200516
.long 1751482746
.long 1026134093
.long 3707174912
.long 1070160474
.long 1486946159
.long 1023930920
.long 3946381312
.long 1070120623
.long 2867408081
.long 3171368276
.long 1699848192
.long 1070080961
.long 2590187139
.long 1025379803
.long 2235846656
.long 1070041485
.long 1888568069
.long 3172754960
.long 2339729408
.long 1070002194
.long 3852214753
.long 3173323149
.long 3196850176
.long 1069963086
.long 742141560
.long 1025101707
.long 1800683520
.long 1069924160
.long 3949500444
.long 3172102179
.long 3835801600
.long 1069885413
.long 3848895943
.long 1025913832
.long 2201202688
.long 1069846845
.long 1425913464
.long 1025868665
.long 2778279936
.long 1069808453
.long 2120889677
.long 3173831128
.long 2954203136
.long 1069770236
.long 592147081
.long 1019621288
.long 210141184
.long 1069732193
.long 3414275233
.long 1023647084
.long 709476352
.long 1069694321
.long 2413027164
.long 1024462115
.long 2116284416
.long 1069656619
.long 1144559924
.long 1026336654
.long 2183651328
.long 1069619086
.long 3459057650
.long 1025634168
.long 3047047168
.long 1069581720
.long 1879674924
.long 3173508573
.long 970711040
.long 1069541521
.long 1335954173
.long 3173332182
.long 2198478848
.long 1069467449
.long 2951103968
.long 3173892200
.long 1669611520
.long 1069393703
.long 531044147
.long 1025149248
.long 29114368
.long 1069320280
.long 3327831251
.long 1025918673
.long 2376949760
.long 1069247176
.long 737634533
.long 3172176000
.long 1085390848
.long 1069174390
.long 3108243400
.long 3171828406
.long 1566130176
.long 1069101918
.long 985483226
.long 1025708380
.long 792780800
.long 1069029758
.long 4184866295
.long 1024426204
.long 183156736
.long 1068957907
.long 2845699378
.long 1022107277
.long 1301782528
.long 1068886362
.long 1012735262
.long 3173804294
.long 1562411008
.long 1068815121
.long 2197086703
.long 3170187813
.long 2815549440
.long 1068744181
.long 2782613207
.long 1026345054
.long 2756124672
.long 1068673540
.long 2929486205
.long 3173037800
.long 3511050240
.long 1068603195
.long 1443733147
.long 3173331549
.long 3047047168
.long 1068533144
.long 1879674924
.long 3172459997
.long 3221667840
.long 1068427825
.long 1338588027
.long 3171815742
.long 3453861888
.long 1068288883
.long 1205348359
.long 3172624626
.long 3506110464
.long 1068150514
.long 893105198
.long 1025571866
.long 346013696
.long 1068012714
.long 3495569021
.long 3172563349
.long 4074029056
.long 1067875476
.long 3961106338
.long 3171065595
.long 3559784448
.long 1067738798
.long 1975385384
.long 3173783155
.long 797769728
.long 1067602675
.long 3760305787
.long 1026047642
.long 2313633792
.long 1067467101
.long 1559353171
.long 1023480256
.long 3960766464
.long 1067213778
.long 1067365107
.long 1025865926
.long 684261376
.long 1066944805
.long 844762164
.long 3173687482
.long 630718464
.long 1066676905
.long 2458269694
.long 1024033081
.long 1486061568
.long 1066410070
.long 115537874
.long 3173243995
.long 2743664640
.long 1065886792
.long 3665098304
.long 3173471607
.long 1971912704
.long 1065357333
.long 2577214440
.long 3171993451
.long 1498939392
.long 1064306693
.long 3409036923
.long 1025599151
.long 0
.long 0
.long 0
.long 2147483648
.type L_tbl,@object
.size L_tbl,2064
.align 16
log2:
.long 4277811200
.long 1067855426
.long 2479318832
.long 1022292823
.type log2,@object
.size log2,16
.align 16
coeff:
.long 2454267026
.long 1069697316
.long 0
.long 3218079744
.long 1030730101
.long 3217380702
.long 1431655765
.long 1070945621
.long 2576980378
.long 1070176665
.long 0
.long 3219128320
.type coeff,@object
.size coeff,48
.align 16
coeff2:
.long 0
.long 3217031168
.long 2576980378
.long 1070176665
.long 2454267026
.long 1069697316
.long 0
.long 3218079744
.long 1431655765
.long 3217380693
.long 1431655765
.long 1070945621
.type coeff2,@object
.size coeff2,48
.data
.section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
.align 1
.4byte 0x00000014
.8byte 0x00527a0100000000
.8byte 0x08070c1b01107801
.4byte 0x00000190
.4byte 0x0000001c
.4byte 0x0000001c
.4byte ..___tag_value_log1p.1-.
.4byte ..___tag_value_log1p.5-..___tag_value_log1p.1
.2byte 0x0400
.4byte ..___tag_value_log1p.3-..___tag_value_log1p.1
.2byte 0x200e
.byte 0x04
.4byte ..___tag_value_log1p.4-..___tag_value_log1p.3
.2byte 0x080e
.byte 0x00
# End

1300
libm/x86_64/s_sin.S Normal file

File diff suppressed because it is too large Load Diff

2239
libm/x86_64/s_tan.S Normal file

File diff suppressed because it is too large Load Diff

1392
libm/x86_64/s_tanh.S Normal file

File diff suppressed because it is too large Load Diff