1222656Sed// This file is dual licensed under the MIT and the University of Illinois Open
2222656Sed// Source Licenses. See LICENSE.TXT for details.
3214152Sed
4214152Sed#include "../assembly.h"
5214152Sed
6214152Sed// float __floatdixf(di_int a);
7214152Sed
8214152Sed#ifdef __i386__
9214152Sed
10214152Sed// This routine has some extra memory traffic, loading the 64-bit input via two
11214152Sed// 32-bit loads, then immediately storing it back to the stack via a single 64-bit
12214152Sed// store.  This is to avoid a write-small, read-large stall.
13214152Sed// However, if callers of this routine can be safely assumed to store the argument
14214152Sed// via a 64-bt store, this is unnecessary memory traffic, and should be avoided.
15214152Sed// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro.
16214152Sed
17214152Sed.text
18214152Sed.align 4
19214152SedDEFINE_COMPILERRT_FUNCTION(__floatdixf)
20214152Sed#ifndef TRUST_CALLERS_USE_64_BIT_STORES
21214152Sed	movd		4(%esp),	%xmm0
22214152Sed	movd		8(%esp),	%xmm1
23214152Sed	punpckldq	%xmm1,		%xmm0
24214152Sed	movq		%xmm0,		4(%esp)
25214152Sed#endif
26214152Sed	fildll		4(%esp)
27214152Sed	ret
28214152Sed
29214152Sed#endif // __i386__
30