chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / sysdeps / i386 / fpu / s_floor.S
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  */
5
6 #include <machine/asm.h>
7
8 RCSID("$NetBSD: s_floor.S,v 1.4 1995/05/09 00:01:59 jtc Exp $")
9
10 ENTRY(__floor)
11         fldl    4(%esp)
12         subl    $8,%esp
13
14         fstcw   4(%esp)                 /* store fpu control word */
15
16         /* We use here %edx although only the low 1 bits are defined.
17            But none of the operations should care and they are faster
18            than the 16 bit operations.  */
19         movl    $0x400,%edx             /* round towards -oo */
20         orl     4(%esp),%edx
21         andl    $0xf7ff,%edx
22         movl    %edx,(%esp)
23         fldcw   (%esp)                  /* load modified control word */
24
25         frndint                         /* round */
26
27         fldcw   4(%esp)                 /* restore original control word */
28
29         addl    $8,%esp
30         ret
31 END (__floor)
32 weak_alias (__floor, floor)