blob: b8586625334f7baf045552f9c54ecde6d87c828c [file] [log] [blame]
Daniel Dunbarb3a69012009-06-26 16:47:03 +00001// This file is distributed under the University of Illinois Open Source
2// License. See LICENSE.TXT for details.
3
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
10.const
11.align 4
12twop52: .quad 0x4330000000000000
13twop84_plus_twop52_neg:
14 .quad 0xc530000000100000
15twop84: .quad 0x4530000000000000
16
17#define REL_ADDR(_a) (_a)-0b(%eax)
18
19.text
20.align 4
21.globl ___floatundixf
22___floatundixf:
23 calll 0f
240: popl %eax
25 movss 8(%esp), %xmm0 // hi 32 bits of input
26 movss 4(%esp), %xmm1 // lo 32 bits of input
27 orpd REL_ADDR(twop84), %xmm0 // 2^84 + hi (as a double)
28 orpd REL_ADDR(twop52), %xmm1 // 2^52 + lo (as a double)
29 addsd REL_ADDR(twop84_plus_twop52_neg), %xmm0 // hi - 2^52 (no rounding occurs)
30 movsd %xmm1, 4(%esp)
31 fldl 4(%esp)
32 movsd %xmm0, 4(%esp)
33 faddl 4(%esp)
34 ret
35
36#endif // __i386__