[CRT]
[reactos.git] / reactos / lib / sdk / crt / math / i386 / ceilf.S
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6 #include <_mingw_mac.h>
7
8 .file "ceilf.S"
9 .text
10 .align 4
11 .globl __MINGW_USYMBOL(ceilf)
12 .def __MINGW_USYMBOL(ceilf); .scl 2; .type 32; .endef
13 __MINGW_USYMBOL(ceilf):
14 #ifdef _WIN64
15 subq $24,%rsp
16 movss %xmm0,8(%rsp)
17 flds 8(%rsp)
18
19 fstcw 4(%rsp) /* store fpu control word */
20
21 movl $0x0800,%edx /* round towards +oo */
22 orl 4(%rsp),%edx
23 andl $0xfbff,%edx
24 movl %edx,(%rsp)
25 fldcw (%rsp) /* load modified control word */
26
27 frndint /* round */
28
29 fldcw 4(%rsp) /* restore original control word */
30 fstps 8(%rsp)
31 movss 8(%rsp),%xmm0
32 addq $24,%rsp
33 ret
34 #else
35 flds 4(%esp)
36 subl $8,%esp
37
38 fstcw 4(%esp) /* store fpu control word */
39
40 /* We use here %edx although only the low 1 bits are defined.
41 But none of the operations should care and they are faster
42 than the 16 bit operations. */
43 movl $0x0800,%edx /* round towards +oo */
44 orl 4(%esp),%edx
45 andl $0xfbff,%edx
46 movl %edx,(%esp)
47 fldcw (%esp) /* load modified control word */
48
49 frndint /* round */
50
51 fldcw 4(%esp) /* restore original control word */
52
53 addl $8,%esp
54 ret
55 #endif