Merge all amd64 related changes from cmake branch
[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 /* CODE **********************************************************************/
15 .code64
16
17 PUBLIC ceilf
18 ceilf:
19 sub rsp, 16
20
21 /* Put parameter on the stack */
22 movss [rsp], xmm0
23 fld dword ptr [rsp]
24
25 /* Change fpu control word to round up */
26 fstcw [rsp + 8]
27 mov eax, [rsp + 8]
28 or eax, HEX(00800)
29 and eax, HEX(0fbff)
30 mov [rsp + 12], eax
31 fldcw [rsp + 12]
32
33 /* Round to integer */
34 frndint
35
36 /* Restore fpu control word */
37 fldcw [rsp + 8]
38
39 fstp dword ptr [rsp]
40 movss xmm0, [rsp]
41
42 add rsp, 16
43 ret
44
45 END