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