1222656Sed// This file is dual licensed under the MIT and the University of Illinois Open 2222656Sed// Source Licenses. See LICENSE.TXT for details. 3214152Sed 4214152Sed#include "../assembly.h" 5214152Sed 6214152Sed// long double __floatundixf(du_int a);16 7214152Sed 8214152Sed#ifdef __i386__ 9214152Sed 10214152Sed#ifndef __ELF__ 11214152Sed.const 12214152Sed#endif 13214152Sed.align 4 14214152Sedtwop52: .quad 0x4330000000000000 15214152Sedtwop84_plus_twop52_neg: 16214152Sed .quad 0xc530000000100000 17214152Sedtwop84: .quad 0x4530000000000000 18214152Sed 19214152Sed#define REL_ADDR(_a) (_a)-0b(%eax) 20214152Sed 21214152Sed.text 22214152Sed.align 4 23214152SedDEFINE_COMPILERRT_FUNCTION(__floatundixf) 24214152Sed calll 0f 25214152Sed0: popl %eax 26214152Sed movss 8(%esp), %xmm0 // hi 32 bits of input 27214152Sed movss 4(%esp), %xmm1 // lo 32 bits of input 28214152Sed orpd REL_ADDR(twop84), %xmm0 // 2^84 + hi (as a double) 29214152Sed orpd REL_ADDR(twop52), %xmm1 // 2^52 + lo (as a double) 30214152Sed addsd REL_ADDR(twop84_plus_twop52_neg), %xmm0 // hi - 2^52 (no rounding occurs) 31214152Sed movsd %xmm1, 4(%esp) 32214152Sed fldl 4(%esp) 33214152Sed movsd %xmm0, 4(%esp) 34214152Sed faddl 4(%esp) 35214152Sed ret 36214152Sed 37214152Sed#endif // __i386__ 38