mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 21:10:07 +00:00
5a82c74822
Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
115 lines
3.2 KiB
ArmAsm
115 lines
3.2 KiB
ArmAsm
/* ix87 specific implementation of exp(x)-1.
|
|
Copyright (C) 1996-2019 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
|
Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
|
|
Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
/* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
|
|
|
|
#include <sysdep.h>
|
|
#include <machine/asm.h>
|
|
#include <i386-math-asm.h>
|
|
#include <libm-alias-float.h>
|
|
|
|
.section .rodata
|
|
|
|
.align ALIGNARG(4)
|
|
.type minus1,@object
|
|
minus1: .double -1.0
|
|
ASM_SIZE_DIRECTIVE(minus1)
|
|
.type one,@object
|
|
one: .double 1.0
|
|
ASM_SIZE_DIRECTIVE(one)
|
|
.type l2e,@object
|
|
l2e: .tfloat 1.442695040888963407359924681002
|
|
ASM_SIZE_DIRECTIVE(l2e)
|
|
|
|
DEFINE_FLT_MIN
|
|
|
|
#ifdef PIC
|
|
#define MO(op) op##@GOTOFF(%edx)
|
|
#else
|
|
#define MO(op) op
|
|
#endif
|
|
|
|
.text
|
|
ENTRY(__expm1f)
|
|
movzwl 4+2(%esp), %eax
|
|
xorb $0x80, %ah // invert sign bit (now 1 is "positive")
|
|
cmpl $0xc2b1, %eax // is num >= 88.5?
|
|
jae HIDDEN_JUMPTARGET (__expf)
|
|
|
|
flds 4(%esp) // x
|
|
fxam // Is NaN, +-Inf or +-0?
|
|
xorb $0x80, %ah
|
|
cmpl $0xc190, %eax // is num <= -18.0?
|
|
fstsw %ax
|
|
movb $0x45, %ch
|
|
jb 4f
|
|
|
|
// Below -18.0 (may be -NaN or -Inf).
|
|
andb %ah, %ch
|
|
#ifdef PIC
|
|
LOAD_PIC_REG (dx)
|
|
#endif
|
|
cmpb $0x01, %ch
|
|
je 5f // If -NaN, jump.
|
|
jmp 2f // -large, possibly -Inf.
|
|
|
|
4: // In range -18.0 to 88.5 (may be +-0 but not NaN or +-Inf).
|
|
andb %ah, %ch
|
|
cmpb $0x40, %ch
|
|
je 3f // If +-0, jump.
|
|
#ifdef PIC
|
|
LOAD_PIC_REG (dx)
|
|
#endif
|
|
|
|
5: fldt MO(l2e) // log2(e) : x
|
|
fmulp // log2(e)*x
|
|
fld %st // log2(e)*x : log2(e)*x
|
|
// Set round-to-nearest temporarily.
|
|
subl $8, %esp
|
|
cfi_adjust_cfa_offset (8)
|
|
fstcw 4(%esp)
|
|
movl $0xf3ff, %ecx
|
|
andl 4(%esp), %ecx
|
|
movl %ecx, (%esp)
|
|
fldcw (%esp)
|
|
frndint // int(log2(e)*x) : log2(e)*x
|
|
fldcw 4(%esp)
|
|
addl $8, %esp
|
|
cfi_adjust_cfa_offset (-8)
|
|
fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x)
|
|
fxch // fract(log2(e)*x) : int(log2(e)*x)
|
|
f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x)
|
|
fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
|
|
fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
|
fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
|
fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
|
fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
|
fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
|
fsubrp %st, %st(1) // 2^(log2(e)*x)
|
|
FLT_CHECK_FORCE_UFLOW
|
|
ret
|
|
|
|
2: fstp %st
|
|
fldl MO(minus1) // Set result to -1.0.
|
|
3: ret
|
|
END(__expm1f)
|
|
libm_alias_float (__expm1, expm1)
|