xref: /minix3/sys/external/bsd/compiler_rt/dist/lib/builtins/i386/floatdixf.S (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open
2*0a6a1f1dSLionel Sambuc// Source Licenses. See LICENSE.TXT for details.
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc#include "../assembly.h"
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc// float __floatdixf(di_int a);
7*0a6a1f1dSLionel Sambuc
8*0a6a1f1dSLionel Sambuc#ifdef __i386__
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuc// This routine has some extra memory traffic, loading the 64-bit input via two
11*0a6a1f1dSLionel Sambuc// 32-bit loads, then immediately storing it back to the stack via a single 64-bit
12*0a6a1f1dSLionel Sambuc// store.  This is to avoid a write-small, read-large stall.
13*0a6a1f1dSLionel Sambuc// However, if callers of this routine can be safely assumed to store the argument
14*0a6a1f1dSLionel Sambuc// via a 64-bt store, this is unnecessary memory traffic, and should be avoided.
15*0a6a1f1dSLionel Sambuc// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro.
16*0a6a1f1dSLionel Sambuc
17*0a6a1f1dSLionel Sambuc.text
18*0a6a1f1dSLionel Sambuc.balign 4
19*0a6a1f1dSLionel SambucDEFINE_COMPILERRT_FUNCTION(__floatdixf)
20*0a6a1f1dSLionel Sambuc#ifndef TRUST_CALLERS_USE_64_BIT_STORES
21*0a6a1f1dSLionel Sambuc	movd		4(%esp),	%xmm0
22*0a6a1f1dSLionel Sambuc	movd		8(%esp),	%xmm1
23*0a6a1f1dSLionel Sambuc	punpckldq	%xmm1,		%xmm0
24*0a6a1f1dSLionel Sambuc	movq		%xmm0,		4(%esp)
25*0a6a1f1dSLionel Sambuc#endif
26*0a6a1f1dSLionel Sambuc	fildll		4(%esp)
27*0a6a1f1dSLionel Sambuc	ret
28*0a6a1f1dSLionel SambucEND_COMPILERRT_FUNCTION(__floatdixf)
29*0a6a1f1dSLionel Sambuc
30*0a6a1f1dSLionel Sambuc#endif // __i386__
31