update from main archive 961229

Mon Dec 30 01:32:59 1996  Ulrich Drepper  <drepper@cygnus.com>

	* tme/localtime.c: Rewrite so that localtime_r does not call tzset,
	but localtime does.

	* features.h: Rename ANSI C to ISO C.
	Mention __GLIBC__ and __GLIBC_MINOR__ macros.

	* gnu-versions.h: Add _GNU_GETOPT_INTERFACE_VERSION.
	* posix/getopt.c: Use _GNU_GETOPT_INTERFACE_VERSION to check
	whether we can elide the code.
	* posix/getopt1.c: Likewise.
	* posix/Makefile: Correct copyright.

	* elf/dl-error.c (_dl_catch_error): Clear `catch' also when error
	occurred.
	* elf/dl-support.c (_dl_sysdep_open_zero_fill): Don't define if
	MAP_ANON is defined.
	* elf/eval.c: Use __getline instead of getline.
	* elf/rtld.c (dl_main): Check return value of _dl_new_object
	function for NULL.
	* sysdeps/generic/dl-cache.c: Update copyright.

	* signal/Makefile: Correct copyright.
	(routines): Remove gsignal and ssignal.  Add bsd_signal.
	* signal/gsignal.c: Removed.  Now is made an alias.
	* signal/ssignal.c: Likewise.
	* sysdeps/posix/raise.c: Add alias gsignal.
	* sysdeps/stub/raise.c: Likewise.
	* sysdeps/posix/signal.c: Add alias ssignal.
	* sysdeps/stub/signal.c: Likewise.
	* signal/signal.h: Declare bsd_signal.  Define signal as bsd_signal
	if __FAVOR_BSD.
	* sysdeps/posix/bsd_signal.c: New file.  Implementation of XPG
	function.

	* sysdeps/unix/sysv/linux/signal.c: Add explanation.

	* socket/sys/un.h: Define SUN_LEN according to POSIX.1g.

	* stdio-common/Makefile (tests): Add scanf10.
	* stdio-common/scanf10.c: New file.
	* stdio-common/vfscanf.c: Decrement counter if EOF is read while
	reading string.

	* sysdeps/libm-i387/e_acos.S: Use END, not PSEUDO_END.
	* sysdeps/libm-i387/e_acosl.S: Likewise.
	* sysdeps/libm-i387/e_asin.S: Likewise.
	* sysdeps/libm-i387/e_asinl.S: Likewise.
	* sysdeps/libm-i387/e_atan2.S: Likewise.
	* sysdeps/libm-i387/e_atan2f.S: Likewise.
	* sysdeps/libm-i387/e_atan2l.S: Likewise.
	* sysdeps/libm-i387/e_exp.S: Likewise.
	* sysdeps/libm-i387/e_expl.S: Likewise.
	* sysdeps/libm-i387/e_fmod.S: Likewise.
	* sysdeps/libm-i387/e_fmodl.S: Likewise.
	* sysdeps/libm-i387/e_log.S: Likewise.
	* sysdeps/libm-i387/e_log10.S: Likewise.
	* sysdeps/libm-i387/e_log10l.S: Likewise.
	* sysdeps/libm-i387/e_logl.S: Likewise.
	* sysdeps/libm-i387/e_remainder.S: Likewise.
	* sysdeps/libm-i387/e_remainderf.S: Likewise.
	* sysdeps/libm-i387/e_remainderl.S: Likewise.
	* sysdeps/libm-i387/e_scalb.S: Likewise.
	* sysdeps/libm-i387/e_scalbl.S: Likewise.
	* sysdeps/libm-i387/e_sqrt.S: Likewise.
	* sysdeps/libm-i387/e_sqrtf.S: Likewise.
	* sysdeps/libm-i387/e_sqrtl.S: Likewise.
	* sysdeps/libm-i387/s_atan.S: Likewise.
	* sysdeps/libm-i387/s_atanf.S: Likewise.
	* sysdeps/libm-i387/s_atanl.S: Likewise.
	* sysdeps/libm-i387/s_ceil.S: Likewise.
	* sysdeps/libm-i387/s_ceilf.S: Likewise.
	* sysdeps/libm-i387/s_ceill.S: Likewise.
	* sysdeps/libm-i387/s_copysign.S: Likewise.
	* sysdeps/libm-i387/s_copysignf.S: Likewise.
	* sysdeps/libm-i387/s_copysignl.S: Likewise.
	* sysdeps/libm-i387/s_cos.S: Likewise.
	* sysdeps/libm-i387/s_cosf.S: Likewise.
	* sysdeps/libm-i387/s_cosl.S: Likewise.
	* sysdeps/libm-i387/s_finite.S: Likewise.
	* sysdeps/libm-i387/s_finitef.S: Likewise.
	* sysdeps/libm-i387/s_finitel.S: Likewise.
	* sysdeps/libm-i387/s_floor.S: Likewise.
	* sysdeps/libm-i387/s_floorf.S: Likewise.
	* sysdeps/libm-i387/s_floorl.S: Likewise.
	* sysdeps/libm-i387/s_ilogb.S: Likewise.
	* sysdeps/libm-i387/s_ilogbf.S: Likewise.
	* sysdeps/libm-i387/s_ilogbl.S: Likewise.
	* sysdeps/libm-i387/s_log1p.S: Likewise.
	* sysdeps/libm-i387/s_log1pf.S: Likewise.
	* sysdeps/libm-i387/s_log1pl.S: Likewise.
	* sysdeps/libm-i387/s_logb.S: Likewise.
	* sysdeps/libm-i387/s_logbf.S: Likewise.
	* sysdeps/libm-i387/s_logbl.S: Likewise.
	* sysdeps/libm-i387/s_rint.S: Likewise.
	* sysdeps/libm-i387/s_rintf.S: Likewise.
	* sysdeps/libm-i387/s_rintl.S: Likewise.
	* sysdeps/libm-i387/s_scalbn.S: Likewise.
	* sysdeps/libm-i387/s_scalbnf.S: Likewise.
	* sysdeps/libm-i387/s_scalbnl.S: Likewise.
	* sysdeps/libm-i387/s_significand.S: Likewise.
	* sysdeps/libm-i387/s_significandf.S: Likewise.
	* sysdeps/libm-i387/s_significandl.S: Likewise.
	* sysdeps/libm-i387/s_sin.S: Likewise.
	* sysdeps/libm-i387/s_sinf.S: Likewise.
	* sysdeps/libm-i387/s_sinl.S: Likewise.

	* sysdeps/libm-i387/e_log.S: Use fyl2xp1 instruction for values
	near 1 to increase precision.
	* sysdeps/libm-i387/e_log10.S: Likewise.
	* sysdeps/libm-i387/e_log10l.S: Likewise.
	* sysdeps/libm-i387/e_logl.S: Likewise.

	* sysdeps/libm-i387/s_cos.S: Use testl instead of andw.
	* sysdeps/libm-i387/s_cosl.S: Likewise.
	* sysdeps/libm-i387/s_sin.S: Likewise.
	* sysdeps/libm-i387/s_sinl.S: Likewise.
	* sysdeps/libm-i387/s_tan.S: Likewise.
	* sysdeps/libm-i387/s_tanl.S: Likewise.

	* sysdeps/libm-i387/e_acosf.S: New file.  Add float versions.
	* sysdeps/libm-i387/e_asinf.S: Likewise.
	* sysdeps/libm-i387/e_expf.S: Likewise.
	* sysdeps/libm-i387/e_fmodf.S: Likewise.
	* sysdeps/libm-i387/e_log10f.S: Likewise.
	* sysdeps/libm-i387/e_logf.S: Likewise.
	* sysdeps/libm-i387/e_scalbf.S: Likewise.

	* sysdeps/libm-i387/e_acosh.S: New file.  Highly optimized versions.
	* sysdeps/libm-i387/e_acoshf.S: Likewise.
	* sysdeps/libm-i387/e_acoshl.S: Likewise.
	* sysdeps/libm-i387/e_atanh.S: Likewise.
	* sysdeps/libm-i387/e_atanhf.S: Likewise.
	* sysdeps/libm-i387/e_atanhl.S: Likewise.
	* sysdeps/libm-i387/e_asinh.S: Likewise.
	* sysdeps/libm-i387/e_asinhf.S: Likewise.
	* sysdeps/libm-i387/e_asinhl.S: Likewise.

	* sysdeps/libm-ieee754/s_asinhf.c: Tweak a bit.  Use lower levels
	for simplified handling.

	* sysdeps/unix/sysv/linux/syscalls.list: Add query_module.

Sun Dec 22 01:39:29 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* inet/rcmd.c (rcmd): Set h_errno before calling herror.
	* inet/rexec.c (rexec): Likewise.

Sat Dec 21 21:47:08 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/m68k/setjmp.c (__setjmp): Make it really
	compatible.

Sun Dec 22 03:23:33 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/libm-i387/s_log1p.S: Use fyl2xp1 for numbers in range
	-0.29 <= x <= 0.29, otherwise the old method.
	* sysdeps/libm-i387/s_log1pf.S: Likewise.
	* sysdeps/libm-i387/s_log1pl.S: Likewise.
This commit is contained in:
Ulrich Drepper 1996-12-30 01:47:46 +00:00
parent 01c901a56b
commit d38cd08ca3
113 changed files with 2191 additions and 353 deletions

161
ChangeLog
View File

@ -1,3 +1,164 @@
Mon Dec 30 01:32:59 1996 Ulrich Drepper <drepper@cygnus.com>
* tme/localtime.c: Rewrite so that localtime_r does not call tzset,
but localtime does.
* features.h: Rename ANSI C to ISO C.
Mention __GLIBC__ and __GLIBC_MINOR__ macros.
* gnu-versions.h: Add _GNU_GETOPT_INTERFACE_VERSION.
* posix/getopt.c: Use _GNU_GETOPT_INTERFACE_VERSION to check
whether we can elide the code.
* posix/getopt1.c: Likewise.
* posix/Makefile: Correct copyright.
* elf/dl-error.c (_dl_catch_error): Clear `catch' also when error
occurred.
* elf/dl-support.c (_dl_sysdep_open_zero_fill): Don't define if
MAP_ANON is defined.
* elf/eval.c: Use __getline instead of getline.
* elf/rtld.c (dl_main): Check return value of _dl_new_object
function for NULL.
* sysdeps/generic/dl-cache.c: Update copyright.
* signal/Makefile: Correct copyright.
(routines): Remove gsignal and ssignal. Add bsd_signal.
* signal/gsignal.c: Removed. Now is made an alias.
* signal/ssignal.c: Likewise.
* sysdeps/posix/raise.c: Add alias gsignal.
* sysdeps/stub/raise.c: Likewise.
* sysdeps/posix/signal.c: Add alias ssignal.
* sysdeps/stub/signal.c: Likewise.
* signal/signal.h: Declare bsd_signal. Define signal as bsd_signal
if __FAVOR_BSD.
* sysdeps/posix/bsd_signal.c: New file. Implementation of XPG
function.
* sysdeps/unix/sysv/linux/signal.c: Add explanation.
* socket/sys/un.h: Define SUN_LEN according to POSIX.1g.
* stdio-common/Makefile (tests): Add scanf10.
* stdio-common/scanf10.c: New file.
* stdio-common/vfscanf.c: Decrement counter if EOF is read while
reading string.
* sysdeps/libm-i387/e_acos.S: Use END, not PSEUDO_END.
* sysdeps/libm-i387/e_acosl.S: Likewise.
* sysdeps/libm-i387/e_asin.S: Likewise.
* sysdeps/libm-i387/e_asinl.S: Likewise.
* sysdeps/libm-i387/e_atan2.S: Likewise.
* sysdeps/libm-i387/e_atan2f.S: Likewise.
* sysdeps/libm-i387/e_atan2l.S: Likewise.
* sysdeps/libm-i387/e_exp.S: Likewise.
* sysdeps/libm-i387/e_expl.S: Likewise.
* sysdeps/libm-i387/e_fmod.S: Likewise.
* sysdeps/libm-i387/e_fmodl.S: Likewise.
* sysdeps/libm-i387/e_log.S: Likewise.
* sysdeps/libm-i387/e_log10.S: Likewise.
* sysdeps/libm-i387/e_log10l.S: Likewise.
* sysdeps/libm-i387/e_logl.S: Likewise.
* sysdeps/libm-i387/e_remainder.S: Likewise.
* sysdeps/libm-i387/e_remainderf.S: Likewise.
* sysdeps/libm-i387/e_remainderl.S: Likewise.
* sysdeps/libm-i387/e_scalb.S: Likewise.
* sysdeps/libm-i387/e_scalbl.S: Likewise.
* sysdeps/libm-i387/e_sqrt.S: Likewise.
* sysdeps/libm-i387/e_sqrtf.S: Likewise.
* sysdeps/libm-i387/e_sqrtl.S: Likewise.
* sysdeps/libm-i387/s_atan.S: Likewise.
* sysdeps/libm-i387/s_atanf.S: Likewise.
* sysdeps/libm-i387/s_atanl.S: Likewise.
* sysdeps/libm-i387/s_ceil.S: Likewise.
* sysdeps/libm-i387/s_ceilf.S: Likewise.
* sysdeps/libm-i387/s_ceill.S: Likewise.
* sysdeps/libm-i387/s_copysign.S: Likewise.
* sysdeps/libm-i387/s_copysignf.S: Likewise.
* sysdeps/libm-i387/s_copysignl.S: Likewise.
* sysdeps/libm-i387/s_cos.S: Likewise.
* sysdeps/libm-i387/s_cosf.S: Likewise.
* sysdeps/libm-i387/s_cosl.S: Likewise.
* sysdeps/libm-i387/s_finite.S: Likewise.
* sysdeps/libm-i387/s_finitef.S: Likewise.
* sysdeps/libm-i387/s_finitel.S: Likewise.
* sysdeps/libm-i387/s_floor.S: Likewise.
* sysdeps/libm-i387/s_floorf.S: Likewise.
* sysdeps/libm-i387/s_floorl.S: Likewise.
* sysdeps/libm-i387/s_ilogb.S: Likewise.
* sysdeps/libm-i387/s_ilogbf.S: Likewise.
* sysdeps/libm-i387/s_ilogbl.S: Likewise.
* sysdeps/libm-i387/s_log1p.S: Likewise.
* sysdeps/libm-i387/s_log1pf.S: Likewise.
* sysdeps/libm-i387/s_log1pl.S: Likewise.
* sysdeps/libm-i387/s_logb.S: Likewise.
* sysdeps/libm-i387/s_logbf.S: Likewise.
* sysdeps/libm-i387/s_logbl.S: Likewise.
* sysdeps/libm-i387/s_rint.S: Likewise.
* sysdeps/libm-i387/s_rintf.S: Likewise.
* sysdeps/libm-i387/s_rintl.S: Likewise.
* sysdeps/libm-i387/s_scalbn.S: Likewise.
* sysdeps/libm-i387/s_scalbnf.S: Likewise.
* sysdeps/libm-i387/s_scalbnl.S: Likewise.
* sysdeps/libm-i387/s_significand.S: Likewise.
* sysdeps/libm-i387/s_significandf.S: Likewise.
* sysdeps/libm-i387/s_significandl.S: Likewise.
* sysdeps/libm-i387/s_sin.S: Likewise.
* sysdeps/libm-i387/s_sinf.S: Likewise.
* sysdeps/libm-i387/s_sinl.S: Likewise.
* sysdeps/libm-i387/e_log.S: Use fyl2xp1 instruction for values
near 1 to increase precision.
* sysdeps/libm-i387/e_log10.S: Likewise.
* sysdeps/libm-i387/e_log10l.S: Likewise.
* sysdeps/libm-i387/e_logl.S: Likewise.
* sysdeps/libm-i387/s_cos.S: Use testl instead of andw.
* sysdeps/libm-i387/s_cosl.S: Likewise.
* sysdeps/libm-i387/s_sin.S: Likewise.
* sysdeps/libm-i387/s_sinl.S: Likewise.
* sysdeps/libm-i387/s_tan.S: Likewise.
* sysdeps/libm-i387/s_tanl.S: Likewise.
* sysdeps/libm-i387/e_acosf.S: New file. Add float versions.
* sysdeps/libm-i387/e_asinf.S: Likewise.
* sysdeps/libm-i387/e_expf.S: Likewise.
* sysdeps/libm-i387/e_fmodf.S: Likewise.
* sysdeps/libm-i387/e_log10f.S: Likewise.
* sysdeps/libm-i387/e_logf.S: Likewise.
* sysdeps/libm-i387/e_scalbf.S: Likewise.
* sysdeps/libm-i387/e_acosh.S: New file. Highly optimized versions.
* sysdeps/libm-i387/e_acoshf.S: Likewise.
* sysdeps/libm-i387/e_acoshl.S: Likewise.
* sysdeps/libm-i387/e_atanh.S: Likewise.
* sysdeps/libm-i387/e_atanhf.S: Likewise.
* sysdeps/libm-i387/e_atanhl.S: Likewise.
* sysdeps/libm-i387/e_asinh.S: Likewise.
* sysdeps/libm-i387/e_asinhf.S: Likewise.
* sysdeps/libm-i387/e_asinhl.S: Likewise.
* sysdeps/libm-ieee754/s_asinhf.c: Tweak a bit. Use lower levels
for simplified handling.
* sysdeps/unix/sysv/linux/syscalls.list: Add query_module.
Sun Dec 22 01:39:29 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* inet/rcmd.c (rcmd): Set h_errno before calling herror.
* inet/rexec.c (rexec): Likewise.
Sat Dec 21 21:47:08 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/setjmp.c (__setjmp): Make it really
compatible.
Sun Dec 22 03:23:33 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-i387/s_log1p.S: Use fyl2xp1 for numbers in range
-0.29 <= x <= 0.29, otherwise the old method.
* sysdeps/libm-i387/s_log1pf.S: Likewise.
* sysdeps/libm-i387/s_log1pl.S: Likewise.
Sun Dec 22 00:01:27 1996 Ulrich Drepper <drepper@cygnus.com>
* inet/getnetgrent.c: Reformat copyright.

