floatundidf.S revision 940515afdb99568d5d9cc9f6b9a80335a8e35646
1//===-- floatundidf.s - Implement __floatundidf for i386 ------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements __floatundidf for the compiler_rt library.
11//
12//===----------------------------------------------------------------------===//
13
14// double __floatundidf(du_int a);
15
16#ifdef __i386__
17
18.const
19.align 4
20twop52: .quad 0x4330000000000000
21twop84_plus_twop52:
22		.quad 0x4530000000100000
23twop84: .quad 0x4530000000000000
24
25#define REL_ADDR(_a)	(_a)-0b(%eax)
26
27.text
28.align 4
29.globl ___floatundidf
30___floatundidf:
31	movss	8(%esp),						%xmm1 // high 32 bits of a
32	movss	4(%esp),						%xmm0 // low 32 bits of a
33	calll	0f
340:	popl	%eax
35	orpd	REL_ADDR(twop84),				%xmm1 // 0x1p84 + a_hi (no rounding occurs)
36	subsd	REL_ADDR(twop84_plus_twop52),	%xmm1 // a_hi - 0x1p52 (no rounding occurs)
37	orpd	REL_ADDR(twop52),				%xmm0 // 0x1p52 + a_lo (no rounding occurs)
38	addsd	%xmm1,							%xmm0 // a_hi + a_lo   (round happens here)
39	movsd	%xmm0,						   4(%esp)
40	fldl   4(%esp)
41	ret
42
43#endif // __i386__
44