update from main archive 961229
[glibc.git] / sysdeps / libm-i387 / s_floor.S
blob561f83d98a452a40c99429b1b4c9c0f864c49bcf
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  */
6 #include <machine/asm.h>
8 RCSID("$NetBSD: s_floor.S,v 1.4 1995/05/09 00:01:59 jtc Exp $")
10 ENTRY(__floor)
11         pushl   %ebp
12         movl    %esp,%ebp
13         subl    $8,%esp
15         fstcw   -4(%ebp)                /* store fpu control word */
16         movw    -4(%ebp),%dx
17         orw     $0x0400,%dx             /* round towards -oo */
18         andw    $0xf7ff,%dx
19         movw    %dx,-8(%ebp)
20         fldcw   -8(%ebp)                /* load modified control word */
22         fldl    8(%ebp);                /* round */
23         frndint
25         fldcw   -4(%ebp)                /* restore original control word */
27         leave
28         ret
29 END (__floor)
30 weak_alias (__floor, floor)