1 // This file is dual licensed under the MIT and the University of Illinois Open
2 // Source Licenses. See LICENSE.TXT for details.
4 #include "../assembly.h"
6 // long double __floatundixf(du_int a);
14 twop64: .quad 0x43f0000000000000
16 #define REL_ADDR(_a) (_a)(%rip)
20 DEFINE_COMPILERRT_FUNCTION(__floatundixf)
26 1: faddl REL_ADDR(twop64)
32 /* Branch-free implementation is ever so slightly slower, but more beautiful.
33 It is likely superior for inlining, so I kept it around for future reference.
39 twop52: .quad 0x4330000000000000
40 twop84_plus_twop52_neg:
41 .quad 0xc530000000100000
42 twop84: .quad 0x4530000000000000
44 #define REL_ADDR(_a) (_a)(%rip)
48 DEFINE_COMPILERRT_FUNCTION(__floatundixf)
49 movl %edi, %esi // low 32 bits of input
50 shrq $32, %rdi // hi 32 bits of input
51 orq REL_ADDR(twop84), %rdi // 2^84 + hi (as a double)
52 orq REL_ADDR(twop52), %rsi // 2^52 + lo (as a double)
55 fldl REL_ADDR(twop84_plus_twop52_neg)
56 faddl -8(%rsp) // hi - 2^52 (as double extended, no rounding occurs)
57 faddl -16(%rsp) // hi + lo (as double extended)