View File

@ -90,6 +90,7 @@ _dl_catch_error (char **errstring,
}
/* We get here only if we longjmp'd out of OPERATE. */
catch = NULL;
*errstring = c.errstring;
*objname = c.objname;
return errcode == -1 ? 0 : errcode;

View File

@ -33,6 +33,7 @@ char **_dl_argv = &__progname; /* This is checked for some error messages. */
For the dynamic linker it is set by -rpath when linking. */
const char *_dl_rpath = DEFAULT_RPATH;
#ifndef MAP_ANON
/* This is the only dl-sysdep.c function that is actually needed at run-time
by _dl_map_object. */
@ -41,6 +42,7 @@ _dl_sysdep_open_zero_fill (void)
{
return __open ("/dev/zero", O_RDONLY);
}
#endif
/* This should never be called. */
void

View File

@ -128,7 +128,7 @@ _start (void)
char *buf = NULL;
size_t bufsz = 0;
while (getline (&buf, &bufsz, stdin) > 0)
while (__getline (&buf, &bufsz, stdin) > 0)
{
char *p = buf;
eval (&p);

View File

@ -236,6 +236,8 @@ of this helper program; chances are you did not intend to run this program.\n",
/* Create a link_map for the executable itself.
This will be what dlopen on "" returns. */
l = _dl_new_object ((char *) "", "", lt_executable);
if (l == NULL)
_dl_sysdep_fatal ("cannot allocate memory for link map", NULL);
l->l_phdr = phdr;
l->l_phnum = phent;
l->l_entry = *user_entry;

View File

@ -23,14 +23,14 @@
/* These are defined by the user (or the compiler)
to specify the desired environment:
__STRICT_ANSI__ ANSI Standard C.
__STRICT_ANSI__ ISO Standard C.
_POSIX_SOURCE IEEE Std 1003.1.
_POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
if >=199309L, add IEEE Std 1003.1b-1993
_XOPEN_SOURCE Includes POSIX and XPG things.
_XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
_BSD_SOURCE ANSI, POSIX, and 4.3BSD things.
_SVID_SOURCE ANSI, POSIX, and SVID things.
_BSD_SOURCE ISO C, POSIX, and 4.3BSD things.
_SVID_SOURCE ISO C, POSIX, and SVID things.
_GNU_SOURCE All of the above, plus GNU extensions.
_REENTRANT Select additionally reentrant object.
_THREAD_SAFE Same as _REENTRANT, often used by other systems.
@ -39,7 +39,7 @@
If none of these are defined, the default is all but _GNU_SOURCE.
If more than one of these are defined, they accumulate.
For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
together give you ANSI C, 1003.1, and 1003.2, but nothing else.
together give you ISO C, 1003.1, and 1003.2, but nothing else.
These are defined by this file and are used by the
header files to decide what to declare or define:
@ -56,7 +56,10 @@
__USE_REENTRANT Define reentrant/thread-safe *_r functions.
__FAVOR_BSD Favor 4.3BSD things in cases of conflict.
The macro `__GNU_LIBRARY__' is defined by this file unconditionally.
The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
defined by this file unconditionally. `__GNU_LIBRARY__' is provided
only for compatibility. All new code should use the other symbols
to test for features.
All macros listed above as possibly being defined by this file are
explicitly undefined if they are not explicitly defined.
@ -85,15 +88,15 @@
# define __KERNEL_STRICT_NAMES
#endif
/* Always use ANSI things. */
/* Always use ISO C things. */
#define __USE_ANSI 1
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined (_BSD_SOURCE) && \
!(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || \
defined (_XOPEN_SOURCE) || defined (_XOPEN_SOURCE_DEFINED) || \
defined (_GNU_SOURCE) || defined (_SVID_SOURCE))
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_DEFINED || \
defined _GNU_SOURCE || defined _SVID_SOURCE)
# define __FAVOR_BSD 1
#endif
@ -115,37 +118,35 @@
/* If nothing (other than _GNU_SOURCE) is defined,
define _BSD_SOURCE and _SVID_SOURCE. */
#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \
!defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE) && \
!defined (_XOPEN_SOURCE_EXTENDED) && !defined (_BSD_SOURCE) && \
!defined (_SVID_SOURCE))
#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
!defined _POSIX_C_SOURCE && !defined _XOPEN_SOURCE && \
!defined _XOPEN_SOURCE_EXTENDED && !defined _BSD_SOURCE && \
!defined _SVID_SOURCE)
#define _BSD_SOURCE 1
#define _SVID_SOURCE 1
#endif
/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
(and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */
#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \
!defined (_POSIX_C_SOURCE))
#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
!defined _POSIX_C_SOURCE)
#define _POSIX_SOURCE 1
#if defined(_XOPEN_SOURCE)
#ifdef _XOPEN_SOURCE
#define _POSIX_C_SOURCE 2
#else
#define _POSIX_C_SOURCE 199309L
#endif
#endif
#if (defined (_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1 || \
defined (_XOPEN_SOURCE))
#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
#define __USE_POSIX 1
#endif
#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2 || \
defined (_XOPEN_SOURCE))
#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
#define __USE_POSIX2 1
#endif
#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L)
#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L
#define __USE_POSIX199309 1
#endif
@ -156,7 +157,7 @@
#endif
#endif
#if defined (_BSD_SOURCE) || defined (_SVID_SOURCE)
#if defined _BSD_SOURCE || defined _SVID_SOURCE
#define __USE_MISC 1
#endif
@ -172,7 +173,7 @@
#define __USE_GNU 1
#endif
#if defined (_REENTRANT) || defined (_THREAD_SAFE)
#if defined _REENTRANT || defined _THREAD_SAFE
#define __USE_REENTRANT 1
#endif
@ -192,7 +193,7 @@
#define __GLIBC_MINOR__ 0
#if !defined (__GNUC__) || __GNUC__ < 2
#if !defined __GNUC__ || __GNUC__ < 2
/* In GCC version 2, (__extension__ EXPR) will not complain
about GCC extensions used in EXPR under -ansi or -pedantic. */
#define __extension__

