xref: /netbsd-src/sys/external/bsd/compiler_rt/dist/lib/builtins/i386/floatundixf.S (revision ef84fd3bd8895f4e6be1e38baf19e6dc3255bc64)
1156cd587Sjoerg// This file is dual licensed under the MIT and the University of Illinois Open
2156cd587Sjoerg// Source Licenses. See LICENSE.TXT for details.
3156cd587Sjoerg
4156cd587Sjoerg#include "../assembly.h"
5156cd587Sjoerg
6156cd587Sjoerg// long double __floatundixf(du_int a);16
7156cd587Sjoerg
8156cd587Sjoerg#ifdef __i386__
9156cd587Sjoerg
10*ef84fd3bSjoergCONST_SECTION
11190e92d8Sjoerg
12190e92d8Sjoerg	.balign 16
13190e92d8Sjoergtwop52:
14190e92d8Sjoerg	.quad 0x4330000000000000
15190e92d8Sjoerg
16190e92d8Sjoerg	.balign 16
17156cd587Sjoergtwop84_plus_twop52_neg:
18156cd587Sjoerg	.quad 0xc530000000100000
19190e92d8Sjoerg
20190e92d8Sjoerg	.balign 16
21190e92d8Sjoergtwop84:
22190e92d8Sjoerg	.quad 0x4530000000000000
23156cd587Sjoerg
24156cd587Sjoerg#define REL_ADDR(_a)	(_a)-0b(%eax)
25156cd587Sjoerg
26156cd587Sjoerg.text
2761f2f256Sjoerg.balign 4
28156cd587SjoergDEFINE_COMPILERRT_FUNCTION(__floatundixf)
29156cd587Sjoerg	calll	0f
30156cd587Sjoerg0:	popl	%eax
31156cd587Sjoerg	movss	8(%esp),			%xmm0	// hi 32 bits of input
32156cd587Sjoerg	movss	4(%esp),			%xmm1	// lo 32 bits of input
33156cd587Sjoerg	orpd	REL_ADDR(twop84),	%xmm0	// 2^84 + hi (as a double)
34156cd587Sjoerg	orpd	REL_ADDR(twop52),	%xmm1	// 2^52 + lo (as a double)
35156cd587Sjoerg	addsd	REL_ADDR(twop84_plus_twop52_neg),	%xmm0	// hi - 2^52 (no rounding occurs)
36156cd587Sjoerg	movsd	%xmm1,				4(%esp)
37156cd587Sjoerg	fldl	4(%esp)
38156cd587Sjoerg	movsd	%xmm0,				4(%esp)
39156cd587Sjoerg	faddl	4(%esp)
40156cd587Sjoerg	ret
41156cd587SjoergEND_COMPILERRT_FUNCTION(__floatundixf)
42156cd587Sjoerg
43156cd587Sjoerg#endif // __i386__
44