add i386 arch specific overrides of appropriate math functions using the 387 fpu.
[AROS.git] / arch / i386-all / stdc / math / s_floorf.s
blob5f04a440389b6992eaf66222327327c783a40bea
1 /*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Public domain.
4 */
6 #include "aros/i386/asm.h"
8 .text
9 _ALIGNMENT
10 .globl AROS_CDEFNAME(floorf)
11 _FUNCTION(AROS_CDEFNAME(floorf))
13 .set FirstArg, 4 /* Skip Return-Adress */
14 .set arg_x, FirstArg
16 AROS_CDEFNAME(floorf):
17 pushl %ebp
18 movl %esp,%ebp
19 subl $8,%esp
21 fstcw -4(%ebp) /* store fpu control word */
22 movw -4(%ebp),%dx
23 orw $0x0400,%dx /* round towards -oo */
24 andw $0xf7ff,%dx
25 movw %dx,-8(%ebp)
26 fldcw -8(%ebp) /* load modfied control word */
28 flds 8(%ebp); /* round */
29 frndint
31 fldcw -4(%ebp) /* restore original control word */
33 leave
34 ret