View File

@ -47,5 +47,7 @@
#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */
#define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */
#define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */
#define _GNU_GETOPT_INTERFACE_VERSION 1 /* vs posix/getopt.c and
posix/getopt1.c */
#endif /* gnu-versions.h */

View File

@ -83,6 +83,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
&hp, &herr) < 0)
if (herr != NETDB_INTERNAL || errno != ERANGE)
{
__set_h_errno (herr);
herror(*ahost);
return -1;
}
@ -322,7 +323,7 @@ again:
char *pbuf;
size_t dirlen;
size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
char buffer = __alloca (buflen);
char *buffer = __alloca (buflen);
first = 0;
if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)

View File

@ -71,6 +71,7 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
&hp, &herr) < 0)
if (herr != NETDB_INTERNAL || errno != ERANGE)
{
__set_h_errno (herr);
herror(*ahost);
return -1;
}

View File

@ -43,7 +43,6 @@ _IO_vsprintf (string, format, args)
_IO_init (&sf._sbf._f, 0);
_IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps;
_IO_str_init_static (&sf._sbf._f, string, -1, string);
_IO_str_init_static ((_IO_FILE *) &sf, string, -1, string);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf);
_IO_flockfile (&sf._sbf._f);
ret = _IO_vfprintf (&sf._sbf._f, format, args);

View File

@ -12,9 +12,9 @@
# Library General Public License for more details.
# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB. If
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.
# License along with the GNU C Library; see the file COPYING.LIB. If not,
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# Sub-makefile for POSIX portion of the library.

View File

@ -52,7 +52,15 @@
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#define GETOPT_INTERFACE_VERSION 1
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
@ -124,8 +132,14 @@ char *optarg = NULL;
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* 1003.2 says this must be 1 before any call. */
int optind = 1;
/* Formerly, initialization of getopt depended on optind==0, which
causes problems with re-calling getopt as programs generally don't
know that. */
int __getopt_initialized = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
@ -431,10 +445,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
optarg = NULL;
if (optind == 0)
if (!__getopt_initialized)
{
optstring = _getopt_initialize (optstring);
optind = 1; /* Don't scan ARGV[0], the program name. */
__getopt_initialized = 1;
}
/* Test whether ARGV[optind] points to a non-option argument.
@ -500,6 +515,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
/* Before we can be provide the next result we must be
reinitialized. */
__getopt_initialized = 0;
return EOF;
}
@ -509,7 +529,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (NONOPTION_P)
{
if (ordering == REQUIRE_ORDER)
return EOF;
{
/* Before we can be provide the next result we must be
reinitialized. */
__getopt_initialized = 0;
return EOF;
}
optarg = argv[optind++];
return 1;
}
@ -880,7 +905,7 @@ getopt (argc, argv, optstring)
0);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#endif /* Not ELIDE_CODE. */
#ifdef TEST

View File

@ -1,24 +1,24 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 1996
Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -44,15 +44,21 @@ Cambridge, MA 02139, USA. */
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#define GETOPT_INTERFACE_VERSION 1
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#else
char *getenv ();
#endif
#ifndef NULL
@ -87,7 +93,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#endif /* Not ELIDE_CODE. */
#ifdef TEST

View File

@ -12,9 +12,9 @@
# Library General Public License for more details.
# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB. If
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.
# License along with the GNU C Library; see the file COPYING.LIB. If not,
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# Makefile for signal routines.
@ -30,7 +30,7 @@ routines := signal raise killpg \
sigstack sigaltstack sigintr \
sigsetops sigempty sigfillset sigaddset sigdelset sigismem \
sigreturn \
gsignal ssignal siggetmask
siggetmask bsd_signal
tests := tst-signal

