diff options
author | Roland McGrath <roland@gnu.org> | 1996-05-30 16:12:42 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-05-30 16:12:42 +0000 |
commit | 76060ec0b8b5d6f0a860a94f100dc6e48041bac3 (patch) | |
tree | b4ff1b5370a30a16705239598cb8e98f4b80b9ca /sysdeps/libm-i387 | |
parent | c3352e623384fe221743a6d2212c17d9619041ef (diff) | |
download | glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.tar.gz glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.tar.xz glibc-76060ec0b8b5d6f0a860a94f100dc6e48041bac3.zip |
Thu May 30 11:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> cvs/libc-960602 cvs/libc-960601 cvs/libc-960531
* po/header.pot: Replace with exact boilerplate pinard dictates. * sysdeps/i386/strtok.S (Lillegal_argument): Remove this code to set errno and the check that jumped to it. * sysdeps/mach/hurd/Makefile (errnos.d): Use $(sed-remove-objpfx). Thu May 30 03:21:57 1996 Ulrich Drepper <drepper@cygnus.com> * FAQ: Document need of gperf program for developers. * elf/elf.h: Fix typos in comments. * libio/stdio.h [!__STRICT_ANSI__ || _POSIX_SOURCE]: Add prototypes for `ctermid' and `cuserid'. * locale/programs/locale.c: Switch to user selected locale before printing variables. * math/Makefile [$(long-double-fcts)==yes]: Define long-m-routines and long-c-routines. Only if the `long double' data type is available we need to compile the functions. (libm-routines): Add $(long-m-routines). (routines): Remove isinfl, isnanl. Use new file s_isinfl and s_isnanl instead if `long double' is available. * math/math.h: Include <mathcalls.h> again to define `long double' functions. * math/math_private.h: Define data types, prototypes and access macros for `long double'. * stdlib/stdlib.h: Add prototypes for `strtoll' and `strtoull'. [GCC2 && OPTIMIZE]: Define strto{,u}ll as inline function which calls __strto{,u}q_internal. * stdlib/strfmon.c: Replace PTR by `void *'. * stdlib/strtoq.c: Define strtoll as weak alias. * stdlib/strtouq.c: Define strtoull as weak alias. * string/tester.c: Correct `strsep' test. * sysdeps/generic/strsep.c: Make compatible with BSD version. Trailing characters of skip set are not skipped. In this case empty tokens are returned. * sysdeps/i386/isinfl.c, sysdeps/i386/isnanl.c, sysdeps/ieee754/isinf.c, sysdeps/ieee754/isinfl.c, sysdeps/ieee754/isnan.c, sysdeps/ieee754/isnanl.c: Removed. We now use the versions part of libm. * sysdeps/i386/strsep.S: Removed. Generic C version is of similar speed. * sysdeps/i386/strtok.S: Remove support for `strsep'. * sysdeps/libm-i387/e_acosl.S, sysdeps/libm-i387/s_ceill.S, sysdeps/libm-i387/s_copysignl.S, sysdeps/libm-i387/s_finitel.S, sysdeps/libm-i387/s_floorl.S, sysdeps/libm-i387/s_isinfl.c, sysdeps/libm-i387/s_isnanl.c, sysdeps/libm-i387/s_nextafterl.c, sysdeps/libm-i387/s_rintl.S, sysdeps/libm-i387/s_significandl.S: New i387 specific math functions implementing `long double' versions. * sysdeps/libm-ieee754/s_ceill.c, sysdeps/libm-ieee754/s_copysignl.c, sysdeps/libm-ieee754/s_fabsl.c, sysdeps/libm-ieee754/s_finitel.c, sysdeps/libm-ieee754/s_floorl.c, sysdeps/libm-ieee754/s_isinfl.c, sysdeps/libm-ieee754/s_isnanl.c, sysdeps/libm-ieee754/s_nextafterl.c, sysdeps/libm-ieee754/s_rintl.c, sysdeps/libm-ieee754/s_scalbnl.c, sysdeps/libm-ieee754/s_significandl.c: New generic `long double' versions of libm functions. * sysdeps/libm-i387/e_exp.S: Add a few comments to explain the Intel FPU nonsense. * sysdeps/libm-i387/s_ceil.S, sysdeps/libm-i387/s_ceilf.S, sysdeps/libm-i387/s_floor.S, sysdeps/libm-i387/s_floorf.S: Correct handling of local variables. The old version created a stack frame but stored the values outside. * sysdeps/libm-ieee754/s_isinf.c, sysdeps/libm-ieee754/s_isnan.c [!NO_LONG_DOUBLE]: Define alias with `long double' versions name. * login/pututline_r.c: Include sys/stat.h. Fix typos. according to currently used locale for category LC_CTYPE by inet_nsap_ntoa. Now in <arpa/inet.h>. _IO_dup2 to contain complete parameter list.
Diffstat (limited to 'sysdeps/libm-i387')
-rw-r--r-- | sysdeps/libm-i387/e_acosl.S | 21 | ||||
-rw-r--r-- | sysdeps/libm-i387/e_exp.S | 17 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_ceil.S | 10 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_ceilf.S | 10 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_ceill.S | 30 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_copysignl.S | 20 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_finitel.S | 19 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_floor.S | 10 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_floorf.S | 10 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_floorl.S | 30 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_isinfl.c | 36 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_isnanl.c | 46 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_nextafterl.c | 102 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_rintl.S | 15 | ||||
-rw-r--r-- | sysdeps/libm-i387/s_significandl.S | 16 |
15 files changed, 365 insertions, 27 deletions
diff --git a/sysdeps/libm-i387/e_acosl.S b/sysdeps/libm-i387/e_acosl.S new file mode 100644 index 0000000000..3779fa7861 --- /dev/null +++ b/sysdeps/libm-i387/e_acosl.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + + +/* acosl = atanl (sqrtl(1 - x^2) / x) */ +ENTRY(__ieee754_acos) + fldt 4(%esp) /* x */ + fst %st(1) + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrtl (1 - x^2) */ + fxch %st(1) + fpatan + ret diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S index 3ed039bc87..144748e820 100644 --- a/sysdeps/libm-i387/e_exp.S +++ b/sysdeps/libm-i387/e_exp.S @@ -10,12 +10,15 @@ RCSID("$NetBSD: e_exp.S,v 1.4 1995/05/08 23:47:04 jtc Exp $") /* e^x = 2^(x * log2(e)) */ ENTRY(__ieee754_exp) fldl 4(%esp) - fxam +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ fstsw %ax sahf - jnc .LnoInf - jp .LisInf -.LnoInf: + jnc .LnoInfNaN /* No, jump. */ + jp .LisInf /* Is +-Inf, jump. */ +.LnoInfNaN: fldl2e fmulp /* x * log2(e) */ fstl %st(1) @@ -29,7 +32,7 @@ ENTRY(__ieee754_exp) ret .LisInf: - andb $2, %ah - jz .LpInf - fldz + andb $2, %ah /* Test sign. */ + jz .LpInf /* If positive, jump. */ + fldz /* Set result to 0. */ .LpInf: ret diff --git a/sysdeps/libm-i387/s_ceil.S b/sysdeps/libm-i387/s_ceil.S index 2fd813dcd7..eabe662a6c 100644 --- a/sysdeps/libm-i387/s_ceil.S +++ b/sysdeps/libm-i387/s_ceil.S @@ -12,17 +12,17 @@ ENTRY(__ceil) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ fldl 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_ceilf.S b/sysdeps/libm-i387/s_ceilf.S index 6458b45e8f..c2163abef1 100644 --- a/sysdeps/libm-i387/s_ceilf.S +++ b/sysdeps/libm-i387/s_ceilf.S @@ -12,17 +12,17 @@ ENTRY(__ceilf) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ flds 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_ceill.S b/sysdeps/libm-i387/s_ceill.S new file mode 100644 index 0000000000..fd7bd38752 --- /dev/null +++ b/sysdeps/libm-i387/s_ceill.S @@ -0,0 +1,30 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__ceill) + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0800,%dx /* round towards +oo */ + andw $0xfbff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldt 8(%ebp); /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret +weak_alias (__ceill, ceill) diff --git a/sysdeps/libm-i387/s_copysignl.S b/sysdeps/libm-i387/s_copysignl.S new file mode 100644 index 0000000000..f65f6842ea --- /dev/null +++ b/sysdeps/libm-i387/s_copysignl.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__copysignl) + movl 24(%esp),%edx + movl 12(%esp),%eax + andl $0x8000,%edx + andl $0x7fff,%eax + orl %edx,%eax + movl %eax,12(%esp) + fldl 4(%esp) + ret +weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-i387/s_finitel.S b/sysdeps/libm-i387/s_finitel.S new file mode 100644 index 0000000000..d163965c0d --- /dev/null +++ b/sysdeps/libm-i387/s_finitel.S @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__finitel) + movl 12(%esp),%eax + andl $0x7fff, %eax + cmpl $0x7fff, %eax + setne %al + andl $0x000000ff, %eax + ret +weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-i387/s_floor.S b/sysdeps/libm-i387/s_floor.S index 33d5dbcc70..66e688f7f7 100644 --- a/sysdeps/libm-i387/s_floor.S +++ b/sysdeps/libm-i387/s_floor.S @@ -12,17 +12,17 @@ ENTRY(__floor) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ fldl 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_floorf.S b/sysdeps/libm-i387/s_floorf.S index dd290fa818..4b10f74e4f 100644 --- a/sysdeps/libm-i387/s_floorf.S +++ b/sysdeps/libm-i387/s_floorf.S @@ -12,17 +12,17 @@ ENTRY(__floorf) movl %esp,%ebp subl $8,%esp - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ flds 8(%ebp); /* round */ frndint - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ leave ret diff --git a/sysdeps/libm-i387/s_floorl.S b/sysdeps/libm-i387/s_floorl.S new file mode 100644 index 0000000000..af52ffcacf --- /dev/null +++ b/sysdeps/libm-i387/s_floorl.S @@ -0,0 +1,30 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__floorl) + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0400,%dx /* round towards -oo */ + andw $0xf7ff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldt 8(%ebp) /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret +weak_alias (__floorl, floorl) diff --git a/sysdeps/libm-i387/s_isinfl.c b/sysdeps/libm-i387/s_isinfl.c new file mode 100644 index 0000000000..3ee53d5ecc --- /dev/null +++ b/sysdeps/libm-i387/s_isinfl.c @@ -0,0 +1,36 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Change for long double by Ulrich Drepper <drepper@cygnus.com>. + * Intel i387 specific version. + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isinfl(x) returns 1 is x is inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isinfl(long double x) +#else + int __isinfl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se &= 0x7fff; + se ^= 0x7fff; + /* This additional ^ 0x80000000 is necessary because in Intel's + internal representation the implicit one is explicit. */ + se |= (hx ^ 0x80000000) | lx; + return (se == 0); +} +weak_alias (__isinfl, isinfl) diff --git a/sysdeps/libm-i387/s_isnanl.c b/sysdeps/libm-i387/s_isnanl.c new file mode 100644 index 0000000000..768ea2164b --- /dev/null +++ b/sysdeps/libm-i387/s_isnanl.c @@ -0,0 +1,46 @@ +/* s_isnanl.c -- long double version for i387 of s_isnan.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isnanl(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnanl(long double x) +#else + int __isnanl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se = (se & 0x7fff) << 1; + lx |= hx; + /* The additional &hx is required because Intel's extended format + has the normally implicit 1 explicit present. Sigh! */ + se |= (u_int32_t)((lx|(-lx))&hx)>>31; + se = 0xfffe - se; + return (int)((u_int32_t)(se))>>16; +} +weak_alias (__isnanl, isnanl) diff --git a/sysdeps/libm-i387/s_nextafterl.c b/sysdeps/libm-i387/s_nextafterl.c new file mode 100644 index 0000000000..b574430832 --- /dev/null +++ b/sysdeps/libm-i387/s_nextafterl.c @@ -0,0 +1,102 @@ +/* s_nextafterl.c -- long double version of s_nextafter.c. + * Special version for i387. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nextafterl(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __nextafterl(long double x, long double y) +#else + long double __nextafterl(x,y) + long double x,y; +#endif +{ + int32_t hx,hy,ix,iy; + u_int32_t lx,ly,esx,esy; + + GET_LDOUBLE_WORDS(esx,hx,lx,x); + GET_LDOUBLE_WORDS(esy,hy,ly,y); + ix = esx&0x7fff; /* |x| */ + iy = esy&0x7fff; /* |y| */ + + /* The additional &hx/&hy is required because Intel's extended format + has the normally implicit 1 explicit present. Sigh! */ + if(((ix==0x7fff)&&(((hx|lx)|-(hx|lx))&hx)>>31!=0) || /* x is nan */ + ((iy==0x7fff)&&(((hy|ly)|-(hy|ly))&hy)>>31!=0)) /* y is nan */ + return x+y; + if(x==y) return x; /* x=y, return x */ + if((ix|hx|lx)==0) { /* x == 0 */ + SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(esx<0x8000) { /* x > 0 */ + if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { + /* x > y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) + esx += 1; + } + } + } else { /* x < 0 */ + if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ + /* x < y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) esx += 1; + } + } + } + esy = esx&0x7fff; + if(esy==0x7fff) return x+x; /* overflow */ + if(esy==0) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_LDOUBLE_WORDS(y,esx,hx,lx); + return y; + } + } + SET_LDOUBLE_WORDS(x,esx,hx,lx); + return x; +} +weak_alias (__nextafterl, nextafterl) diff --git a/sysdeps/libm-i387/s_rintl.S b/sysdeps/libm-i387/s_rintl.S new file mode 100644 index 0000000000..aec09a6ec4 --- /dev/null +++ b/sysdeps/libm-i387/s_rintl.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__rintl) + fldt 4(%esp) + frndint + ret +weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-i387/s_significandl.S b/sysdeps/libm-i387/s_significandl.S new file mode 100644 index 0000000000..e512f54fb2 --- /dev/null +++ b/sysdeps/libm-i387/s_significandl.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Changes for long double by Ulrich Drepper <drepper@cygnus.com> + * Public domain. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__significandl) + fldt 4(%esp) + fxtract + fstpt %st(1) + ret +weak_alias (__significandl, significandl) |