brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1010 B · d588e77 Raw
44 lines · plain
1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.2// See https://llvm.org/LICENSE.txt for license information.3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception4 5#include "../assembly.h"6 7// double __floatdidf(du_int a);8 9#ifdef __i386__10 11CONST_SECTION12 13	.balign 1614twop52:15	.quad 0x433000000000000016 17	.balign 1618twop32:19	.quad 0x41f000000000000020 21#define REL_ADDR(_a)	(_a)-0b(%eax)22 23.text24.balign 425DEFINE_COMPILERRT_FUNCTION(__floatdidf)26	cvtsi2sd	8(%esp),			%xmm127	movss		4(%esp),			%xmm0 // low 32 bits of a28	calll		0f290:	popl		%eax30	mulsd		REL_ADDR(twop32),	%xmm1 // a_hi as a double (without rounding)31	movsd		REL_ADDR(twop52),	%xmm2 // 0x1.0p5232	subsd		%xmm2,				%xmm1 // a_hi - 0x1p52 (no rounding occurs)33	orpd		%xmm2,				%xmm0 // 0x1p52 + a_lo (no rounding occurs)34	addsd		%xmm1,				%xmm0 // a_hi + a_lo   (round happens here)35	movsd		%xmm0,			   4(%esp)36	fldl	   4(%esp)37	ret38END_COMPILERRT_FUNCTION(__floatdidf)39 40#endif // __i386__41 42NO_EXEC_STACK_DIRECTIVE43 44