View File

@ -1,28 +0,0 @@
/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <signal.h>
#undef gsignal
int
gsignal (sig)
int sig;
{
return raise (sig);
}

View File

@ -22,7 +22,7 @@
#ifndef _SIGNAL_H
#if !defined(__need_sig_atomic_t) && !defined(__need_sigset_t)
#if !defined __need_sig_atomic_t && !defined __need_sigset_t
#define _SIGNAL_H 1
#include <features.h>
#endif
@ -32,15 +32,15 @@ __BEGIN_DECLS
#include <gnu/types.h>
#include <sigset.h> /* __sigset_t, __sig_atomic_t. */
#if !defined(__sig_atomic_t_defined) && \
(defined(_SIGNAL_H) || defined(__need_sig_atomic_t))
#if !defined __sig_atomic_t_defined \
&& (defined _SIGNAL_H || defined __need_sig_atomic_t)
/* An integral type that can be modified atomically, without the
possibility of a signal arriving in the middle of the operation. */
typedef __sig_atomic_t sig_atomic_t;
#endif /* `sig_atomic_t' undefined and <signal.h> or need `sig_atomic_t'. */
#undef __need_sig_atomic_t
#undef __need_sig_atomic_t
#ifdef _SIGNAL_H
#ifdef _SIGNAL_H
#include <signum.h>
@ -51,15 +51,27 @@ typedef void (*__sighandler_t) __P ((int));
returning the old handler, or SIG_ERR on error. */
extern __sighandler_t signal __P ((int __sig, __sighandler_t __handler));
#if defined __FAVOR_BSD || defined __USE_XOPEN
/* The X/Open definition of `signal' conflicts with the BSD version.
So they defined another function `bsd_signal'. We will use this
implementation as the official `signal' function if the BSD
interface is preferred. */
extern __sighandler_t bsd_signal __P ((int __sig, __sighandler_t __handler));
#ifdef __FAVOR_BSD
#define signal(sig, handler) bsd_signal ((sig), (handler))
#endif
#endif
/* Send signal SIG to process number PID. If PID is zero,
send SIG to all processes in the current process's process group.
If PID is < -1, send SIG to all processes in process group - PID. */
extern int __kill __P ((__pid_t __pid, int __sig));
#ifdef __USE_POSIX
#ifdef __USE_POSIX
extern int kill __P ((__pid_t __pid, int __sig));
#endif /* Use POSIX. */
#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Send SIG to all processes in process group PGRP.
If PGRP is zero, send SIG to all processes in
the current process's process group. */
@ -69,13 +81,13 @@ extern int killpg __P ((__pid_t __pgrp, int __sig));
/* Raise signal SIG, i.e., send SIG to yourself. */
extern int raise __P ((int __sig));
#ifdef __USE_SVID
#ifdef __USE_SVID
/* SVID names for the same things. */
extern __sighandler_t ssignal __P ((int __sig, __sighandler_t __handler));
extern int gsignal __P ((int __sig));
#endif /* Use SVID. */
#ifdef __USE_MISC
#ifdef __USE_MISC
/* Print a message describing the meaning of the given signal number. */
extern void psignal __P ((int __sig, __const char *__s));
#endif /* Use misc. */
@ -95,7 +107,7 @@ extern int __sigsetmask __P ((int __mask));
explitcly selects the BSD version. */
extern int __sigpause __P ((int __sig_or_mask, int __is_sig));
#if defined(__USE_BSD) && !defined(__USE_XOPEN)
#if defined __USE_BSD && !defined __USE_XOPEN
/* Set the mask of blocked signals to MASK,
wait for a signal to arrive, and then restore the mask. */
#define sigpause(mask) __sigpause ((mask), 0)
@ -107,7 +119,7 @@ extern int __sigpause __P ((int __sig_or_mask, int __is_sig));
#endif
#ifdef __USE_BSD
#ifdef __USE_BSD
#define sigmask(sig) __sigmask(sig)
extern int sigblock __P ((int __mask));
@ -119,32 +131,32 @@ extern int siggetmask __P ((void));
#endif /* Use BSD. */
#ifdef __USE_MISC
#ifdef __USE_MISC
#define NSIG _NSIG
#endif
#ifdef __USE_GNU
#ifdef __USE_GNU
typedef __sighandler_t sighandler_t;
#endif
/* 4.4 BSD uses the name `sig_t' for this. */
#ifdef __USE_BSD
#ifdef __USE_BSD
typedef __sighandler_t sig_t;
#endif
#endif /* <signal.h> included. */
#ifdef __USE_POSIX
#ifdef __USE_POSIX
#if !defined(__sigset_t_defined) && \
(defined(_SIGNAL_H) || defined(__need_sigset_t))
#if !defined __sigset_t_defined \
&& (defined _SIGNAL_H || defined __need_sigset_t)
typedef __sigset_t sigset_t;
#define __sigset_t_defined 1
#endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'. */
#undef __need_sigset_t
#undef __need_sigset_t
#ifdef _SIGNAL_H
#ifdef _SIGNAL_H
/* Clear all signals from SET. */
extern int sigemptyset __P ((sigset_t *__set));
@ -194,7 +206,7 @@ extern int sigwait __P ((__const sigset_t *__set, int *__sig));
#endif /* Use POSIX. */
#if defined(_SIGNAL_H) && defined(__USE_BSD)
#if defined _SIGNAL_H && defined __USE_BSD
/* Names of the signals. This variable exists only for compatibility.
Use `strsignal' instead (see <string.h>). */
@ -238,7 +250,7 @@ extern int sigreturn __P ((struct sigcontext *__scp));
#endif /* signal.h included and use BSD. */
#if defined(_SIGNAL_H) && (defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED))
#if defined _SIGNAL_H && (defined __USE_BSD || defined __USE_XOPEN_EXTENDED)
#define __need_size_t
#include <stddef.h>

View File

@ -1,29 +0,0 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <signal.h>
#undef ssignal
__sighandler_t
ssignal (sig, func)
int sig;
__sighandler_t func;
{
return signal (sig, func);
}

View File

@ -21,6 +21,8 @@
#define _SYS_UN_H 1
#include <sys/cdefs.h>
#include <string.h> /* For prototype of `strlen'. */
/* Get the definition of the macro to define the common sockaddr members. */
#include <sockaddrcom.h>
@ -33,6 +35,11 @@ struct sockaddr_un
char sun_path[108]; /* Path name. */
};
/* Evaluate to actual length of the `sockaddr_un' structure. */
#define SUN_LEN(ptr) (((struct sockaddr_un *) 0)->sun_path \
+ strlen ((ptr)->sun_path))
__END_DECLS
#endif /* sys/un.h */

View File

@ -43,7 +43,7 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
xbug errnobug \
bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 \
tfformat tiformat tstdiomisc \
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10
include ../Rules

15
stdio-common/scanf10.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <string.h>
int
main (int argc, char *argv[])
{
const char teststring[] = "<tag `word'>";
int retc, a, b;
retc = sscanf (teststring, "<%*s `%n%*s%n'>", &a, &b);
printf ("retc=%d a=%d b=%d\n", retc, a, b);
return retc == -1 && a == 6 && b == 12 ? 0 : 1;
}

View File

