floatundisf.S revision 1.1.1.3
1// This file is dual licensed under the MIT and the University of Illinois Open
2// Source Licenses. See LICENSE.TXT for details.
3
4#include "../assembly.h"
5
6// float __floatundisf(du_int a);
7
8#ifdef __x86_64__
9
10#if defined(__APPLE__)
11	.literal4
12#elif defined(__ELF__)
13	.section .rodata
14#else
15	.section .rdata,"rd"
16#endif
17
18	.balign 16
19two:
20	.single 2.0
21
22#define REL_ADDR(_a)	(_a)(%rip)
23
24.text
25.balign 4
26DEFINE_COMPILERRT_FUNCTION(__floatundisf)
27	movq		$1,			%rsi
28	testq		%rdi,		%rdi
29	js			1f
30	cvtsi2ssq	%rdi,		%xmm0
31	ret
32
331:	andq		%rdi,		%rsi
34	shrq		%rdi
35	orq			%rsi,		%rdi
36	cvtsi2ssq	%rdi,		%xmm0
37	mulss	REL_ADDR(two),	%xmm0
38	ret
39END_COMPILERRT_FUNCTION(__floatundisf)
40
41#endif // __x86_64__
42