]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
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 | #ifndef __ELF__ | |
11 | .const | |
12 | #endif | |
13 | .align 4 | |
14 | twop52: .quad 0x4330000000000000 | |
15 | twop84_plus_twop52_neg: | |
16 | .quad 0xc530000000100000 | |
17 | twop84: .quad 0x4530000000000000 | |
18 | ||
19 | #define REL_ADDR(_a) (_a)-0b(%eax) | |
20 | ||
21 | .text | |
22 | .align 4 | |
23 | DEFINE_COMPILERRT_FUNCTION(__floatundixf) | |
24 | calll 0f | |
25 | 0: 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 | ||
37 | #endif // __i386__ |