@ -524,7 +524,10 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
if (First) \
input_error (); \
else \
break; \
{ \
--read_in; \
break; \
} \
val = c; \
if (val >= 0x80) \
{ \
@ -667,6 +670,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
STRING_ADD_CHAR (str, c, char);
} while ((width <= 0 || --width > 0) && inchar () != EOF);
if (c == EOF)
--read_in;
if (!(flags & SUPPRESS))
{
*str = '\0';

View File

@ -1,21 +1,21 @@
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <link.h>
#include <stddef.h>

View File

@ -18,4 +18,4 @@ ENTRY(__ieee754_acos)
fxch %st(1)
fpatan
ret
PSEUDO_END (__ieee754_acos)
END (__ieee754_acos)

View File

@ -0,0 +1,22 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: $")
/* acos = atan (sqrt(1 - x^2) / x) */
ENTRY(__ieee754_acosf)
flds 4(%esp) /* x */
fst %st(1)
fmul %st(0) /* x^2 */
fld1
fsubp /* 1 - x^2 */
fsqrt /* sqrt (1 - x^2) */
fxch %st(1)
fpatan
ret
END (__ieee754_acosf)

105
sysdeps/libm-i387/e_acosh.S Normal file
View File

@ -0,0 +1,105 @@
/* ix87 specific implementation of arcsinh.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_acosh)
movl 8(%esp), %ecx
cmpl $0x3ff00000, %ecx
jl 5f // < 1 => invalid
fldln2 // log(2)
fldl 4(%esp) // x : log(2)
cmpl $0x41b00000, %ecx
ja 3f // x > 2^28
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
cmpl $0x40000000, %ecx
ja 4f // x > 2
// 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
fsubl MO(one) // x-1 : log(2)
fld %st // x-1 : x-1 : log(2)
fmul %st(1) // (x-1)^2 : x-1 : log(2)
fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2)
fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2)
fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2)
faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2)
fcoml MO(limit)
fnstsw
sahf
ja 2f
fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
ret
2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2)
fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2))
ret
// x > 2^28 => y = log(x) + log(2)
.align ALIGNARG(4)
3: fyl2x // log(x)
fldln2 // log(2) : log(x)
faddp // log(x)+log(2)
ret
// 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1)))
.align ALIGNARG(4)
4: fld %st // x : x : log(2)
fadd %st, %st(1) // x : 2*x : log(2)
fld %st // x : x : 2*x : log(2)
fmul %st(1) // x^2 : x : 2*x : log(2)
fsubl MO(one) // x^2-1 : x : 2*x : log(2)
fsqrt // sqrt(x^2-1) : x : 2*x : log(2)
faddp // x+sqrt(x^2-1) : 2*x : log(2)
fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2)
fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2)
fyl2x // log(2*x+1/(x+sqrt(x^2-1)))
ret
// x < 1 => NaN
.align ALIGNARG(4)
5: fldz
fdiv %st, %st(0)
ret
END(__ieee754_acosh)

View File

@ -0,0 +1,105 @@
/* ix87 specific implementation of arcsinh.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_acoshf)
movl 8(%esp), %ecx
cmpl $0x3f800000, %ecx
jl 5f // < 1 => invalid
fldln2 // log(2)
flds 4(%esp) // x : log(2)
cmpl $0x47000000, %ecx
ja 3f // x > 2^14
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
cmpl $0x40000000, %ecx
ja 4f // x > 2
// 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
fsubl MO(one) // x-1 : log(2)
fld %st // x-1 : x-1 : log(2)
fmul %st(1) // (x-1)^2 : x-1 : log(2)
fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2)
fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2)
fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2)
faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2)
fcoml MO(limit)
fnstsw
sahf
ja 2f
fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
ret
2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2)
fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2))
ret
// x > 2^14 => y = log(x) + log(2)
.align ALIGNARG(4)
3: fyl2x // log(x)
fldln2 // log(2) : log(x)
faddp // log(x)+log(2)
ret
// 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1)))
.align ALIGNARG(4)
4: fld %st // x : x : log(2)
fadd %st, %st(1) // x : 2*x : log(2)
fld %st // x : x : 2*x : log(2)
fmul %st(1) // x^2 : x : 2*x : log(2)
fsubl MO(one) // x^2-1 : x : 2*x : log(2)
fsqrt // sqrt(x^2-1) : x : 2*x : log(2)
faddp // x+sqrt(x^2-1) : 2*x : log(2)
fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2)
fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2)
fyl2x // log(2*x+1/(x+sqrt(x^2-1)))
ret
// x < 1 => NaN
.align ALIGNARG(4)
5: fldz
fdiv %st, %st(0)
ret
END(__ieee754_acoshf)

View File

@ -0,0 +1,111 @@
/* ix87 specific implementation of arcsinh.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
/* Please note that we use double value for 1.0. This number
has an exact representation and so we don't get accuracy
problems. The advantage is that the code is simpler. */
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_acoshl)
movl 12(%esp), %ecx
cmpl $0x3fff, %ecx
jl 5f // < 1 => invalid
fldln2 // log(2)
fldt 4(%esp) // x : log(2)
cmpl $0x4020, %ecx
ja 3f // x > 2^34
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
cmpl $0x4000, %ecx
ja 4f // x > 2
// 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
fsubl MO(one) // x-1 : log(2)
fld %st // x-1 : x-1 : log(2)
fmul %st(1) // (x-1)^2 : x-1 : log(2)
fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2)
fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2)
fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2)
faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2)
fcoml MO(limit)
fnstsw
sahf
ja 2f
fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
ret
2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2)
fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2))
ret
// x > 2^34 => y = log(x) + log(2)
.align ALIGNARG(4)
3: fyl2x // log(x)
fldln2 // log(2) : log(x)
faddp // log(x)+log(2)
ret
// 2^34 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1)))
.align ALIGNARG(4)
4: fld %st // x : x : log(2)
fadd %st, %st(1) // x : 2*x : log(2)
fld %st // x : x : 2*x : log(2)
fmul %st(1) // x^2 : x : 2*x : log(2)
fsubl MO(one) // x^2-1 : x : 2*x : log(2)
fsqrt // sqrt(x^2-1) : x : 2*x : log(2)
faddp // x+sqrt(x^2-1) : 2*x : log(2)
fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2)
fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2)
fyl2x // log(2*x+1/(x+sqrt(x^2-1)))
ret
// x < 1 => NaN
.align ALIGNARG(4)
5: fldz
fdiv %st, %st(0)
ret
END(__ieee754_acoshl)

View File

@ -19,4 +19,4 @@ ENTRY(__ieee754_acosl)
fxch %st(1)
fpatan
ret
PSEUDO_END (__ieee754_acosl)
END (__ieee754_acosl)

View File

@ -17,4 +17,4 @@ ENTRY(__ieee754_asin)
fsqrt /* sqrt (1 - x^2) */
fpatan
ret
PSEUDO_END (__ieee754_asin)
END (__ieee754_asin)

View File

@ -0,0 +1,21 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: $")
/* asin = atan (x / sqrt(1 - x^2)) */
ENTRY(__ieee754_asinf)
flds 4(%esp) /* x */
fst %st(1)
fmul %st(0) /* x^2 */
fld1
fsubp /* 1 - x^2 */
fsqrt /* sqrt (1 - x^2) */
fpatan
ret
END (__ieee754_asinf)

View File

@ -19,4 +19,4 @@ ENTRY(__ieee754_asinl)
fsqrt /* sqrt (1 - x^2) */
fpatan
ret
PSEUDO_END (__ieee754_asinl)
END (__ieee754_asinl)

View File

@ -12,4 +12,4 @@ ENTRY(__ieee754_atan2)
fldl 12(%esp)
fpatan
ret
PSEUDO_END (__ieee754_atan2)
END (__ieee754_atan2)

View File

@ -12,4 +12,4 @@ ENTRY(__ieee754_atan2f)
flds 8(%esp)
fpatan
ret
PSEUDO_END (__ieee754_atan2f)
END (__ieee754_atan2f)

View File

@ -14,4 +14,4 @@ ENTRY(__ieee754_atan2l)
fldt 16(%esp)
fpatan
ret
PSEUDO_END (__ieee754_atan2l)
END (__ieee754_atan2l)

101
sysdeps/libm-i387/e_atanh.S Normal file
View File

@ -0,0 +1,101 @@
/* ix87 specific implementation of arctanh function.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(half,@object)
half: .double 0.5
ASM_SIZE_DIRECTIVE(half)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
ASM_TYPE_DIRECTIVE(ln2_2,@object)
ln2_2: .tfloat 0.3465735902799726547086160
ASM_SIZE_DIRECTIVE(ln2_2)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_atanh)
movl 8(%esp), %ecx
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
andl $0x80000000, %ecx // ECX == 0 iff X >= 0
fldt MO(ln2_2) // 0.5*ln2
xorl %ecx, 8(%esp)
fldl 4(%esp) // |x| : 0.5*ln2
fcoml MO(half) // |x| : 0.5*ln2
fld %st // |x| : |x| : 0.5*ln2
fnstsw // |x| : |x| : 0.5*ln2
sahf
jae 2f
fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
fld %st // |x| : |x| : 2*|x| : 0.5*ln2
fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
sahf
jae 4f
fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
3: ret
.align ALIGNARG(4)
4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
3: ret
.align ALIGNARG(4)
2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
fxch // |x| : 1+|x| : 0.5*ln2
fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld((1+x)/(1-x))
3: ret
END(__ieee754_atanh)

View File

@ -0,0 +1,102 @@
/* ix87 specific implementation of arctanh function.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(half,@object)
half: .double 0.5
ASM_SIZE_DIRECTIVE(half)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(ln2_2,@object)
ln2_2: .tfloat 0.3465735902799726547086160
ASM_SIZE_DIRECTIVE(ln2_2)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_atanhf)
movl 4(%esp), %ecx
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
andl $0x80000000, %ecx // ECX == 0 iff X >= 0
fldt MO(ln2_2) // 0.5*ln2
xorl %ecx, 4(%esp)
flds 4(%esp) // |x| : 0.5*ln2
fcoml MO(half) // |x| : 0.5*ln2
fld %st(0) // |x| : |x| : 0.5*ln2
fnstsw // |x| : |x| : 0.5*ln2
sahf
jae 2f
fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
fld %st // |x| : |x| : 2*|x| : 0.5*ln2
fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
sahf
jae 4f
fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
3: ret
.align ALIGNARG(4)
4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
3: ret
.align ALIGNARG(4)
2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
fxch // |x| : 1+|x| : 0.5*ln2
fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld((1+x)/(1-x))
3: ret
END(__ieee754_atanhf)

View File

@ -0,0 +1,108 @@
/* ix87 specific implementation of arctanh function.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
/* Please note that we use double values for 0.5 and 1.0. These
numbers have exact representations and so we don't get accuracy
problems. The advantage is that the code is simpler. */
ASM_TYPE_DIRECTIVE(half,@object)
half: .double 0.5
ASM_SIZE_DIRECTIVE(half)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(ln2_2,@object)
ln2_2: .tfloat 0.3465735902799726547086160
ASM_SIZE_DIRECTIVE(ln2_2)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_atanhl)
movl 12(%esp), %ecx
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
andl $0x8000, %ecx // ECX == 0 iff X >= 0
fldt MO(ln2_2) // 0.5*ln2
xorl %ecx, 12(%esp)
fldt 4(%esp) // |x| : 0.5*ln2
fcoml MO(half) // |x| : 0.5*ln2
fld %st(0) // |x| : |x| : 0.5*ln2
fnstsw // |x| : |x| : 0.5*ln2
sahf
jae 2f
fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
fld %st // |x| : |x| : 2*|x| : 0.5*ln2
fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
sahf
jae 4f
fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
3: ret
.align ALIGNARG(4)
4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
3: ret
.align ALIGNARG(4)
2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
fxch // |x| : 1+|x| : 0.5*ln2
fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
jecxz 3f
fchs // 0.5*ln2*ld((1+x)/(1-x))
3: ret
END(__ieee754_atanhl)

