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