blob: 6e6710bd4ac67aaeb1388adb22b82cc5076285fd [file] [log] [blame]
Howard Hinnant9ad441f2010-11-16 22:13:33 +00001// This file is dual licensed under the MIT and the University of Illinois Open
2// Source Licenses. See LICENSE.TXT for details.
Daniel Dunbarb3a69012009-06-26 16:47:03 +00003
Daniel Dunbar19336a22009-10-27 17:49:50 +00004#include "../assembly.h"
5
Daniel Dunbarb3a69012009-06-26 16:47:03 +00006// long double __floatundixf(du_int a);16
7
8#ifdef __i386__
9
Edward O'Callaghaneed13002009-11-04 23:52:51 +000010#ifndef __ELF__
Daniel Dunbarb3a69012009-06-26 16:47:03 +000011.const
Edward O'Callaghaneed13002009-11-04 23:52:51 +000012#endif
Daniel Dunbarb3a69012009-06-26 16:47:03 +000013.align 4
14twop52: .quad 0x4330000000000000
15twop84_plus_twop52_neg:
16 .quad 0xc530000000100000
17twop84: .quad 0x4530000000000000
18
19#define REL_ADDR(_a) (_a)-0b(%eax)
20
21.text
22.align 4
Daniel Dunbarb4b1e8c2009-10-27 17:50:21 +000023DEFINE_COMPILERRT_FUNCTION(__floatundixf)
Daniel Dunbarb3a69012009-06-26 16:47:03 +000024 calll 0f
250: popl %eax
26 movss 8(%esp), %xmm0 // hi 32 bits of input
27 movss 4(%esp), %xmm1 // lo 32 bits of input
28 orpd REL_ADDR(twop84), %xmm0 // 2^84 + hi (as a double)
29 orpd REL_ADDR(twop52), %xmm1 // 2^52 + lo (as a double)
30 addsd REL_ADDR(twop84_plus_twop52_neg), %xmm0 // hi - 2^52 (no rounding occurs)
31 movsd %xmm1, 4(%esp)
32 fldl 4(%esp)
33 movsd %xmm0, 4(%esp)
34 faddl 4(%esp)
35 ret
36
Edward O'Callaghaneed13002009-11-04 23:52:51 +000037#endif // __i386__