View File

@ -38,4 +38,4 @@ ENTRY(__ieee754_exp)
jz .LpInf /* If positive, jump. */
fldz /* Set result to 0. */
.LpInf: ret
PSEUDO_END (__ieee754_exp)
END (__ieee754_exp)

View File

@ -0,0 +1,42 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: $")
/* e^x = 2^(x * log2(e)) */
ENTRY(__ieee754_expf)
flds 4(%esp)
/* I added the following ugly construct because exp(+-Inf) resulted
in NaN. The ugliness results from the bright minds at Intel.
For the i686 the code can be written better.
-- drepper@cygnus.com. */
fxam /* Is NaN or +-Inf? */
fstsw %ax
sahf
jnc .LnoInfNaN /* No, jump. */
jp .LisInf /* Is +-Inf, jump. */
.LnoInfNaN:
fldl2e
fmulp /* x * log2(e) */
fstl %st(1)
frndint /* int(x * log2(e)) */
fstl %st(2)
fsubrp /* fract(x * log2(e)) */
f2xm1 /* 2^(fract(x * log2(e))) - 1 */
fld1
faddp /* 2^(fract(x * log2(e))) */
fscale /* e^x */
fstp %st(1)
ret
.LisInf:
andb $2, %ah /* Test sign. */
jz .LpInf /* If positive, jump. */
fldz /* Set result to 0. */
.LpInf: ret
END (__ieee754_expf)

View File

@ -40,4 +40,4 @@ ENTRY(__ieee754_expl)
jz .LpInf /* If positive, jump. */
fldz /* Set result to 0. */
.LpInf: ret
PSEUDO_END (__ieee754_expl)
END (__ieee754_expl)

View File

@ -16,4 +16,4 @@ ENTRY(__ieee754_fmod)
jp 1b
fstpl %st(1)
ret
PSEUDO_END (__ieee754_fmod)
END (__ieee754_fmod)

View File

@ -0,0 +1,20 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: $")
ENTRY(__ieee754_fmodf)
flds 8(%esp)
flds 4(%esp)
1: fprem
fstsw %ax
sahf
jp 1b
fstpl %st(1)
ret
END(__ieee754_fmodf)

View File

@ -18,4 +18,4 @@ ENTRY(__ieee754_fmodl)
jp 1b
fstpl %st(1)
ret
PSEUDO_END (__ieee754_fmodl)
END (__ieee754_fmodl)

View File

@ -1,15 +1,59 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*
* Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_log)
fldln2
fldl 4(%esp)
fyl2x
fldln2 // log(2)
fldl 4(%esp) // x : log(2)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st // x : x : log(2)
fsubl MO(one) // x-1 : x : log(2)
fld %st // x-1 : x-1 : x : log(2)
fabs // |x-1| : x-1 : x : log(2)
fcompl MO(limit) // x-1 : x : log(2)
fnstsw // x-1 : x : log(2)
sahf
ja 2f
fstp %st(1) // x-1 : log(2)
fyl2xp1 // log(x)
ret
PSEUDO_END (__ieee754_log)
2: fincstp // x : log(2)
fyl2x // log(x)
ret
END (__ieee754_log)

View File

@ -1,15 +1,59 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*
* Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $")
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_log10)
fldlg2
fldl 4(%esp)
fyl2x
fldlg2 // log10(2)
fldl 4(%esp) // x : log10(2)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st // x : x : log10(2)
fsubl MO(one) // x-1 : x : log10(2)
fld %st // x-1 : x-1 : x : log10(2)
fabs // |x-1| : x-1 : x : log10(2)
fcompl MO(limit) // x-1 : x : log10(2)
fnstsw // x-1 : x : log10(2)
sahf
ja 2f
fstp %st(1) // x-1 : log10(2)
fyl2xp1 // log10(x)
ret
PSEUDO_END (__ieee754_log10)
2: fincstp // x : log10(2)
fyl2x // log10(x)
ret
END (__ieee754_log10)

View File

@ -0,0 +1,60 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
*
* Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: $")
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_log10f)
fldlg2 // log10(2)
flds 4(%esp) // x : log10(2)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st // x : x : log10(2)
fsubl MO(one) // x-1 : x : log10(2)
fld %st // x-1 : x-1 : x : log10(2)
fabs // |x-1| : x-1 : x : log10(2)
fcompl MO(limit) // x-1 : x : log10(2)
fnstsw // x-1 : x : log10(2)
sahf
ja 2f
fstp %st(1) // x-1 : log10(2)
fyl2xp1 // log10(x)
ret
2: fincstp // x : log10(2)
fyl2x // log10(x)
ret
END (__ieee754_log10f)

View File

@ -3,15 +3,59 @@
* Public domain.
*
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
*
* Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: $")
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_log10l)
fldlg2
fldt 4(%esp)
fyl2x
fldlg2 // log10(2)
fldt 4(%esp) // x : log10(2)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st // x : x : log10(2)
fsubl MO(one) // x-1 : x : log10(2)
fld %st // x-1 : x-1 : x : log10(2)
fabs // |x-1| : x-1 : x : log10(2)
fcompl MO(limit) // x-1 : x : log10(2)
fnstsw // x-1 : x : log10(2)
sahf
ja 2f
fstp %st(1) // x-1 : log10(2)
fyl2xp1 // log10(x)
ret
PSEUDO_END(__ieee754_log10l)
2: fincstp // x : log10(2)
fyl2x // log10(x)
ret
END(__ieee754_log10l)

View File

@ -0,0 +1,60 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for float by Ulrich Drepper <drepper@cygnus.com>.
*
* Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_logf)
fldln2 // log(2)
flds 4(%esp) // x : log(2)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st // x : x : log(2)
fsubl MO(one) // x-1 : x : log(2)
fld %st // x-1 : x-1 : x : log(2)
fabs // |x-1| : x-1 : x : log(2)
fcompl MO(limit) // x-1 : x : log(2)
fnstsw // x-1 : x : log(2)
sahf
ja 2f
fstp %st(1) // x-1 : log(2)
fyl2xp1 // log(x)
ret
2: fincstp // x : log(2)
fyl2x // log(x)
ret
END (__ieee754_logf)

View File

@ -9,9 +9,52 @@
RCSID("$NetBSD: $")
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__ieee754_logl)
fldln2
fldt 4(%esp)
fyl2x
fldln2 // log(2)
fldt 4(%esp) // x : log(2)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st // x : x : log(2)
fsubl MO(one) // x-1 : x : log(2)
fld %st // x-1 : x-1 : x : log(2)
fabs // |x-1| : x-1 : x : log(2)
fcompl MO(limit) // x-1 : x : log(2)
fnstsw // x-1 : x : log(2)
sahf
ja 2f
fstp %st(1) // x-1 : log(2)
fyl2xp1 // log(x)
ret
PSEUDO_END(__ieee754_logl)
2: fincstp // x : log(2)
fyl2x // log(x)
ret
END (__ieee754_logl)

View File

@ -16,4 +16,4 @@ ENTRY(__ieee754_remainder)
jp 1b
fstpl %st(1)
ret
PSEUDO_END (__ieee754_remainder)
END (__ieee754_remainder)

View File

@ -16,4 +16,4 @@ ENTRY(__ieee754_remainderf)
jp 1b
fstpl %st(1)
ret
PSEUDO_END (__ieee754_remainderf)
END (__ieee754_remainderf)

View File

@ -17,4 +17,4 @@ ENTRY(__ieee754_remainderl)
sahf
jp 1b
ret
PSEUDO_END (__ieee754_remainderl)
END (__ieee754_remainderl)

View File

@ -12,4 +12,4 @@ ENTRY(__ieee754_scalb)
fldl 4(%esp)
fscale
ret
PSEUDO_END(__ieee754_scalb)
END(__ieee754_scalb)

View File

@ -0,0 +1,16 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
* Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
*/
#include <machine/asm.h>
RCSID("$NetBSD: $")
ENTRY(__ieee754_scalbf)
flds 8(%esp)
flds 4(%esp)
fscale
ret
END(__ieee754_scalbf)

View File

@ -14,4 +14,4 @@ ENTRY(__ieee754_scalbl)
fldt 4(%esp)
fscale
ret
PSEUDO_END(__ieee754_scalbl)
END(__ieee754_scalbl)

View File

@ -11,4 +11,4 @@ ENTRY(__ieee754_sqrt)
fldl 4(%esp)
fsqrt
ret
PSEUDO_END (__ieee754_sqrt)
END (__ieee754_sqrt)

