| Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame^] | 1 | // This file is distributed under the University of Illinois Open Source |
| 2 | // License. See LICENSE.TXT for details. |
| 3 | |
| 4 | // long double __floatundixf(du_int a);16 |
| 5 | |
| 6 | #ifdef __i386__ |
| 7 | |
| 8 | .const |
| 9 | .align 4 |
| 10 | twop52: .quad 0x4330000000000000 |
| 11 | twop84_plus_twop52_neg: |
| 12 | .quad 0xc530000000100000 |
| 13 | twop84: .quad 0x4530000000000000 |
| 14 | |
| 15 | #define REL_ADDR(_a) (_a)-0b(%eax) |
| 16 | |
| 17 | .text |
| 18 | .align 4 |
| 19 | .globl ___floatundixf |
| 20 | ___floatundixf: |
| 21 | calll 0f |
| 22 | 0: popl %eax |
| 23 | movss 8(%esp), %xmm0 // hi 32 bits of input |
| 24 | movss 4(%esp), %xmm1 // lo 32 bits of input |
| 25 | orpd REL_ADDR(twop84), %xmm0 // 2^84 + hi (as a double) |
| 26 | orpd REL_ADDR(twop52), %xmm1 // 2^52 + lo (as a double) |
| 27 | addsd REL_ADDR(twop84_plus_twop52_neg), %xmm0 // hi - 2^52 (no rounding occurs) |
| 28 | movsd %xmm1, 4(%esp) |
| 29 | fldl 4(%esp) |
| 30 | movsd %xmm0, 4(%esp) |
| 31 | faddl 4(%esp) |
| 32 | ret |
| 33 | |
| 34 | #endif // __i386__ |