[CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
[blocksruntime.git] / lib / builtins / x86_64 / floatundisf.S
blob7dd5c329b52cbe0aec1c9f912cd1d15d6979a77f
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 // float __floatundisf(du_int a);
8 #ifdef __x86_64__
10 #ifndef __ELF__
11 .literal4
12 #endif
13 two: .single 2.0
15 #define REL_ADDR(_a)    (_a)(%rip)
17 .text
18 .align 4
19 DEFINE_COMPILERRT_FUNCTION(__floatundisf)
20         movq            $1,                     %rsi
21         testq           %rdi,           %rdi
22         js                      1f
23         cvtsi2ssq       %rdi,           %xmm0
24         ret
25         
26 1:      andq            %rdi,           %rsi
27         shrq            %rdi
28         orq                     %rsi,           %rdi
29         cvtsi2ssq       %rdi,           %xmm0
30         mulss   REL_ADDR(two),  %xmm0
31         ret
32 END_COMPILERRT_FUNCTION(__floatundisf)
34 #endif // __x86_64__