xref: /netbsd-src/sys/external/bsd/compiler_rt/dist/lib/builtins/i386/floatdixf.S (revision 61f2f2562dcc3e4eb50e7ec5dab0dfa1f093861a)
1156cd587Sjoerg// This file is dual licensed under the MIT and the University of Illinois Open
2156cd587Sjoerg// Source Licenses. See LICENSE.TXT for details.
3156cd587Sjoerg
4156cd587Sjoerg#include "../assembly.h"
5156cd587Sjoerg
6156cd587Sjoerg// float __floatdixf(di_int a);
7156cd587Sjoerg
8156cd587Sjoerg#ifdef __i386__
9156cd587Sjoerg
10156cd587Sjoerg// This routine has some extra memory traffic, loading the 64-bit input via two
11156cd587Sjoerg// 32-bit loads, then immediately storing it back to the stack via a single 64-bit
12156cd587Sjoerg// store.  This is to avoid a write-small, read-large stall.
13156cd587Sjoerg// However, if callers of this routine can be safely assumed to store the argument
14156cd587Sjoerg// via a 64-bt store, this is unnecessary memory traffic, and should be avoided.
15156cd587Sjoerg// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro.
16156cd587Sjoerg
17156cd587Sjoerg.text
18*61f2f256Sjoerg.balign 4
19156cd587SjoergDEFINE_COMPILERRT_FUNCTION(__floatdixf)
20156cd587Sjoerg#ifndef TRUST_CALLERS_USE_64_BIT_STORES
21156cd587Sjoerg	movd		4(%esp),	%xmm0
22156cd587Sjoerg	movd		8(%esp),	%xmm1
23156cd587Sjoerg	punpckldq	%xmm1,		%xmm0
24156cd587Sjoerg	movq		%xmm0,		4(%esp)
25156cd587Sjoerg#endif
26156cd587Sjoerg	fildll		4(%esp)
27156cd587Sjoerg	ret
28156cd587SjoergEND_COMPILERRT_FUNCTION(__floatdixf)
29156cd587Sjoerg
30156cd587Sjoerg#endif // __i386__
31