19ad441ffec97db647fee3725b3424284fb913e14Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
29ad441ffec97db647fee3725b3424284fb913e14Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
3b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
419336a2d6b9b375ac106125950f4ff09742d1aecDaniel Dunbar#include "../assembly.h"
519336a2d6b9b375ac106125950f4ff09742d1aecDaniel Dunbar
6b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar// float __floatdixf(di_int a);
7b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
8b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar#ifdef __i386__
9b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
10b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar// This routine has some extra memory traffic, loading the 64-bit input via two
11b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar// 32-bit loads, then immediately storing it back to the stack via a single 64-bit
12b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar// store.  This is to avoid a write-small, read-large stall.
13b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar// However, if callers of this routine can be safely assumed to store the argument
14b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar// via a 64-bt store, this is unnecessary memory traffic, and should be avoided.
15b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro.
16b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
17b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar.text
18b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar.align 4
19b4b1e8c5085cf83a50242057775a33ae4323d402Daniel DunbarDEFINE_COMPILERRT_FUNCTION(__floatdixf)
20b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar#ifndef TRUST_CALLERS_USE_64_BIT_STORES
21b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	movd		4(%esp),	%xmm0
22b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	movd		8(%esp),	%xmm1
23b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	punpckldq	%xmm1,		%xmm0
24b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	movq		%xmm0,		4(%esp)
25b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar#endif
26b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	fildll		4(%esp)
27b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar	ret
28b3a6901e66f55b35aa9e01bcb24134e6a65ea004Daniel Dunbar
29eed1300f303841d026f0769e489d7c3df6e0e87fEdward O'Callaghan#endif // __i386__
30