[ASM]
[reactos.git] / reactos / lib / sdk / crt / math / amd64 / ceilf.S
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * PURPOSE: Implementation of tan
5 * FILE: lib/sdk/crt/math/amd64/ceilf.S
6 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include <asm.inc>
12 #include <ksamd64.inc>
13
14 /* FUNCTIONS ****************************************************************/
15
16 .code64
17
18 PUBLIC ceilf
19 ceilf:
20 sub rsp, 16
21
22 /* Put parameter on the stack */
23 movss [rsp], xmm0
24 fld dword ptr [rsp]
25
26 /* Change fpu control word to round up */
27 fstcw [rsp + 8]
28 mov eax, [rsp + 8]
29 or eax, HEX(00800)
30 and eax, HEX(0fbff)
31 mov [rsp + 12], eax
32 fldcw [rsp + 12]
33
34 /* Round to integer */
35 frndint
36
37 /* Restore fpu control word */
38 fldcw [rsp + 8]
39
40 fstp dword ptr [rsp]
41 movss xmm0, [rsp]
42
43 add rsp, 16
44 ret
45
46 END