floatdidf.S revision 9ad441ffec97db647fee3725b3424284fb913e14
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// double __floatundidf(du_int a); 7 8#ifdef __i386__ 9 10#ifndef __ELF__ 11.const 12#endif 13.align 4 14twop52: .quad 0x4330000000000000 15twop32: .quad 0x41f0000000000000 16 17#define REL_ADDR(_a) (_a)-0b(%eax) 18 19.text 20.align 4 21DEFINE_COMPILERRT_FUNCTION(__floatdidf) 22 cvtsi2sd 8(%esp), %xmm1 23 movss 4(%esp), %xmm0 // low 32 bits of a 24 calll 0f 250: popl %eax 26 mulsd REL_ADDR(twop32), %xmm1 // a_hi as a double (without rounding) 27 movsd REL_ADDR(twop52), %xmm2 // 0x1.0p52 28 subsd %xmm2, %xmm1 // a_hi - 0x1p52 (no rounding occurs) 29 orpd %xmm2, %xmm0 // 0x1p52 + a_lo (no rounding occurs) 30 addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here) 31 movsd %xmm0, 4(%esp) 32 fldl 4(%esp) 33 ret 34 35#endif // __i386__ 36