2010-11-17 06:13:33 +08:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2009-06-27 00:47:03 +08:00
|
|
|
|
2009-10-28 01:49:50 +08:00
|
|
|
#include "../assembly.h"
|
|
|
|
|
2009-06-27 00:47:03 +08:00
|
|
|
// long double __floatundixf(du_int a);16
|
|
|
|
|
|
|
|
#ifdef __i386__
|
|
|
|
|
2009-11-05 07:52:51 +08:00
|
|
|
#ifndef __ELF__
|
2009-06-27 00:47:03 +08:00
|
|
|
.const
|
2009-11-05 07:52:51 +08:00
|
|
|
#endif
|
2009-06-27 00:47:03 +08:00
|
|
|
.align 4
|
|
|
|
twop52: .quad 0x4330000000000000
|
|
|
|
twop84_plus_twop52_neg:
|
|
|
|
.quad 0xc530000000100000
|
|
|
|
twop84: .quad 0x4530000000000000
|
|
|
|
|
|
|
|
#define REL_ADDR(_a) (_a)-0b(%eax)
|
|
|
|
|
|
|
|
.text
|
|
|
|
.align 4
|
2009-10-28 01:50:21 +08:00
|
|
|
DEFINE_COMPILERRT_FUNCTION(__floatundixf)
|
2009-06-27 00:47:03 +08:00
|
|
|
calll 0f
|
|
|
|
0: popl %eax
|
|
|
|
movss 8(%esp), %xmm0 // hi 32 bits of input
|
|
|
|
movss 4(%esp), %xmm1 // lo 32 bits of input
|
|
|
|
orpd REL_ADDR(twop84), %xmm0 // 2^84 + hi (as a double)
|
|
|
|
orpd REL_ADDR(twop52), %xmm1 // 2^52 + lo (as a double)
|
|
|
|
addsd REL_ADDR(twop84_plus_twop52_neg), %xmm0 // hi - 2^52 (no rounding occurs)
|
|
|
|
movsd %xmm1, 4(%esp)
|
|
|
|
fldl 4(%esp)
|
|
|
|
movsd %xmm0, 4(%esp)
|
|
|
|
faddl 4(%esp)
|
|
|
|
ret
|
|
|
|
|
2009-11-05 07:52:51 +08:00
|
|
|
#endif // __i386__
|