1//===-- floatundidf.S - Implement __floatundidf for i386 ------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file implements __floatundidf for the compiler_rt library. 11// 12//===----------------------------------------------------------------------===// 13 14#include "../assembly.h" 15 16// double __floatundidf(du_int a); 17 18#ifdef __i386__ 19 20CONST_SECTION 21 22 .balign 16 23twop52: 24 .quad 0x4330000000000000 25 26 .balign 16 27twop84_plus_twop52: 28 .quad 0x4530000000100000 29 30 .balign 16 31twop84: 32 .quad 0x4530000000000000 33 34#define REL_ADDR(_a) (_a)-0b(%eax) 35 36.text 37.balign 4 38DEFINE_COMPILERRT_FUNCTION(__floatundidf) 39 movss 8(%esp), %xmm1 // high 32 bits of a 40 movss 4(%esp), %xmm0 // low 32 bits of a 41 calll 0f 420: popl %eax 43 orpd REL_ADDR(twop84), %xmm1 // 0x1p84 + a_hi (no rounding occurs) 44 subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs) 45 orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs) 46 addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here) 47 movsd %xmm0, 4(%esp) 48 fldl 4(%esp) 49 ret 50END_COMPILERRT_FUNCTION(__floatundidf) 51 52#endif // __i386__ 53 54NO_EXEC_STACK_DIRECTIVE 55 56