1 //===-- floatundidf.S - Implement __floatundidf for x86_64 ----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements __floatundidf for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
14 #include "../assembly.h"
16 // double __floatundidf(du_int a);
24 twop52: .quad 0x4330000000000000
26 .quad 0x4530000000100000
27 twop84: .quad 0x4530000000000000
29 #define REL_ADDR(_a) (_a)(%rip)
33 DEFINE_COMPILERRT_FUNCTION(__floatundidf)
34 movd %edi, %xmm0 // low 32 bits of a
35 shrq $32, %rdi // high 32 bits of a
36 orq REL_ADDR(twop84), %rdi // 0x1p84 + a_hi (no rounding occurs)
37 orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs)
39 subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs)
40 addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here)
42 END_COMPILERRT_FUNCTION(__floatundidf)