Home | History | Annotate | Download | only in x86_64
      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 #ifndef __ELF__
     11 .literal4
     12 #endif
     13 two: .single 2.0
     14 
     15 #define REL_ADDR(_a)	(_a)(%rip)
     16 
     17 .text
     18 .align 4
     19 DEFINE_COMPILERRT_FUNCTION(__floatundisf)
     20 	movq		$1,			%rsi
     21 	testq		%rdi,		%rdi
     22 	js			1f
     23 	cvtsi2ssq	%rdi,		%xmm0
     24 	ret
     25 
     26 1:	andq		%rdi,		%rsi
     27 	shrq		%rdi
     28 	orq			%rsi,		%rdi
     29 	cvtsi2ssq	%rdi,		%xmm0
     30 	mulss	REL_ADDR(two),	%xmm0
     31 	ret
     32 
     33 #endif // __x86_64__
     34