1*3cab2bb3Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 2*3cab2bb3Spatrick// See https://llvm.org/LICENSE.txt for license information. 3*3cab2bb3Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 4*3cab2bb3Spatrick 5*3cab2bb3Spatrick#include "../assembly.h" 6*3cab2bb3Spatrick 7*3cab2bb3Spatrick// float __floatdisf(di_int a); 8*3cab2bb3Spatrick 9*3cab2bb3Spatrick// This routine has some extra memory traffic, loading the 64-bit input via two 10*3cab2bb3Spatrick// 32-bit loads, then immediately storing it back to the stack via a single 64-bit 11*3cab2bb3Spatrick// store. This is to avoid a write-small, read-large stall. 12*3cab2bb3Spatrick// However, if callers of this routine can be safely assumed to store the argument 13*3cab2bb3Spatrick// via a 64-bt store, this is unnecessary memory traffic, and should be avoided. 14*3cab2bb3Spatrick// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro. 15*3cab2bb3Spatrick 16*3cab2bb3Spatrick#ifdef __i386__ 17*3cab2bb3Spatrick 18*3cab2bb3Spatrick.text 19*3cab2bb3Spatrick.balign 4 20*3cab2bb3SpatrickDEFINE_COMPILERRT_FUNCTION(__floatdisf) 21*3cab2bb3Spatrick#ifndef TRUST_CALLERS_USE_64_BIT_STORES 22*3cab2bb3Spatrick movd 4(%esp), %xmm0 23*3cab2bb3Spatrick movd 8(%esp), %xmm1 24*3cab2bb3Spatrick punpckldq %xmm1, %xmm0 25*3cab2bb3Spatrick movq %xmm0, 4(%esp) 26*3cab2bb3Spatrick#endif 27*3cab2bb3Spatrick fildll 4(%esp) 28*3cab2bb3Spatrick fstps 4(%esp) 29*3cab2bb3Spatrick flds 4(%esp) 30*3cab2bb3Spatrick ret 31*3cab2bb3SpatrickEND_COMPILERRT_FUNCTION(__floatdisf) 32*3cab2bb3Spatrick 33*3cab2bb3Spatrick#endif // __i386__ 34*3cab2bb3Spatrick 35*3cab2bb3SpatrickNO_EXEC_STACK_DIRECTIVE 36*3cab2bb3Spatrick 37