1 1.1 joerg // This file is dual licensed under the MIT and the University of Illinois Open 2 1.1 joerg // Source Licenses. See LICENSE.TXT for details. 3 1.1 joerg 4 1.1 joerg #include "../assembly.h" 5 1.1 joerg 6 1.1 joerg // double __floatundidf(du_int a); 7 1.1 joerg 8 1.1 joerg #ifdef __i386__ 9 1.1 joerg 10 1.1.1.4 joerg CONST_SECTION 11 1.1.1.3 joerg 12 1.1.1.3 joerg .balign 16 13 1.1.1.3 joerg twop52: 14 1.1.1.3 joerg .quad 0x4330000000000000 15 1.1.1.3 joerg 16 1.1.1.3 joerg .balign 16 17 1.1.1.3 joerg twop32: 18 1.1.1.3 joerg .quad 0x41f0000000000000 19 1.1 joerg 20 1.1 joerg #define REL_ADDR(_a) (_a)-0b(%eax) 21 1.1 joerg 22 1.1 joerg .text 23 1.1.1.2 joerg .balign 4 24 1.1 joerg DEFINE_COMPILERRT_FUNCTION(__floatdidf) 25 1.1 joerg cvtsi2sd 8(%esp), %xmm1 26 1.1 joerg movss 4(%esp), %xmm0 // low 32 bits of a 27 1.1 joerg calll 0f 28 1.1 joerg 0: popl %eax 29 1.1 joerg mulsd REL_ADDR(twop32), %xmm1 // a_hi as a double (without rounding) 30 1.1 joerg movsd REL_ADDR(twop52), %xmm2 // 0x1.0p52 31 1.1 joerg subsd %xmm2, %xmm1 // a_hi - 0x1p52 (no rounding occurs) 32 1.1 joerg orpd %xmm2, %xmm0 // 0x1p52 + a_lo (no rounding occurs) 33 1.1 joerg addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here) 34 1.1 joerg movsd %xmm0, 4(%esp) 35 1.1 joerg fldl 4(%esp) 36 1.1 joerg ret 37 1.1 joerg END_COMPILERRT_FUNCTION(__floatdidf) 38 1.1 joerg 39 1.1 joerg #endif // __i386__ 40