Remove building with NOCRYPTO option
[minix.git] / sys / external / bsd / compiler_rt / dist / lib / builtins / x86_64 / floatundidf.S
blobd54b974f669e04473ee912025bbad11ad133f812
1 //===-- floatundidf.S - Implement __floatundidf for x86_64 ----------------===//
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.
12 //===----------------------------------------------------------------------===//
14 #include "../assembly.h"
16 // double __floatundidf(du_int a);
18 #ifdef __x86_64__
20 #if defined(__APPLE__)
21         .const
22 #elif defined(__ELF__)
23         .section .rodata
24 #else
25         .section .rdata,"rd"
26 #endif
28         .balign 16
29 twop52:
30         .quad 0x4330000000000000
32         .balign 16
33 twop84_plus_twop52:
34         .quad 0x4530000000100000
36         .balign 16
37 twop84:
38         .quad 0x4530000000000000
40 #define REL_ADDR(_a)    (_a)(%rip)
42 .text
43 .balign 4
44 DEFINE_COMPILERRT_FUNCTION(__floatundidf)
45         movd    %edi,                                                   %xmm0 // low 32 bits of a
46         shrq    $32,                                                    %rdi  // high 32 bits of a
47         orq             REL_ADDR(twop84),                               %rdi  // 0x1p84 + a_hi (no rounding occurs)
48         orpd    REL_ADDR(twop52),                               %xmm0 // 0x1p52 + a_lo (no rounding occurs)
49         movd    %rdi,                                                   %xmm1
50         subsd   REL_ADDR(twop84_plus_twop52),   %xmm1 // a_hi - 0x1p52 (no rounding occurs)
51         addsd   %xmm1,                                                  %xmm0 // a_hi + a_lo   (round happens here)
52         ret
53 END_COMPILERRT_FUNCTION(__floatundidf)
55 #endif // __x86_64__