xref: /reactos/sdk/lib/crt/math/i386/floorf.S (revision 845faec4)
1/*
2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Public domain.
4 *
5 * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
6 *
7 * Removed header file dependency for use in libmingwex.a by
8 *   Danny Smith <dannysmith@users.sourceforge.net>
9 */
10
11#include <asm.inc>
12
13.code
14.align 4
15
16PUBLIC _floorf
17_floorf:
18
19	fld dword ptr [esp + 4]
20	sub esp, 8
21
22	fstcw [esp + 4]		/* store fpu control word */
23
24	/* We use here %edx although only the low 1 bits are defined.
25	   But none of the operations should care and they are faster
26	   than the 16 bit operations.  */
27	mov edx, [esp + 4]
28	or edx, HEX(0400)		/* round towards -oo */
29	and edx, HEX(0f7ff)
30	mov [esp], edx
31	fldcw [esp]			/* load modified control word */
32
33	frndint				/* round */
34
35	fldcw [esp + 4]			/* restore original control word */
36
37	add esp, 8
38	ret
39
40END
41