initial commit
[glibc.git] / sysdeps / i386 / fpu / s_remquof.S
1 /*
2 * Public domain.
3 */
4
5 #include <machine/asm.h>
6 #include <libm-alias-float.h>
7
8 #define PARMS 4 /* no space for saved regs */
9 #define DVDND PARMS
10 #define DVSOR DVDND+4
11 #define QUOP DVSOR+4
12
13 .text
14 ENTRY (__remquof)
15
16 flds DVSOR(%esp)
17 flds DVDND(%esp)
18 1: 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(%esp), %edx
36 xorl DVSOR(%esp), %edx
37 testl $0x80000000, %edx
38 jz 1f
39 negl %eax
40 1: movl %eax, (%ecx)
41
42 ret
43 END (__remquof)
44 libm_alias_float (__remquo, remquo)