View File

@ -11,4 +11,4 @@ ENTRY(__ieee754_sqrtf)
flds 4(%esp)
fsqrt
ret
PSEUDO_END (__ieee754_sqrtf)
END (__ieee754_sqrtf)

View File

@ -13,4 +13,4 @@ ENTRY(__ieee754_sqrtl)
fldt 4(%esp)
fsqrt
ret
PSEUDO_END (__ieee754_sqrtl)
END (__ieee754_sqrtl)

132
sysdeps/libm-i387/s_asinh.S Normal file
View File

@ -0,0 +1,132 @@
/* ix87 specific implementation of arcsinh.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(huge,@object)
huge: .double 1e+300
ASM_SIZE_DIRECTIVE(huge)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__asinh)
movl 8(%esp), %ecx
movl $0x7fffffff, %eax
andl %ecx, %eax
andl $0x80000000, %ecx
xorl %ecx, 8(%esp)
fldl 4(%esp) // |x|
cmpl $0x3e300000, %eax
jb 2f // |x| < 2^-28
fldln2 // log(2) : |x|
cmpl $0x41b00000, %eax
fxch // |x| : log(2)
ja 3f // |x| > 2^28
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
cmpl $0x40000000, %eax
ja 5f // |x| > 2
// 2^-28 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
fld %st // |x| : |x| : log(2)
fmul %st(1) // |x|^2 : |x| : log(2)
fld %st // |x|^2 : |x|^2 : |x| : log(2)
faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2)
fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
fcoml MO(limit)
fnstsw
sahf
ja 6f
fyl2xp1
jecxz 4f
fchs
4: ret
6: faddl MO(one)
fyl2x
jecxz 4f
fchs
4: ret
// |x| < 2^-28 => y = x (inexact iff |x| != 0.0)
.align ALIGNARG(4)
2:
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
jecxz 4f
fchs // x
4: fld %st // x : x
faddl MO(huge) // huge+x : x
fincstp // x
ret
// |x| > 2^28 => y = sign(x) * (log(|x|) + log(2))
.align ALIGNARG(4)
3: fyl2x // log(|x|)
fldln2 // log(2) : log(|x|)
faddp // log(|x|)+log(2)
jecxz 4f
fchs
4: ret
// |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
.align ALIGNARG(4)
5: fld %st // |x| : |x| : log(2)
fadd %st, %st(1) // |x| : 2*|x| : log(2)
fld %st // |x| : |x| : 2*|x| : log(2)
fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2)
faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2)
fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
jecxz 4f
fchs
4: ret
END(__asinh)
weak_alias (__asinh, asinh)

View File

@ -0,0 +1,132 @@
/* ix87 specific implementation of arcsinh.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(huge,@object)
huge: .double 1e+36
ASM_SIZE_DIRECTIVE(huge)
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__asinhf)
movl 4(%esp), %ecx
movl $0x7fffffff, %eax
andl %ecx, %eax
andl $0x80000000, %ecx
xorl %ecx, 8(%esp)
flds 4(%esp) // |x|
cmpl $0x38000000, %eax
jb 2f // |x| < 2^-14
fldln2 // log(2) : |x|
cmpl $0x47000000, %eax
fxch // |x| : log(2)
ja 3f // |x| > 2^14
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
cmpl $0x40000000, %eax
ja 5f // |x| > 2
// 2^-14 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
fld %st // |x| : |x| : log(2)
fmul %st(1) // |x|^2 : |x| : log(2)
fld %st // |x|^2 : |x|^2 : |x| : log(2)
faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2)
fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
fcoml MO(limit)
fnstsw
sahf
ja 6f
fyl2xp1
jecxz 4f
fchs
4: ret
6: faddl MO(one)
fyl2x
jecxz 4f
fchs
4: ret
// |x| < 2^-14 => y = x (inexact iff |x| != 0.0)
.align ALIGNARG(4)
2:
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
jecxz 4f
fchs // x
4: fld %st // x : x
faddl MO(huge) // huge+x : x
fincstp // x
ret
// |x| > 2^14 => y = sign(x) * (log(|x|) + log(2))
.align ALIGNARG(4)
3: fyl2x // log(|x|)
fldln2 // log(2) : log(|x|)
faddp // log(|x|)+log(2)
jecxz 4f
fchs
4: ret
// |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
.align ALIGNARG(4)
5: fld %st // |x| : |x| : log(2)
fadd %st, %st(1) // |x| : 2*|x| : log(2)
fld %st // |x| : |x| : 2*|x| : log(2)
fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2)
faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2)
fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
jecxz 4f
fchs
4: ret
END(__asinhf)
weak_alias (__asinhf, asinhf)

View File

@ -0,0 +1,140 @@
/* ix87 specific implementation of arcsinh.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(huge,@object)
huge: .tfloat 1e+4930
ASM_SIZE_DIRECTIVE(huge)
.align ALIGNARG(4)
/* Please note that we use double value for 1.0. This number
has an exact representation and so we don't get accuracy
problems. The advantage is that the code is simpler. */
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
/* It is not important that this constant is precise. It is only
a value which is known to be on the safe side for using the
fyl2xp1 instruction. */
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
#else
#define MO(op) op
#endif
.text
ENTRY(__asinhl)
movl 12(%esp), %ecx
movl $0x7fff, %eax
andl %ecx, %eax
andl $0x8000, %ecx
xorl %ecx, 12(%esp)
fldt 4(%esp) // |x|
cmpl $0x3fde, %eax
jb 2f // |x| < 2^-34
fldln2 // log(2) : |x|
cmpl $0x4020, %eax
fxch // |x| : log(2)
ja 3f // |x| > 2^34
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
cmpl $0x4000, %eax
ja 5f // |x| > 2
// 2^-34 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
fld %st // |x| : |x| : log(2)
fmul %st(1) // |x|^2 : |x| : log(2)
fld %st // |x|^2 : |x|^2 : |x| : log(2)
faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2)
fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
fcoml MO(limit)
fnstsw
sahf
ja 6f
fyl2xp1
jecxz 4f
fchs
4: ret
6: faddl MO(one)
fyl2x
jecxz 4f
fchs
4: ret
// |x| < 2^-34 => y = x (inexact iff |x| != 0.0)
.align ALIGNARG(4)
2:
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
jecxz 4f
fchs // x
4: fld %st // x : x
fldt MO(huge) // huge : x : x
faddp // huge+x : x
fincstp // x
ret
// |x| > 2^34 => y = sign(x) * (log(|x|) + log(2))
.align ALIGNARG(4)
3: fyl2x // log(|x|)
fldln2 // log(2) : log(|x|)
faddp // log(|x|)+log(2)
jecxz 4f
fchs
4: ret
// |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
.align ALIGNARG(4)
5: fld %st // |x| : |x| : log(2)
fadd %st, %st(1) // |x| : 2*|x| : log(2)
fld %st // |x| : |x| : 2*|x| : log(2)
fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2)
faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2)
fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
jecxz 4f
fchs
4: ret
END(__asinhl)
weak_alias (__asinhl, asinhl)

View File

@ -12,5 +12,5 @@ ENTRY(__atan)
fld1
fpatan
ret
PSEUDO_END (__atan)
END (__atan)
weak_alias (__atan, atan)

View File

@ -12,5 +12,5 @@ ENTRY(__atanf)
fld1
fpatan
ret
PSEUDO_END (__atanf)
END (__atanf)
weak_alias (__atanf, atanf)

View File

@ -14,5 +14,5 @@ ENTRY(__atanl)
fld1
fpatan
ret
PSEUDO_END (__atanl)
END (__atanl)
weak_alias (__atanl, atanl)

View File

@ -30,5 +30,5 @@ ENTRY(__ceil)
leave
ret
PSEUDO_END (__ceil)
END (__ceil)
weak_alias (__ceil, ceil)

View File

@ -30,5 +30,5 @@ ENTRY(__ceilf)
leave
ret
PSEUDO_END (__ceilf)
END (__ceilf)
weak_alias (__ceilf, ceilf)

View File

@ -31,5 +31,5 @@ ENTRY(__ceill)
leave
ret
PSEUDO_END (__ceill)
END (__ceill)
weak_alias (__ceill, ceill)

View File

@ -16,5 +16,5 @@ ENTRY(__copysign)
movl %eax,8(%esp)
fldl 4(%esp)
ret
PSEUDO_END (__copysign)
END (__copysign)
weak_alias (__copysign, copysign)

View File

@ -16,5 +16,5 @@ ENTRY(__copysignf)
movl %eax,4(%esp)
flds 4(%esp)
ret
PSEUDO_END (__copysignf)
END (__copysignf)
weak_alias (__copysignf, copysignf)

View File

@ -17,5 +17,5 @@ ENTRY(__copysignl)
movl %eax,12(%esp)
fldt 4(%esp)
ret
PSEUDO_END (__copysignl)
END (__copysignl)
weak_alias (__copysignl, copysignl)

View File

@ -11,7 +11,7 @@ ENTRY(__cos)
fldl 4(%esp)
fcos
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 1f
ret
1: fldpi
@ -19,10 +19,10 @@ ENTRY(__cos)
fxch %st(1)
2: fprem1
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 2b
fstp %st(1)
fcos
ret
PSEUDO_END (__cos)
END (__cos)
weak_alias (__cos, cos)

