]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/builtins/i386/floatundixf.S
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304222, and update
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / builtins / i386 / floatundixf.S
1 // This file is dual licensed under the MIT and the University of Illinois Open
2 // Source Licenses. See LICENSE.TXT for details.
3
4 #include "../assembly.h"
5
6 // long double __floatundixf(du_int a);16
7
8 #ifdef __i386__
9
10 CONST_SECTION
11
12         .balign 16
13 twop52:
14         .quad 0x4330000000000000
15
16         .balign 16
17 twop84_plus_twop52_neg:
18         .quad 0xc530000000100000
19
20         .balign 16
21 twop84:
22         .quad 0x4530000000000000
23
24 #define REL_ADDR(_a)    (_a)-0b(%eax)
25
26 .text
27 .balign 4
28 DEFINE_COMPILERRT_FUNCTION(__floatundixf)
29         calll   0f
30 0:      popl    %eax
31         movss   8(%esp),                        %xmm0   // hi 32 bits of input
32         movss   4(%esp),                        %xmm1   // lo 32 bits of input
33         orpd    REL_ADDR(twop84),       %xmm0   // 2^84 + hi (as a double)
34         orpd    REL_ADDR(twop52),       %xmm1   // 2^52 + lo (as a double)
35         addsd   REL_ADDR(twop84_plus_twop52_neg),       %xmm0   // hi - 2^52 (no rounding occurs)
36         movsd   %xmm1,                          4(%esp)
37         fldl    4(%esp)
38         movsd   %xmm0,                          4(%esp)
39         faddl   4(%esp)
40         ret
41 END_COMPILERRT_FUNCTION(__floatundixf)
42
43 #endif // __i386__
44
45 NO_EXEC_STACK_DIRECTIVE
46