Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / lib / builtins / i386 / floatundixf.S
blob778c3dc0cc766eb755ccfc1c1ff0e5d98f7de163
1 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 // See https://llvm.org/LICENSE.txt for license information.
3 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 #include "../assembly.h"
7 // xf_float __floatundixf(du_int a);16
9 #ifdef __i386__
11 CONST_SECTION
13         .balign 16
14 twop52:
15         .quad 0x4330000000000000
17         .balign 16
18 twop84_plus_twop52_neg:
19         .quad 0xc530000000100000
21         .balign 16
22 twop84:
23         .quad 0x4530000000000000
25 #define REL_ADDR(_a)    (_a)-0b(%eax)
27 .text
28 .balign 4
29 DEFINE_COMPILERRT_FUNCTION(__floatundixf)
30         calll   0f
31 0:      popl    %eax
32         movss   8(%esp),                        %xmm0   // hi 32 bits of input
33         movss   4(%esp),                        %xmm1   // lo 32 bits of input
34         orpd    REL_ADDR(twop84),       %xmm0   // 2^84 + hi (as a double)
35         orpd    REL_ADDR(twop52),       %xmm1   // 2^52 + lo (as a double)
36         addsd   REL_ADDR(twop84_plus_twop52_neg),       %xmm0   // hi - 2^52 (no rounding occurs)
37         movsd   %xmm1,                          4(%esp)
38         fldl    4(%esp)
39         movsd   %xmm0,                          4(%esp)
40         faddl   4(%esp)
41         ret
42 END_COMPILERRT_FUNCTION(__floatundixf)
44 #endif // __i386__
46 NO_EXEC_STACK_DIRECTIVE