10b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 20b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 30b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 40b57cec5SDimitry Andric 50b57cec5SDimitry Andric#include "../assembly.h" 60b57cec5SDimitry Andric 7*5f757f3fSDimitry Andric// xf_float __floatdixf(di_int a); 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric#ifdef __i386__ 100b57cec5SDimitry Andric 110b57cec5SDimitry Andric// This routine has some extra memory traffic, loading the 64-bit input via two 120b57cec5SDimitry Andric// 32-bit loads, then immediately storing it back to the stack via a single 64-bit 130b57cec5SDimitry Andric// store. This is to avoid a write-small, read-large stall. 140b57cec5SDimitry Andric// However, if callers of this routine can be safely assumed to store the argument 150b57cec5SDimitry Andric// via a 64-bt store, this is unnecessary memory traffic, and should be avoided. 160b57cec5SDimitry Andric// It can be turned off by defining the TRUST_CALLERS_USE_64_BIT_STORES macro. 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric.text 190b57cec5SDimitry Andric.balign 4 200b57cec5SDimitry AndricDEFINE_COMPILERRT_FUNCTION(__floatdixf) 210b57cec5SDimitry Andric#ifndef TRUST_CALLERS_USE_64_BIT_STORES 220b57cec5SDimitry Andric movd 4(%esp), %xmm0 230b57cec5SDimitry Andric movd 8(%esp), %xmm1 240b57cec5SDimitry Andric punpckldq %xmm1, %xmm0 250b57cec5SDimitry Andric movq %xmm0, 4(%esp) 260b57cec5SDimitry Andric#endif 270b57cec5SDimitry Andric fildll 4(%esp) 280b57cec5SDimitry Andric ret 290b57cec5SDimitry AndricEND_COMPILERRT_FUNCTION(__floatdixf) 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric#endif // __i386__ 320b57cec5SDimitry Andric 330b57cec5SDimitry AndricNO_EXEC_STACK_DIRECTIVE 340b57cec5SDimitry Andric 35