Home | History | Annotate | Line # | Download | only in i386
      1      1.1  joerg //===-- floatundidf.S - Implement __floatundidf for i386 ------------------===//
      2      1.1  joerg //
      3      1.1  joerg //                     The LLVM Compiler Infrastructure
      4      1.1  joerg //
      5      1.1  joerg // This file is dual licensed under the MIT and the University of Illinois Open
      6      1.1  joerg // Source Licenses. See LICENSE.TXT for details.
      7      1.1  joerg //
      8      1.1  joerg //===----------------------------------------------------------------------===//
      9      1.1  joerg //
     10      1.1  joerg // This file implements __floatundidf for the compiler_rt library.
     11      1.1  joerg //
     12      1.1  joerg //===----------------------------------------------------------------------===//
     13      1.1  joerg 
     14      1.1  joerg #include "../assembly.h"
     15      1.1  joerg 
     16      1.1  joerg // double __floatundidf(du_int a);
     17      1.1  joerg 
     18      1.1  joerg #ifdef __i386__
     19      1.1  joerg 
     20  1.1.1.4  joerg CONST_SECTION
     21  1.1.1.3  joerg 
     22  1.1.1.3  joerg 	.balign 16
     23  1.1.1.3  joerg twop52:
     24  1.1.1.3  joerg 	.quad 0x4330000000000000
     25  1.1.1.3  joerg 
     26  1.1.1.3  joerg 	.balign 16
     27      1.1  joerg twop84_plus_twop52:
     28  1.1.1.3  joerg 	.quad 0x4530000000100000
     29  1.1.1.3  joerg 
     30  1.1.1.3  joerg 	.balign 16
     31  1.1.1.3  joerg twop84:
     32  1.1.1.3  joerg 	.quad 0x4530000000000000
     33      1.1  joerg 
     34      1.1  joerg #define REL_ADDR(_a)	(_a)-0b(%eax)
     35      1.1  joerg 
     36      1.1  joerg .text
     37  1.1.1.2  joerg .balign 4
     38      1.1  joerg DEFINE_COMPILERRT_FUNCTION(__floatundidf)
     39      1.1  joerg 	movss	8(%esp),						%xmm1 // high 32 bits of a
     40      1.1  joerg 	movss	4(%esp),						%xmm0 // low 32 bits of a
     41      1.1  joerg 	calll	0f
     42      1.1  joerg 0:	popl	%eax
     43      1.1  joerg 	orpd	REL_ADDR(twop84),				%xmm1 // 0x1p84 + a_hi (no rounding occurs)
     44      1.1  joerg 	subsd	REL_ADDR(twop84_plus_twop52),	%xmm1 // a_hi - 0x1p52 (no rounding occurs)
     45      1.1  joerg 	orpd	REL_ADDR(twop52),				%xmm0 // 0x1p52 + a_lo (no rounding occurs)
     46      1.1  joerg 	addsd	%xmm1,							%xmm0 // a_hi + a_lo   (round happens here)
     47      1.1  joerg 	movsd	%xmm0,						   4(%esp)
     48      1.1  joerg 	fldl   4(%esp)
     49      1.1  joerg 	ret
     50      1.1  joerg END_COMPILERRT_FUNCTION(__floatundidf)
     51      1.1  joerg 
     52      1.1  joerg #endif // __i386__
     53