View File

@ -12,5 +12,5 @@ ENTRY(__cosf)
flds 4(%esp)
fcos
ret
PSEUDO_END (__cosf)
END (__cosf)
weak_alias (__cosf, cosf)

View File

@ -13,7 +13,7 @@ ENTRY(__cosl)
fldt 4(%esp)
fcos
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 1f
ret
1: fldpi
@ -21,10 +21,10 @@ ENTRY(__cosl)
fxch %st(1)
2: fprem1
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 2b
fstp %st(1)
fcos
ret
PSEUDO_END (__cosl)
END (__cosl)
weak_alias (__cosl, cosl)

View File

@ -14,5 +14,5 @@ ENTRY(__finite)
setne %al
andl $0x000000ff, %eax
ret
PSEUDO_END (__finite)
END (__finite)
weak_alias (__finite, finite)

View File

@ -14,5 +14,5 @@ ENTRY(__finitef)
setne %al
andl $0x000000ff, %eax
ret
PSEUDO_END (__finitef)
END (__finitef)
weak_alias (__finitef, finitef)

View File

@ -16,5 +16,5 @@ ENTRY(__finitel)
setne %al
andl $0x000000ff, %eax
ret
PSEUDO_END (__finitel)
END (__finitel)
weak_alias (__finitel, finitel)

View File

@ -26,5 +26,5 @@ ENTRY(__floor)
leave
ret
PSEUDO_END (__floor)
END (__floor)
weak_alias (__floor, floor)

View File

@ -26,5 +26,5 @@ ENTRY(__floorf)
leave
ret
PSEUDO_END (__floorf)
END (__floorf)
weak_alias (__floorf, floorf)

View File

@ -27,5 +27,5 @@ ENTRY(__floorl)
leave
ret
PSEUDO_END (__floorl)
END (__floorl)
weak_alias (__floorl, floorl)

View File

@ -21,5 +21,5 @@ ENTRY(__ilogb)
leave
ret
PSEUDO_END (__ilogb)
END (__ilogb)
weak_alias (__ilogb, ilogb)

View File

@ -21,5 +21,5 @@ ENTRY(__ilogbf)
leave
ret
PSEUDO_END (__ilogbf)
END (__ilogbf)
weak_alias (__ilogbf, ilogbf)

View File

@ -21,5 +21,5 @@ ENTRY(__ilogbl)
leave
ret
PSEUDO_END (__ilogbl)
END (__ilogbl)
weak_alias (__ilogbl, ilogbl)

View File

@ -7,18 +7,56 @@
RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
/*
* Since the fyl2xp1 instruction has such a limited range:
* -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
* it's not worth trying to use it.
*/
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
/* The fyl2xp1 can only be used for values in
-1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
0.29 is a safe value.
*/
limit: .double 0.29
one: .double 1.0
/*
* Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
* otherwise fyl2x with the needed extra computation.
*/
.text
ENTRY(__log1p)
fldln2
fldl 4(%esp)
fld1
faddp
fldl 4(%esp)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st
fabs
#ifdef PIC
fcompl limit@GOTOFF(%edx)
#else
fcompl limit
#endif
fnstsw
sahf
jc 2f
#ifdef PIC
faddl one@GOTOFF(%edx)
#else
faddl one
#endif
fyl2x
ret
PSEUDO_END (__log1p)
2: fyl2xp1
ret
END (__log1p)
weak_alias (__log1p, log1p)

View File

@ -7,18 +7,56 @@
RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $")
/*
* Since the fyl2xp1 instruction has such a limited range:
* -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
* it's not worth trying to use it.
*/
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
/* The fyl2xp1 can only be used for values in
-1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
0.29 is a safe value.
*/
limit: .float 0.29
one: .float 1.0
/*
* Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
* otherwise fyl2x with the needed extra computation.
*/
.text
ENTRY(__log1pf)
fldln2
flds 4(%esp)
fld1
faddp
flds 4(%esp)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st
fabs
#ifdef PIC
fcomps limit@GOTOFF(%edx)
#else
fcomps limit
#endif
fnstsw
sahf
jc 2f
#ifdef PIC
fadds one@GOTOFF(%edx)
#else
fadds one
#endif
fyl2x
ret
PSEUDO_END (__log1pf)
2: fyl2xp1
ret
END (__log1pf)
weak_alias (__log1pf, log1pf)

View File

@ -7,20 +7,62 @@
#include <machine/asm.h>
RCSID("$NetBSD: $")
RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
/* The fyl2xp1 can only be used for values in
-1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
0.29 is a safe value.
*/
limit: .tfloat 0.29
/* Please note: we use a double value here. Since 1.0 has
an exact representation this does not effect the accuracy
but it helps to optimize the code. */
one: .double 1.0
/*
* Since the fyl2xp1 instruction has such a limited range:
* -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
* it's not worth trying to use it.
* Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
* otherwise fyl2x with the needed extra computation.
*/
.text
ENTRY(__log1pl)
fldln2
fldt 4(%esp)
fld1
faddp
fldt 4(%esp)
#ifdef PIC
call 1f
1: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
#endif
fld %st
fabs
#ifdef PIC
fldt limit@GOTOFF(%edx)
#else
fldt limit
#endif
fcompp
fnstsw
sahf
jnc 2f
#ifdef PIC
faddl one@GOTOFF(%edx)
#else
faddl one
#endif
fyl2x
ret
PSEUDO_END (__log1pl)
2: fyl2xp1
ret
END (__log1pl)
weak_alias (__log1pl, log1pl)

View File

@ -12,5 +12,5 @@ ENTRY(__logb)
fxtract
fstpl %st
ret
PSEUDO_END (__logb)
END (__logb)
weak_alias (__logb, logb)

View File

@ -12,5 +12,5 @@ ENTRY(__logbf)
fxtract
fstpl %st
ret
PSEUDO_END (__logbf)
END (__logbf)
weak_alias (__logbf, logbf)

View File

@ -12,5 +12,5 @@ ENTRY(__logbl)
fldt 4(%esp)
fxtract
ret
PSEUDO_END (__logbl)
END (__logbl)
weak_alias (__logbl, logbl)

View File

@ -11,5 +11,5 @@ ENTRY(__rint)
fldl 4(%esp)
frndint
ret
PSEUDO_END (__rint)
END (__rint)
weak_alias (__rint, rint)

View File

@ -11,5 +11,5 @@ ENTRY(__rintf)
flds 4(%esp)
frndint
ret
PSEUDO_END (__rintf)
END (__rintf)
weak_alias (__rintf, rintf)

View File

@ -12,5 +12,5 @@ ENTRY(__rintl)
fldt 4(%esp)
frndint
ret
PSEUDO_END (__rintl)
END (__rintl)
weak_alias (__rintl, rintl)

View File

@ -12,5 +12,5 @@ ENTRY(__scalbn)
fldl 4(%esp)
fscale
ret
PSEUDO_END (__scalbn)
END (__scalbn)
weak_alias (__scalbn, scalbn)

View File

@ -12,5 +12,5 @@ ENTRY(__scalbnf)
flds 4(%esp)
fscale
ret
PSEUDO_END (__scalbnf)
END (__scalbnf)
weak_alias (__scalbnf, scalbnf)

View File

@ -13,5 +13,5 @@ ENTRY(__scalbnl)
fldt 4(%esp)
fscale
ret
PSEUDO_END (__scalbnl)
END (__scalbnl)
weak_alias (__scalbnl, scalbnl)

View File

@ -12,5 +12,5 @@ ENTRY(__significand)
fxtract
fstpl %st(1)
ret
PSEUDO_END (__significand)
END (__significand)
weak_alias (__significand, significand)

View File

@ -12,5 +12,5 @@ ENTRY(__significandf)
fxtract
fstpl %st(1)
ret
PSEUDO_END (__significandf)
END (__significandf)
weak_alias (__significandf, significandf)

View File

@ -13,5 +13,5 @@ ENTRY(__significandl)
fxtract
fincstp
ret
PSEUDO_END (__significandl)
END (__significandl)
weak_alias (__significandl, significandl)

View File

@ -11,7 +11,7 @@ ENTRY(__sin)
fldl 4(%esp)
fsin
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 1f
ret
1: fldpi
@ -19,10 +19,10 @@ ENTRY(__sin)
fxch %st(1)
2: fprem1
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 2b
fstp %st(1)
fsin
ret
PSEUDO_END (__sin)
END (__sin)
weak_alias (__sin, sin)

View File

@ -12,5 +12,5 @@ ENTRY(__sinf)
flds 4(%esp)
fsin
ret
PSEUDO_END (__sinf)
END (__sinf)
weak_alias (__sinf, sinf)

View File

@ -13,7 +13,7 @@ ENTRY(__sinl)
fldt 4(%esp)
fsin
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 1f
ret
1: fldpi
@ -21,10 +21,10 @@ ENTRY(__sinl)
fxch %st(1)
2: fprem1
fnstsw %ax
andw $0x400,%ax
testl $0x400,%eax
jnz 2b
fstp %st(1)
fsin
ret
PSEUDO_END (__sinl)
END (__sinl)
weak_alias (__sinl, sinl)

Some files were not shown because too many files have changed in this diff Show More