revert between 56095 -> 55830 in arch
[AROS.git] / arch / i386-all / stdc / math / s_truncf.s
blob93368dd6e3ee0bfb6d81d6fd3e08e40f3c04bcb5
1 /*
2 * Based on code 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(truncf)
11 _FUNCTION(AROS_CDEFNAME(truncf))
13 .set FirstArg, 4 /* Skip Return-Adress */
14 .set arg_x, FirstArg
16 AROS_CDEFNAME(truncf):
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 $0x0c00,%dx /* round towards -oo */
24 movw %dx,-8(%ebp)
25 fldcw -8(%ebp) /* load modfied control word */
27 flds 8(%ebp) /* round */
28 frndint
30 fldcw -4(%ebp) /* restore original control word */
32 leave
33 ret