about summary refs log tree commit diff
path: root/REORG.TODO/sysdeps/i386/fpu/s_remquol.S
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/sysdeps/i386/fpu/s_remquol.S')
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_remquol.S45
1 files changed, 45 insertions, 0 deletions
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_remquol.S b/REORG.TODO/sysdeps/i386/fpu/s_remquol.S
new file mode 100644
index 0000000000..f3d84fc7c2
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_remquol.S
@@ -0,0 +1,45 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+#define PARMS	4		/* no space for saved regs */
+#define DVDND	PARMS
+#define DVSOR	DVDND+12
+#define QUOP	DVSOR+12
+
+	.text
+ENTRY (__remquol)
+
+	fldt	DVSOR(%esp)
+	fldt	DVDND(%esp)
+1:	fprem1
+	fstsw	%ax
+	sahf
+	jp	1b
+	fstp	%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
+	leal	(%ecx,%ecx,2),%ecx
+	movl	$0xef2a60, %eax
+	shrl	%cl, %eax
+	andl	$7, %eax
+	movl	QUOP(%esp), %ecx
+	movl	DVDND+8(%esp), %edx
+	xorl	DVSOR+8(%esp), %edx
+	testl	$0x8000, %edx
+	jz	1f
+	negl	%eax
+1:	movl	%eax, (%ecx)
+
+	ret
+END (__remquol)
+weak_alias (__remquol, remquol)