about summary refs log tree commit diff
path: root/sysdeps/libm-i387
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-i387')
-rw-r--r--sysdeps/libm-i387/s_finite.S12
-rw-r--r--sysdeps/libm-i387/s_finitef.S12
-rw-r--r--sysdeps/libm-i387/s_finitel.S14
-rw-r--r--sysdeps/libm-i387/s_nearbyint.S23
-rw-r--r--sysdeps/libm-i387/s_nearbyintf.S23
-rw-r--r--sysdeps/libm-i387/s_nearbyintl.S23
-rw-r--r--sysdeps/libm-i387/s_trunc.S36
-rw-r--r--sysdeps/libm-i387/s_truncf.S36
-rw-r--r--sysdeps/libm-i387/s_truncl.S36
9 files changed, 189 insertions, 26 deletions
diff --git a/sysdeps/libm-i387/s_finite.S b/sysdeps/libm-i387/s_finite.S
index 7c67e1906f..384fc1c79e 100644
--- a/sysdeps/libm-i387/s_finite.S
+++ b/sysdeps/libm-i387/s_finite.S
@@ -1,18 +1,14 @@
 /*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
+ * Written by Joe Keane <jgk@jgk.org>.
  */
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: s_finite.S,v 1.4 1995/05/08 23:57:41 jtc Exp $")
-
 ENTRY(__finite)
 	movl	8(%esp),%eax
-	andl	$0x7ff00000, %eax
-	cmpl	$0x7ff00000, %eax
-	setne	%al
-	andl	$0x000000ff, %eax
+	orl	$0x800fffff, %eax
+	incl	%eax
+	shrl	$31, %eax
 	ret
 END (__finite)
 weak_alias (__finite, finite)
diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S
index ee26c875a5..51b4d0d536 100644
--- a/sysdeps/libm-i387/s_finitef.S
+++ b/sysdeps/libm-i387/s_finitef.S
@@ -1,18 +1,14 @@
 /*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
+ * Written by Joe Keane <jgk@jgk.org>.
  */
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: s_finitef.S,v 1.3 1995/05/09 00:00:02 jtc Exp $")
-
 ENTRY(__finitef)
 	movl	4(%esp),%eax
-	andl	$0x7f800000, %eax
-	cmpl	$0x7f800000, %eax
-	setne	%al
-	andl	$0x000000ff, %eax
+	orl	$0x807fffff, %eax
+	incl	%eax
+	shrl	$31, %eax
 	ret
 END (__finitef)
 weak_alias (__finitef, finitef)
diff --git a/sysdeps/libm-i387/s_finitel.S b/sysdeps/libm-i387/s_finitel.S
index 944b2497e2..acc5ad4cd0 100644
--- a/sysdeps/libm-i387/s_finitel.S
+++ b/sysdeps/libm-i387/s_finitel.S
@@ -1,20 +1,14 @@
 /*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Written by Joe Keane <jgk@jgk.org>.
  */
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: $")
-
 ENTRY(__finitel)
 	movl	12(%esp),%eax
-	andl	$0x7fff, %eax
-	cmpl	$0x7fff, %eax
-	setne	%al
-	andl	$0x000000ff, %eax
+	orl	$0xffff8000, %eax
+	incl	%eax
+	shrl	$31, %eax
 	ret
 END (__finitel)
 weak_alias (__finitel, finitel)
