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_nextafterl.c2
-rw-r--r--sysdeps/libm-i387/s_remquo.S31
-rw-r--r--sysdeps/libm-i387/s_remquof.S31
-rw-r--r--sysdeps/libm-i387/s_remquol.S31
4 files changed, 94 insertions, 1 deletions
diff --git a/sysdeps/libm-i387/s_nextafterl.c b/sysdeps/libm-i387/s_nextafterl.c
index b574430832..4596c6b93c 100644
--- a/sysdeps/libm-i387/s_nextafterl.c
+++ b/sysdeps/libm-i387/s_nextafterl.c
@@ -49,7 +49,7 @@ static char rcsid[] = "$NetBSD: $";
 	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(x==y) return y;		/* x=y, return y */
 	if((ix|hx|lx)==0) {			/* x == 0 */
 	    SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */
 	    y = x*x;
diff --git a/sysdeps/libm-i387/s_remquo.S b/sysdeps/libm-i387/s_remquo.S
new file mode 100644
index 0000000000..a4c5a35468
--- /dev/null
+++ b/sysdeps/libm-i387/s_remquo.S
@@ -0,0 +1,31 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__remquo)
+	fldl	12(%esp)
+	fldl	4(%esp)
+1:	fprem1
+	fstsw	%ax
+	sahf
+	jp	1b
+	fstpl	%st(1)
+	/* Compute the congruent of the quotient.  */
+	movl	%eax, %ecx
+	shrl	$8, %eax
+	shrl	$12, %ecx
+	andl	$4, %ecx
+	andl	$3, %eax
+	orl	%eax, %ecx
+	movl	$0xef2960, %eax
+	shrl	%cl, %eax
+	andl	$3, %eax
+	movl	20(%esp), %ecx
+	movl	%eax, (%ecx)
+	ret
+END (__remquo)
+weak_alias (__remquo, remquo)
diff --git a/sysdeps/libm-i387/s_remquof.S b/sysdeps/libm-i387/s_remquof.S
new file mode 100644
index 0000000000..56954323a6
--- /dev/null
+++ b/sysdeps/libm-i387/s_remquof.S
@@ -0,0 +1,31 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__remquof)
+	flds	8(%esp)
+	flds	4(%esp)
+1:	fprem1
+	fstsw	%ax
+	sahf
+	jp	1b
+	fstpl	%st(1)
+	/* Compute the congruent of the quotient.  */
+	movl	%eax, %ecx
+	shrl	$8, %eax
+	shrl	$12, %ecx
+	andl	$4, %ecx
+	andl	$3, %eax
+	orl	%eax, %ecx
+	movl	$0xef2960, %eax
+	shrl	%cl, %eax
+	andl	$3, %eax
+	movl	12(%esp), %ecx
+	movl	%eax, (%ecx)
+	ret
+END (__remquof)
+weak_alias (__remquof, remquof)
diff --git a/sysdeps/libm-i387/s_remquol.S b/sysdeps/libm-i387/s_remquol.S
new file mode 100644
index 0000000000..9c91d90c45
--- /dev/null
+++ b/sysdeps/libm-i387/s_remquol.S
@@ -0,0 +1,31 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__remquol)
+	fldt	16(%esp)
+	fldt	4(%esp)
+1:	fprem1
+	fstsw	%ax
+	sahf
+	jp	1b
+	fstpl	%st(1)
+	/* Compute the congruent of the quotient.  */
+	movl	%eax, %ecx
+	shrl	$8, %eax
+	shrl	$12, %ecx
+	andl	$4, %ecx
+	andl	$3, %eax
+	orl	%eax, %ecx
+	movl	$0xef2960, %eax
+	shrl	%cl, %eax
+	andl	$3, %eax
+	movl	28(%esp), %ecx
+	movl	%eax, (%ecx)
+	ret
+END (__remquol)
+weak_alias (__remquol, remquol)