55 lines · plain
1//===-- floatundidf.S - Implement __floatundidf for i386 ------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file implements __floatundidf for the compiler_rt library.10//11//===----------------------------------------------------------------------===//12 13#include "../assembly.h"14 15// double __floatundidf(du_int a);16 17#ifdef __i386__18 19CONST_SECTION20 21 .balign 1622twop52:23 .quad 0x433000000000000024 25 .balign 1626twop84_plus_twop52:27 .quad 0x453000000010000028 29 .balign 1630twop84:31 .quad 0x453000000000000032 33#define REL_ADDR(_a) (_a)-0b(%eax)34 35.text36.balign 437DEFINE_COMPILERRT_FUNCTION(__floatundidf)38 movss 8(%esp), %xmm1 // high 32 bits of a39 movss 4(%esp), %xmm0 // low 32 bits of a40 calll 0f410: popl %eax42 orpd REL_ADDR(twop84), %xmm1 // 0x1p84 + a_hi (no rounding occurs)43 subsd REL_ADDR(twop84_plus_twop52), %xmm1 // a_hi - 0x1p52 (no rounding occurs)44 orpd REL_ADDR(twop52), %xmm0 // 0x1p52 + a_lo (no rounding occurs)45 addsd %xmm1, %xmm0 // a_hi + a_lo (round happens here)46 movsd %xmm0, 4(%esp)47 fldl 4(%esp)48 ret49END_COMPILERRT_FUNCTION(__floatundidf)50 51#endif // __i386__52 53NO_EXEC_STACK_DIRECTIVE54 55