1/*
2 * Public domain.
3 */
4
5#include <libm-alias-ldouble.h>
6#include <machine/asm.h>
7
8#define PARMS	4		/* no space for saved regs */
9#define DVDND	PARMS
10#define DVSOR	DVDND+12
11#define QUOP	DVSOR+12
12
13	.text
14ENTRY (__remquol)
15
16	fldt	DVSOR(%esp)
17	fldt	DVDND(%esp)
181:	fprem1
19	fstsw	%ax
20	sahf
21	jp	1b
22	fstp	%st(1)
23	/* Compute the congruent of the quotient.  */
24	movl	%eax, %ecx
25	shrl	$8, %eax
26	shrl	$12, %ecx
27	andl	$4, %ecx
28	andl	$3, %eax
29	orl	%eax, %ecx
30	leal	(%ecx,%ecx,2),%ecx
31	movl	$0xef2a60, %eax
32	shrl	%cl, %eax
33	andl	$7, %eax
34	movl	QUOP(%esp), %ecx
35	movl	DVDND+8(%esp), %edx
36	xorl	DVSOR+8(%esp), %edx
37	testl	$0x8000, %edx
38	jz	1f
39	negl	%eax
401:	movl	%eax, (%ecx)
41
42	ret
43END (__remquol)
44libm_alias_ldouble (__remquo, remquo)
45