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 __floatdisf(di_int a); 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambuc// This routine has some extra memory traffic, loading the 64-bit input via two 9*0a6a1f1dSLionel Sambuc// 32-bit loads, then immediately storing it back to the stack via a single 64-bit 10*0a6a1f1dSLionel Sambuc// store. This is to avoid a write-small, read-large stall. 11*0a6a1f1dSLionel Sambuc// However, if callers of this routine can be safely assumed to store the argument 12*0a6a1f1dSLionel Sambuc// via a 64-bt store, this is unnecessary memory traffic, and should be avoided. 13*0a6a1f1dSLionel Sambuc// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro. 14*0a6a1f1dSLionel Sambuc 15*0a6a1f1dSLionel Sambuc#ifdef __i386__ 16*0a6a1f1dSLionel Sambuc 17*0a6a1f1dSLionel Sambuc.text 18*0a6a1f1dSLionel Sambuc.balign 4 19*0a6a1f1dSLionel SambucDEFINE_COMPILERRT_FUNCTION(__floatdisf) 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 fstps 4(%esp) 28*0a6a1f1dSLionel Sambuc flds 4(%esp) 29*0a6a1f1dSLionel Sambuc ret 30*0a6a1f1dSLionel SambucEND_COMPILERRT_FUNCTION(__floatdisf) 31*0a6a1f1dSLionel Sambuc 32*0a6a1f1dSLionel Sambuc#endif // __i386__ 33