diff --git a/sysdeps/libm-i387/s_nearbyint.S b/sysdeps/libm-i387/s_nearbyint.S
new file mode 100644
index 0000000000..566c075c37
--- /dev/null
+++ b/sysdeps/libm-i387/s_nearbyint.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>.  */
+
+#include <machine/asm.h>
+
+ENTRY(__nearbyint)
+	fldl	4(%esp)
+	pushl	%eax
+	pushl	%ecx
+	fnstcw	(%esp)
+	movl	(%esp), %eax
+	andl	$~0x20, %eax
+	movl	%eax, 4(%esp)
+	fldcw	4(%esp)
+	frndint
+	fclex
+	fldcw	(%esp)
+	ret
+END (__nearbyint)
+weak_alias (__nearbyint, nearbyint)
diff --git a/sysdeps/libm-i387/s_nearbyintf.S b/sysdeps/libm-i387/s_nearbyintf.S
new file mode 100644
index 0000000000..715434031c
--- /dev/null
+++ b/sysdeps/libm-i387/s_nearbyintf.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>.  */
+
+#include <machine/asm.h>
+
+ENTRY(__nearbyintf)
+	flds	4(%esp)
+	pushl	%eax
+	pushl	%ecx
+	fnstcw	(%esp)
+	movl	(%esp), %eax
+	andl	$~0x20, %eax
+	movl	%eax, 4(%esp)
+	fldcw	4(%esp)
+	frndint
+	fclex
+	fldcw	(%esp)
+	ret
+END (__nearbyintf)
+weak_alias (__nearbyintf, nearbyintf)
diff --git a/sysdeps/libm-i387/s_nearbyintl.S b/sysdeps/libm-i387/s_nearbyintl.S
new file mode 100644
index 0000000000..c50b42d961
--- /dev/null
+++ b/sysdeps/libm-i387/s_nearbyintl.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>.  */
+
+#include <machine/asm.h>
+
+ENTRY(__nearbyintl)
+	fldt	4(%esp)
+	pushl	%eax
+	pushl	%ecx
+	fnstcw	(%esp)
+	movl	(%esp), %eax
+	andl	$~0x20, %eax
+	movl	%eax, 4(%esp)
+	fldcw	4(%esp)
+	frndint
+	fclex
+	fldcw	(%esp)
+	ret
+END (__nearbyintl)
+weak_alias (__nearbyintl, nearbyintl)
diff --git a/sysdeps/libm-i387/s_trunc.S b/sysdeps/libm-i387/s_trunc.S
new file mode 100644
index 0000000000..3100d716a9
--- /dev/null
+++ b/sysdeps/libm-i387/s_trunc.S
@@ -0,0 +1,36 @@
+/* Truncate double value.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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>
+
+ENTRY(__trunc)
+	fldl	4(%esp)
+	subl	$8, %esp
+	fstcw	4(%esp)
+	movl	$0xc00, %edx
+	orl	4(%esp), %edx
+	movl	%edx, (%esp)
+	fldcw	(%esp)
+	frndint
+	fldcw	4(%esp)
+	addl	$8, %esp
+	ret
+END(__trunc)
+weak_alias (__trunc, trunc)
diff --git a/sysdeps/libm-i387/s_truncf.S b/sysdeps/libm-i387/s_truncf.S
new file mode 100644
index 0000000000..275e5f714c
--- /dev/null
+++ b/sysdeps/libm-i387/s_truncf.S
@@ -0,0 +1,36 @@
+/* Truncate float value.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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>
+
+ENTRY(__truncf)
+	flds	4(%esp)
+	subl	$8, %esp
+	fstcw	4(%esp)
+	movl	$0xc00, %edx
+	orl	4(%esp), %edx
+	movl	%edx, (%esp)
+	fldcw	(%esp)
+	frndint
+	fldcw	4(%esp)
+	addl	$8, %esp
+	ret
+END(__truncf)
+weak_alias (__truncf, truncf)
diff --git a/sysdeps/libm-i387/s_truncl.S b/sysdeps/libm-i387/s_truncl.S
new file mode 100644
index 0000000000..4c0bb0ce53
--- /dev/null
+++ b/sysdeps/libm-i387/s_truncl.S
@@ -0,0 +1,36 @@
+/* Truncate long double value.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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>
+
+ENTRY(__truncl)
+	fldt	4(%esp)
+	subl	$8, %esp
+	fstcw	4(%esp)
+	movl	$0xc00, %edx
+	orl	4(%esp), %edx
+	movl	%edx, (%esp)
+	fldcw	(%esp)
+	frndint
+	fldcw	4(%esp)
+	addl	$8, %esp
+	ret
+END(__truncl)
+weak_alias (__truncl, truncl)