1156cd587Sjoerg//===-- floatundidf.S - Implement __floatundidf for i386 ------------------===// 2156cd587Sjoerg// 3156cd587Sjoerg// The LLVM Compiler Infrastructure 4156cd587Sjoerg// 5156cd587Sjoerg// This file is dual licensed under the MIT and the University of Illinois Open 6156cd587Sjoerg// Source Licenses. See LICENSE.TXT for details. 7156cd587Sjoerg// 8156cd587Sjoerg//===----------------------------------------------------------------------===// 9156cd587Sjoerg// 10156cd587Sjoerg// This file implements __floatundidf for the compiler_rt library. 11156cd587Sjoerg// 12156cd587Sjoerg//===----------------------------------------------------------------------===// 13156cd587Sjoerg 14156cd587Sjoerg#include "../assembly.h" 15156cd587Sjoerg 16156cd587Sjoerg// double __floatundidf(du_int a); 17156cd587Sjoerg 18156cd587Sjoerg#ifdef __i386__ 19156cd587Sjoerg 20*ef84fd3bSjoergCONST_SECTION 21190e92d8Sjoerg 22190e92d8Sjoerg .balign 16 23190e92d8Sjoergtwop52: 24190e92d8Sjoerg .quad 0x4330000000000000 25190e92d8Sjoerg 26190e92d8Sjoerg .balign 16 27156cd587Sjoergtwop84_plus_twop52: 28156cd587Sjoerg .quad 0x4530000000100000 29190e92d8Sjoerg 30190e92d8Sjoerg .balign 16 31190e92d8Sjoergtwop84: 32190e92d8Sjoerg .quad 0x4530000000000000 33156cd587Sjoerg 34156cd587Sjoerg#define REL_ADDR(_a) (_a)-0b(%eax) 35156cd587Sjoerg 36156cd587Sjoerg.text 3761f2f256Sjoerg.balign 4 38156cd587SjoergDEFINE_COMPILERRT_FUNCTION(__floatundidf) 39156cd587Sjoerg movss 8(%esp), %xmm1 // high 32 bits of a 40156cd587Sjoerg movss 4(%esp), %xmm0 // low 32 bits of a 41156cd587Sjoerg calll 0f 42156cd587Sjoerg0: popl %eax 43156cd587Sjoerg orpd REL_ADDR(twop84), %xmm1 // 0x1p84 + a_hi (no rounding occurs) 44156cd587Sjoerg subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs) 45156cd587Sjoerg orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs) 46156cd587Sjoerg addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here) 47156cd587Sjoerg movsd %xmm0, 4(%esp) 48156cd587Sjoerg fldl 4(%esp) 49156cd587Sjoerg ret 50156cd587SjoergEND_COMPILERRT_FUNCTION(__floatundidf) 51156cd587Sjoerg 52156cd587Sjoerg#endif // __i386__ 53