aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/strsep.c8
-rw-r--r--sysdeps/i386/isinfl.c46
-rw-r--r--sysdeps/i386/isnanl.c43
-rw-r--r--sysdeps/i386/strsep.S3
-rw-r--r--sysdeps/i386/strtok.S63
-rw-r--r--sysdeps/ieee754/isinf.c40
-rw-r--r--sysdeps/ieee754/isinfl.c44
-rw-r--r--sysdeps/ieee754/isnan.c37
-rw-r--r--sysdeps/ieee754/isnanl.c40
-rw-r--r--sysdeps/libm-i387/e_acosl.S21
-rw-r--r--sysdeps/libm-i387/e_exp.S17
-rw-r--r--sysdeps/libm-i387/s_ceil.S10
-rw-r--r--sysdeps/libm-i387/s_ceilf.S10
-rw-r--r--sysdeps/libm-i387/s_ceill.S30
-rw-r--r--sysdeps/libm-i387/s_copysignl.S20
-rw-r--r--sysdeps/libm-i387/s_finitel.S19
-rw-r--r--sysdeps/libm-i387/s_floor.S10
-rw-r--r--sysdeps/libm-i387/s_floorf.S10
-rw-r--r--sysdeps/libm-i387/s_floorl.S30
-rw-r--r--sysdeps/libm-i387/s_isinfl.c36
-rw-r--r--sysdeps/libm-i387/s_isnanl.c46
-rw-r--r--sysdeps/libm-i387/s_nextafterl.c102
-rw-r--r--sysdeps/libm-i387/s_rintl.S15
-rw-r--r--sysdeps/libm-i387/s_significandl.S16
-rw-r--r--sysdeps/libm-ieee754/s_ceill.c89
-rw-r--r--sysdeps/libm-ieee754/s_copysignl.c43
-rw-r--r--sysdeps/libm-ieee754/s_fabsl.c40
-rw-r--r--sysdeps/libm-ieee754/s_finitel.c40
-rw-r--r--sysdeps/libm-ieee754/s_floorl.c89
-rw-r--r--sysdeps/libm-ieee754/s_isinf.c3
-rw-r--r--sysdeps/libm-ieee754/s_isinfl.c33
-rw-r--r--sysdeps/libm-ieee754/s_isnan.c7
-rw-r--r--sysdeps/libm-ieee754/s_isnanl.c44
-rw-r--r--sysdeps/libm-ieee754/s_nextafterl.c99
-rw-r--r--sysdeps/libm-ieee754/s_rintl.c96
-rw-r--r--sysdeps/libm-ieee754/s_scalbnl.c71
-rw-r--r--sysdeps/libm-ieee754/s_significandl.c39
-rw-r--r--sysdeps/mach/hurd/Makefile2
38 files changed, 1070 insertions, 341 deletions
diff --git a/sysdeps/generic/strsep.c b/sysdeps/generic/strsep.c
index b57a22f649..6fbcb084a6 100644
--- a/sysdeps/generic/strsep.c
+++ b/sysdeps/generic/strsep.c
@@ -13,8 +13,8 @@ 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. */
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
#include <string.h>
@@ -31,9 +31,9 @@ strsep (char **stringp, const char *delim)
end = strpbrk (begin, delim);
if (end)
{
- /* Terminate the token and advance *STRINGP past the delimiters. */
+ /* Terminate the token and set *STRINGP past NUL character. */
*end++ = '\0';
- *stringp = end + strspn (end, delim);
+ *stringp = end;
}
else
/* No more delimiters; this is the last token. */
diff --git a/sysdeps/i386/isinfl.c b/sysdeps/i386/isinfl.c
deleted file mode 100644
index 056d756d58..0000000000
--- a/sysdeps/i386/isinfl.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Check `long double' for Infinity. i386 FPU version.
-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 <math.h>
-#include "ieee754.h"
-
-#undef __isinfl
-#undef isinfl
-
-
-/* Return 0 if VALUE is finite or NaN, +1 if it
- is +Infinity, -1 if it is -Infinity. */
-int
-__isinfl (long double value)
-{
- union ieee854_long_double u;
-
- u.d = value;
-
- /* Intel's interpretation of the IEEE 854 standard defines Inf to
- have the maximum possible exponent and the MSB of the mantissa
- set. No further bit of the mantissa must be set. */
- if ((u.ieee.exponent & 0x7fff) == 0x7fff &&
- u.ieee.mantissa0 == 0x80000000 && u.ieee.mantissa1 == 0)
- return u.ieee.negative ? -1 : 1;
-
- return 0;
-}
-
-weak_alias (__isinfl, isinfl);
diff --git a/sysdeps/i386/isnanl.c b/sysdeps/i386/isnanl.c
deleted file mode 100644
index de10c07532..0000000000
--- a/sysdeps/i386/isnanl.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Check `long double' for Not A Number. i386 FPU version.
-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 <math.h>
-#include "ieee754.h"
-
-#undef __isnanl
-#undef isnanl
-
-
-/* Return nonzero if VALUE is not a number. */
-int
-__isnanl (long double value)
-{
- union ieee854_long_double u;
-
- u.d = value;
-
- /* Intel's interpretation of the IEEE 854 standard defines NaN to
- have the maximum possible exponent and the MSB and at least one
- more bit of the mantissa set. */
- return ((u.ieee.exponent & 0x7fff) == 0x7fff
- && ((u.ieee.mantissa0 & 0x80000000) != 0)
- && ((u.ieee.mantissa0 & 0x7fffffff) != 0 || u.ieee.mantissa1 != 0));
-}
-
-weak_alias (__isnanl, isnanl);
diff --git a/sysdeps/i386/strsep.S b/sysdeps/i386/strsep.S
deleted file mode 100644
index 8c425dd505..0000000000
--- a/sysdeps/i386/strsep.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNCTION strsep
-#define USE_AS_STRSEP 1
-#include <sysdeps/i386/strtok.S>
diff --git a/sysdeps/i386/strtok.S b/sysdeps/i386/strtok.S
index 28845e08cf..2ef8803ef6 100644
--- a/sysdeps/i386/strtok.S
+++ b/sysdeps/i386/strtok.S
@@ -19,7 +19,6 @@ 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 <errnos.h>
#include <sysdep.h>
/* This file can be used for three variants of the strtok function:
@@ -35,14 +34,9 @@ Boston, MA 02111-1307, USA. */
delim (sp + 8)
save_ptr (sp + 12)
- strsep:
- INPUT PARAMETERS
- str_ptr (sp + 4)
- delim (sp + 8)
-
We do a common implementation here. */
-#if !defined (USE_AS_STRTOK_R) && !defined (USE_AS_STRSEP)
+#ifndef USE_AS_STRTOK_R
.bss
.local save_ptr
ASM_TYPE_DIRECTIVE (save_ptr, @object)
@@ -53,73 +47,40 @@ save_ptr:
#define FUNCTION strtok
#endif
- /* We use the possibility to do some more initialization
- for the strtok implementation. */
.text
-Lillegal_argument:
-#ifndef PIC
- movl $EINVAL, C_SYMBOL_NAME(errno)
- xorl %eax, %eax
-#else
-# if defined (USE_AS_STRTOK_R) || defined (USE_AS_STRSEP)
- pushl %ebx /* Save PIC register. */
- call Lhere2
-Lhere2: popl %ebx
- addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere2], %ebx
-# endif
- movl errno@GOT(%ebx), %ebx
- movl $EINVAL, (%ebx)
- xorl %eax, %eax
- popl %ebx
-#endif
- ret
-
ENTRY (FUNCTION)
movl 4(%esp), %edx /* Get start of string. */
movl 8(%esp), %eax /* Get start of delimiter set. */
-#ifdef USE_AS_STRSEP
- /* %EDX does not yet contain the string starting point. Only
- a pointer to the location where it is stored. */
- movl (%edx), %edx
-#else
-# if !defined (USE_AS_STRTOK_R) && defined (PIC)
+#if !defined (USE_AS_STRTOK_R) && defined (PIC)
pushl %ebx /* Save PIC register. */
call Lhere
Lhere: popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere], %ebx
-# endif
+#endif
/* If the pointer is NULL we have to use the stored value of
the last run. */
cmpl $0, %edx
jne L0
-# ifdef USE_AS_STRTOK_R
+#ifdef USE_AS_STRTOK_R
/* The value is stored in the third argument. */
movl 12(%esp), %edx
movl (%edx), %edx
-# else
+#else
/* The value is in the local variable defined above. But
we have to take care for PIC code. */
-# ifndef PIC
+# ifndef PIC
movl save_ptr, %edx
-# else
+# else
movl save_ptr@GOTOFF(%ebx), %edx
-# endif
# endif
#endif
- /* Compare whether pointer is NULL. We are tolerant here
- because the C function do the same. */
- cmpl $0, %edx
- je Lillegal_argument
-
-#ifndef USE_AS_STRSEP
L0:
-#endif
/* First we create a table with flags for all possible characters.
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
supported by the C string functions we have 256 characters.
@@ -224,8 +185,8 @@ L1: leal -4(%edx), %eax /* prepare loop */
1. a character in the stopset was found
and
2. the end of the string was found
- But as a sign that the chracter is in the stopset we store its
- value in the table. But the value of NUL is NUL so the loop
+ As a sign that the character is in the stopset we store its
+ value in the table. The value of NUL is NUL so the loop
terminates for NUL in every case. */
L3: addl $4, %eax /* adjust pointer for full loop round */
@@ -295,9 +256,6 @@ L11:
#ifdef USE_AS_STRTOK_R
movl 12(%esp), %ecx
movl %edx, (%ecx)
-#elif USE_AS_STRSEP
- movl 4(%esp), %ecx
- movl %edx, (%ecx)
#else
# ifndef PIC
movl %edx, save_ptr
@@ -315,9 +273,6 @@ LreturnNULL:
#ifdef USE_AS_STRTOK_R
movl 12(%esp), %ecx
movl %eax, (%ecx)
-#elif USE_AS_STRSEP
- movl 4(%esp), %ecx
- movl %eax, (%ecx)
#else
# ifndef PIC
movl %eax, save_ptr
diff --git a/sysdeps/ieee754/isinf.c b/sysdeps/ieee754/isinf.c
deleted file mode 100644
index 79be916432..0000000000
--- a/sysdeps/ieee754/isinf.c
+++ /dev/null
@@ -1,40 +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 <ansidecl.h>
-#include <math.h>
-#include "ieee754.h"
-
-/* Return 0 if VALUE is finite or NaN, +1 if it
- is +Infinity, -1 if it is -Infinity. */
-int
-DEFUN(__isinf, (value), double value)
-{
- union ieee754_double u;
-
- u.d = value;
- /* An IEEE 754 infinity has an exponent with the
- maximum possible value and a zero mantissa. */
- if ((u.ieee.exponent & 0x7ff) == 0x7ff &&
- u.ieee.mantissa0 == 0 && u.ieee.mantissa1 == 0)
- return u.ieee.negative ? -1 : 1;
-
- return 0;
-}
-
-weak_alias (__isinf, isinf)
diff --git a/sysdeps/ieee754/isinfl.c b/sysdeps/ieee754/isinfl.c
deleted file mode 100644
index ad03728ad8..0000000000
--- a/sysdeps/ieee754/isinfl.c
+++ /dev/null
@@ -1,44 +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 <math.h>
-#include "ieee754.h"
-
-#undef __isinfl
-#undef isinfl
-
-
-/* Return 0 if VALUE is finite or NaN, +1 if it
- is +Infinity, -1 if it is -Infinity. */
-int
-__isinfl (long double value)
-{
- union ieee854_long_double u;
-
- u.d = value;
-
- /* An IEEE 854 infinity has an exponent with the
- maximum possible value and a zero mantissa. */
- if ((u.ieee.exponent & 0x7fff) == 0x7fff &&
- u.ieee.mantissa0 == 0 && u.ieee.mantissa1 == 0)
- return u.ieee.negative ? -1 : 1;
-
- return 0;
-}
-
-weak_alias (__isinfl, isinfl);
diff --git a/sysdeps/ieee754/isnan.c b/sysdeps/ieee754/isnan.c
deleted file mode 100644
index 8a537cc0dd..0000000000
--- a/sysdeps/ieee754/isnan.c
+++ /dev/null
@@ -1,37 +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 <ansidecl.h>
-#include <math.h>
-#include "ieee754.h"
-
-/* Return nonzero if VALUE is not a number. */
-int
-DEFUN(__isnan, (value), double value)
-{
- union ieee754_double u;
-
- u.d = value;
-
- /* IEEE 754 NaN's have the maximum possible
- exponent and a nonzero mantissa. */
- return ((u.ieee.exponent & 0x7ff) == 0x7ff &&
- (u.ieee.mantissa0 != 0 || u.ieee.mantissa1 != 0));
-}
-
-weak_alias (__isnan, isnan)
diff --git a/sysdeps/ieee754/isnanl.c b/sysdeps/ieee754/isnanl.c
deleted file mode 100644
index b06b31a3d2..0000000000
--- a/sysdeps/ieee754/isnanl.c
+++ /dev/null
@@ -1,40 +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 <math.h>
-#include "ieee754.h"
-
-#undef __isnanl
-#undef isnanl
-
-
-/* Return nonzero if VALUE is not a number. */
-int
-__isnanl (long double value)
-{
- union ieee854_long_double u;
-
- u.d = value;
-
- /* IEEE 854 NaN's have the maximum possible
- exponent and a nonzero mantissa. */
- return ((u.ieee.exponent & 0x7fff) == 0x7fff &&
- (u.ieee.mantissa0 != 0 || u.ieee.mantissa1 != 0));
-}
-
-weak_alias (__isnanl, isnanl);
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)
diff --git a/sysdeps/libm-ieee754/s_ceill.c b/sysdeps/libm-ieee754/s_ceill.c
new file mode 100644
index 0000000000..c5c86487ea
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_ceill.c
@@ -0,0 +1,89 @@
+/* s_ceill.c -- long double version of s_ceil.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
+
+/*
+ * ceill(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to ceil(x).
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double huge = 1.0e4930;
+#else
+static long double huge = 1.0e4930;
+#endif
+
+#ifdef __STDC__
+ long double __ceill(long double x)
+#else
+ long double __ceill(x)
+ long double x;
+#endif
+{
+ int32_t i1,j0;
+ u_int32_t i,j,se,i0,sx;
+ GET_LDOUBLE_WORDS(se,i0,i1,x);
+ sx = (se>>15)&1;
+ j0 = (se&0x7fff)-0x3fff;
+ if(j0<32) {
+ if(j0<0) { /* raise inexact if x != 0 */
+ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+ if(sx) {es=0x8000;i0=0;i1=0;}
+ else if((i0|i1)!=0) { es=0x3fff;i0=0;i1=0;}
+ }
+ } else {
+ i = (0xffffffff)>>j0;
+ if(((i0&i)|i1)==0) return x; /* x is integral */
+ if(huge+x>0.0) { /* raise inexact flag */
+ if(sx==0) {
+ if (j0>0) i0 += (0x80000000)>>(j0-1);
+ else ++se;
+ }
+ i0 &= (~i); i1=0;
+ }
+ }
+ } else if (j0>63) {
+ if(j0==0x4000) return x+x; /* inf or NaN */
+ else return x; /* x is integral */
+ } else {
+ i = ((u_int32_t)(0xffffffff))>>(j0-32);
+ if((i1&i)==0) return x; /* x is integral */
+ if(huge+x>0.0) { /* raise inexact flag */
+ if(sx==0) {
+ if(j0==32) i0+=1;
+ else {
+ j = i1 + (1<<(64-j0));
+ if(j<i1) i0+=1; /* got a carry */
+ i1 = j;
+ }
+ }
+ i1 &= (~i);
+ }
+ }
+ SET_LDOUBLE_WORDS(x,se,i0,i1);
+ return x;
+}
+weak_alias (__ceill, ceill)
diff --git a/sysdeps/libm-ieee754/s_copysignl.c b/sysdeps/libm-ieee754/s_copysignl.c
new file mode 100644
index 0000000000..9976575b3b
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_copysignl.c
@@ -0,0 +1,43 @@
+/* s_copysignl.c -- long double version of s_copysign.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
+
+/*
+ * copysignl(long double x, long double y)
+ * copysignl(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __copysignl(long double x, long double y)
+#else
+ long double __copysignl(x,y)
+ long double x,y;
+#endif
+{
+ u_int32_t es1,es2;
+ GET_LDOUBLE_EXP(es1,x);
+ GET_LDOUBLE_EXP(es2,y);
+ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
+ return x;
+}
+weak_alias (__copysignl, copysignl)
diff --git a/sysdeps/libm-ieee754/s_fabsl.c b/sysdeps/libm-ieee754/s_fabsl.c
new file mode 100644
index 0000000000..f7170503fb
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fabsl.c
@@ -0,0 +1,40 @@
+/* s_fabsl.c -- long double version of s_fabs.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
+
+/*
+ * fabsl(x) returns the absolute value of x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __fabsl(long double x)
+#else
+ long double __fabsl(x)
+ long double x;
+#endif
+{
+ u_int32_t exp;
+ GET_LDOUBLE_EXP(exp,x);
+ SET_LDOUBLE_EXP(x,exp&0x7fff);
+ return x;
+}
+weak_alias (__fabsl, fabsl)
diff --git a/sysdeps/libm-ieee754/s_finitel.c b/sysdeps/libm-ieee754/s_finitel.c
new file mode 100644
index 0000000000..02487c610d
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_finitel.c
@@ -0,0 +1,40 @@
+/* s_finitel.c -- long double version of s_finite.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
+
+/*
+ * finitel(x) returns 1 is x is finite, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ int __finite(long double x)
+#else
+ int __finite(x)
+ long double x;
+#endif
+{
+ int32_t exp;
+ GET_LDOUBLE_EXP(exp,x);
+ return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>15);
+}
+weak_alias (__finitel, finitel)
diff --git a/sysdeps/libm-ieee754/s_floorl.c b/sysdeps/libm-ieee754/s_floorl.c
new file mode 100644
index 0000000000..8cd81c6302
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_floorl.c
@@ -0,0 +1,89 @@
+/* s_floorl.c -- long double version of s_floor.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
+
+/*
+ * floorl(x)
+ * Return x rounded toward -inf to integral value
+ * Method:
+ * Bit twiddling.
+ * Exception:
+ * Inexact flag raised if x not equal to floor(x).
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double huge = 1.0e4930;
+#else
+static long double huge = 1.0e4930;
+#endif
+
+#ifdef __STDC__
+ long double __floorl(long double x)
+#else
+ long double __floorl(x)
+ long double x;
+#endif
+{
+ int32_t i1,j0;
+ u_int32_t i,j,se,i0,sx;
+ GET_LDOUBLE_WORDS(se,i0,i1,x);
+ sx = (se>>15)&1;
+ j0 = (se&0x7fff)-0x3fff;
+ if(j0<32) {
+ if(j0<0) { /* raise inexact if x != 0 */
+ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
+ if(sx==0) {se=0;i0=i1=0;}
+ else if(((se&0x7fff)|i0|i1)!=0)
+ { se=0xbfff;i0;i1=0;}
+ }
+ } else {
+ i = (0xffffffff)>>j0;
+ if(((i0&i)|i1)==0) return x; /* x is integral */
+ if(huge+x>0.0) { /* raise inexact flag */
+ if(sx) {
+ if (j0>0) i0 += (0x80000000)>>(j0-1);
+ else ++se;
+ i0 &= (~i); i1=0;
+ }
+ }
+ } else if (j0>63) {
+ if(j0==0x4000) return x+x; /* inf or NaN */
+ else return x; /* x is integral */
+ } else {
+ i = ((u_int32_t)(0xffffffff))>>(j0-32);
+ if((i1&i)==0) return x; /* x is integral */
+ if(huge+x>0.0) { /* raise inexact flag */
+ if(sx) {
+ if(j0==32) i0+=1;
+ else {
+ j = i1+(1<<(64-j0));
+ if(j<i1) i0 +=1 ; /* got a carry */
+ i1=j;
+ }
+ }
+ i1 &= (~i);
+ }
+ }
+ SET_LDOUBLE_WORDS(x,se,i0,i1);
+ return x;
+}
+weak_alias (__floorl, floorl)
diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c
index a54d97cba6..6d435f00b2 100644
--- a/sysdeps/libm-ieee754/s_isinf.c
+++ b/sysdeps/libm-ieee754/s_isinf.c
@@ -30,3 +30,6 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
return (hx == 0);
}
weak_alias (__isinf, isinf)
+#ifdef NO_LONG_DOUBLE
+weak_alias (__isinf, isinfl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_isinfl.c b/sysdeps/libm-ieee754/s_isinfl.c
new file mode 100644
index 0000000000..22dff75444
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_isinfl.c
@@ -0,0 +1,33 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Change for long double by Ulrich Drepper <drepper@cygnus.com>.
+ * 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;
+ se |= hx | lx;
+ return (se == 0);
+}
+weak_alias (__isinfl, isinfl)
diff --git a/sysdeps/libm-ieee754/s_isnan.c b/sysdeps/libm-ieee754/s_isnan.c
index 2609a51968..4d8983c9b3 100644
--- a/sysdeps/libm-ieee754/s_isnan.c
+++ b/sysdeps/libm-ieee754/s_isnan.c
@@ -5,7 +5,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -32,8 +32,11 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
int32_t hx,lx;
EXTRACT_WORDS(hx,lx,x);
hx &= 0x7fffffff;
- hx |= (u_int32_t)(lx|(-lx))>>31;
+ hx |= (u_int32_t)(lx|(-lx))>>31;
hx = 0x7ff00000 - hx;
return (int)((u_int32_t)(hx))>>31;
}
weak_alias (__isnan, isnan)
+#ifdef NO_LONG_DOUBLE
+weak_alias (__isnan, isnanl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_isnanl.c b/sysdeps/libm-ieee754/s_isnanl.c
new file mode 100644
index 0000000000..0da97090bd
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_isnanl.c
@@ -0,0 +1,44 @@
+/* s_isnanl.c -- long double version 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;
+ hx |= lx;
+ se |= (u_int32_t)(hx|(-hx))>>31;
+ se = 0xfffe - se;
+ return (int)((u_int32_t)(se))>>16;
+}
+weak_alias (__isnanl, isnanl)
diff --git a/sysdeps/libm-ieee754/s_nextafterl.c b/sysdeps/libm-ieee754/s_nextafterl.c
new file mode 100644
index 0000000000..0327261f33
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterl.c
@@ -0,0 +1,99 @@
+/* s_nextafterl.c -- long double version of s_nextafter.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
+
+/* 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| */
+
+ if(((ix==0x7fff)&&((hx|lx)|-(hx|lx))!=0) || /* x is nan */
+ ((iy==0x7fff)&&((hy|ly)|-(hy|ly))!=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-ieee754/s_rintl.c b/sysdeps/libm-ieee754/s_rintl.c
new file mode 100644
index 0000000000..c9f12b162a
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_rintl.c
@@ -0,0 +1,96 @@
+/* s_rintl.c -- long double version of s_rint.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
+
+/*
+ * rintl(x)
+ * Return x rounded to integral value according to the prevailing
+ * rounding mode.
+ * Method:
+ * Using floating addition.
+ * Exception:
+ * Inexact flag raised if x not equal to rintl(x).
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+TWO64[2]={
+ 1.844674407370955161600000e+19, /* 0x403F, 0x00000000, 0x00000000 */
+ -1.844674407370955161600000e+19, /* 0xC03F, 0x00000000, 0x00000000 */
+};
+
+#ifdef __STDC__
+ long double __rintl(long double x)
+#else
+ long double __rintl(x)
+ long double x;
+#endif
+{
+ int32_t se,j0,sx;
+ u_int32_t i,i0,i1;
+ long double w,t;
+ GET_LDOUBLE_WORDS(se,i0,i1,x);
+ sx = (se>>15)&1;
+ j0 = (se&0x7fff)-0x3fff;
+ if(j0<32) {
+ if(j0<0) {
+ if(((se&0x7fff)|i0|i1)==0) return x;
+ i1 |= i0;
+ i0 &= 0xe0000000;
+ i0 |= (i1|-i1)&0x80000000;
+ SET_LDOUBLE_MSW(x,i0);
+ w = TWO64[sx]+x;
+ t = w-TWO64[sx];
+ GET_LDOUBLE_EXP(i0,t);
+ SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
+ return t;
+ } else {
+ i = (0xffffffff)>>j0;
+ if(((i0&i)|i1)==0) return x; /* x is integral */
+ i>>=1;
+ if(((i0&i)|i1)!=0) {
+ if(j0==31) i1 = 0x40000000; else
+ i0 = (i0&(~i))|((0x20000000)>>j0);
+ /* Shouldn't this be
+ if (j0 >= 30) i1 = 0x80000000 >> (j0 - 30);
+ i0 = (i0&(~i))|((0x20000000)>>j0);
+ If yes, this should be correct in s_rint and
+ s_rintf, too. -- drepper@cygnus.com */
+ }
+ }
+ } else if (j0>63) {
+ if(j0==0x4000) return x+x; /* inf or NaN */
+ else return x; /* x is integral */
+ } else {
+ i = ((u_int32_t)(0xffffffff))>>(j0-32);
+ if((i1&i)==0) return x; /* x is integral */
+ i>>=1;
+ if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-32));
+ }
+ SET_LDOUBLE_WORDS(x,se,i0,i1);
+ w = TWO64[sx]+x;
+ return w-TWO64[sx];
+}
+weak_alias (__rintl, rintl)
diff --git a/sysdeps/libm-ieee754/s_scalbnl.c b/sysdeps/libm-ieee754/s_scalbnl.c
new file mode 100644
index 0000000000..d00eb88167
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalbnl.c
@@ -0,0 +1,71 @@
+/* s_scalbnl.c -- long double version of s_scalbn.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
+
+/*
+ * scalbnl (long double x, int n)
+ * scalbnl(x,n) returns x* 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+huge = 1.0e+300,
+tiny = 1.0e-300;
+
+#ifdef __STDC__
+ long double __scalbnl (long double x, int n)
+#else
+ long double __scalbnl (x,n)
+ long double x; int n;
+#endif
+{
+ int32_t k,es,hx,lx;
+ GET_LDOUBLE_WORDS(es,hx,lx,x);
+ k = es&0x7fff; /* extract exponent */
+ if (k==0) { /* 0 or subnormal x */
+ if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+ x *= two54;
+ GET_HIGH_WORD(hx,x);
+ k = ((hx&0x7ff00000)>>20) - 54;
+ if (n< -50000) return tiny*x; /*underflow*/
+ }
+ if (k==0x7ff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (k > 0x7fe) return huge*__copysign(huge,x); /* overflow */
+ if (k > 0) /* normal result */
+ {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
+ if (k <= -54)
+ if (n > 50000) /* in case integer overflow in n+k */
+ return huge*__copysign(huge,x); /*overflow*/
+ else return tiny*__copysign(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
+ return x*twom54;
+}
+weak_alias (__scalbnl, scalbnl)
diff --git a/sysdeps/libm-ieee754/s_significandl.c b/sysdeps/libm-ieee754/s_significandl.c
new file mode 100644
index 0000000000..6339274b5a
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_significandl.c
@@ -0,0 +1,39 @@
+/* s_significandl.c -- long double version of s_significand.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
+
+/*
+ * significandl(x) computes just
+ * scalbl(x, (double) -ilogbl(x)),
+ * for exercising the fraction-part(F) IEEE 754-1985 test vector.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __significandl(long double x)
+#else
+ long double __significandl(x)
+ long double x;
+#endif
+{
+ return __ieee754_scalbl(x,(double) -ilogbl(x));
+}
+weak_alias (__significandl, significandl)
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 14dc1ebc83..298cd5f71a 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -76,7 +76,7 @@ endef
$(common-objpfx)errnos.d: $(mach-errnos-deps)
$(mach-errno-h) | \
$(CC) $(CPPFLAGS) -M -x c - | \
- sed -e 's,- *:,mach-errnos-deps :=,' > $@t
+ sed $(sed-remove-objpfx) -e 's,- *:,mach-errnos-deps :=,' > $@t
mv -f $@t $@
$(hurd)/errnos.h: $(common-objpfx)stamp-errnos ;