xref: /openbsd-src/gnu/llvm/compiler-rt/lib/builtins/i386/floatdixf.S (revision 1f9cb04fc6f537ca6cf5a53c28927340cba218a2)
13cab2bb3Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
23cab2bb3Spatrick// See https://llvm.org/LICENSE.txt for license information.
33cab2bb3Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
43cab2bb3Spatrick
53cab2bb3Spatrick#include "../assembly.h"
63cab2bb3Spatrick
7*1f9cb04fSpatrick// long double __floatdixf(di_int a);
83cab2bb3Spatrick
93cab2bb3Spatrick#ifdef __i386__
103cab2bb3Spatrick
113cab2bb3Spatrick// This routine has some extra memory traffic, loading the 64-bit input via two
123cab2bb3Spatrick// 32-bit loads, then immediately storing it back to the stack via a single 64-bit
133cab2bb3Spatrick// store.  This is to avoid a write-small, read-large stall.
143cab2bb3Spatrick// However, if callers of this routine can be safely assumed to store the argument
153cab2bb3Spatrick// via a 64-bt store, this is unnecessary memory traffic, and should be avoided.
163cab2bb3Spatrick// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro.
173cab2bb3Spatrick
183cab2bb3Spatrick.text
193cab2bb3Spatrick.balign 4
203cab2bb3SpatrickDEFINE_COMPILERRT_FUNCTION(__floatdixf)
213cab2bb3Spatrick#ifndef TRUST_CALLERS_USE_64_BIT_STORES
223cab2bb3Spatrick	movd		4(%esp),	%xmm0
233cab2bb3Spatrick	movd		8(%esp),	%xmm1
243cab2bb3Spatrick	punpckldq	%xmm1,		%xmm0
253cab2bb3Spatrick	movq		%xmm0,		4(%esp)
263cab2bb3Spatrick#endif
273cab2bb3Spatrick	fildll		4(%esp)
283cab2bb3Spatrick	ret
293cab2bb3SpatrickEND_COMPILERRT_FUNCTION(__floatdixf)
303cab2bb3Spatrick
313cab2bb3Spatrick#endif // __i386__
323cab2bb3Spatrick
333cab2bb3SpatrickNO_EXEC_STACK_DIRECTIVE
343cab2bb3Spatrick
35