blob: e38e4556e2b5df4b36ac061538f010e2d18508b6 [file] [log] [blame]
Daniel Dunbar51c80cc2009-10-27 17:49:19 +00001//===-- floatundidf.S - Implement __floatundidf for i386 ------------------===//
Daniel Dunbarb3a69012009-06-26 16:47:03 +00002//
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
Daniel Dunbar19336a22009-10-27 17:49:50 +000014#include "../assembly.h"
15
Daniel Dunbarb3a69012009-06-26 16:47:03 +000016// double __floatundidf(du_int a);
17
18#ifdef __i386__
19
20.const
21.align 4
22twop52: .quad 0x4330000000000000
23twop84_plus_twop52:
24 .quad 0x4530000000100000
25twop84: .quad 0x4530000000000000
26
27#define REL_ADDR(_a) (_a)-0b(%eax)
28
29.text
30.align 4
31.globl ___floatundidf
32___floatundidf:
33 movss 8(%esp), %xmm1 // high 32 bits of a
34 movss 4(%esp), %xmm0 // low 32 bits of a
35 calll 0f
360: popl %eax
37 orpd REL_ADDR(twop84), %xmm1 // 0x1p84 + a_hi (no rounding occurs)
38 subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs)
39 orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs)
40 addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here)
41 movsd %xmm0, 4(%esp)
42 fldl 4(%esp)
43 ret
44
45#endif // __i386__