xref: /minix3/lib/libm/arch/i387/s_scalbn.S (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
12fe8fb19SBen Gras/*
22fe8fb19SBen Gras * Written by J.T. Conklin <jtc@NetBSD.org>.
32fe8fb19SBen Gras * Public domain.
42fe8fb19SBen Gras */
52fe8fb19SBen Gras
62fe8fb19SBen Gras#include <machine/asm.h>
72fe8fb19SBen Gras
8*84d9c625SLionel SambucRCSID("$NetBSD: s_scalbn.S,v 1.14 2013/05/20 19:40:09 joerg Exp $")
92fe8fb19SBen Gras
102fe8fb19SBen Gras#ifdef WEAK_ALIAS
112fe8fb19SBen GrasWEAK_ALIAS(scalbn,_scalbn)
12*84d9c625SLionel SambucWEAK_ALIAS(scalbln,_scalbln)
13*84d9c625SLionel SambucWEAK_ALIAS(ldexp,_scalbn)
142fe8fb19SBen Gras#endif
152fe8fb19SBen Gras#ifdef __x86_64__
16*84d9c625SLionel SambucENTRY(_scalbn)
172fe8fb19SBen Gras	movl %edi,-12(%rsp)
182fe8fb19SBen Gras	fildl -12(%rsp)
192fe8fb19SBen Gras	movsd %xmm0,-8(%rsp)
202fe8fb19SBen Gras	fldl -8(%rsp)
212fe8fb19SBen Gras	fscale
222fe8fb19SBen Gras	fstpl -8(%rsp)
232fe8fb19SBen Gras	movsd -8(%rsp),%xmm0
242fe8fb19SBen Gras	fstp %st(0)
25*84d9c625SLionel Sambuc	ret
26*84d9c625SLionel Sambuc#elif defined(STRONG_ALIAS)
27*84d9c625SLionel SambucSTRONG_ALIAS(_scalbn, scalbln)
28*84d9c625SLionel Sambuc#endif
29*84d9c625SLionel Sambuc
30*84d9c625SLionel SambucENTRY(_scalbln)
31*84d9c625SLionel Sambuc#ifdef __x86_64__
32*84d9c625SLionel Sambuc	movq %rdi,-16(%rsp)
33*84d9c625SLionel Sambuc	fildq -16(%rsp)
34*84d9c625SLionel Sambuc	movsd %xmm0,-8(%rsp)
35*84d9c625SLionel Sambuc	fldl -8(%rsp)
36*84d9c625SLionel Sambuc	fscale
37*84d9c625SLionel Sambuc	fstpl -8(%rsp)
38*84d9c625SLionel Sambuc	movsd -8(%rsp),%xmm0
39*84d9c625SLionel Sambuc	fstp %st(0)
402fe8fb19SBen Gras#else
412fe8fb19SBen Gras	fildl 12(%esp)
422fe8fb19SBen Gras	fldl 4(%esp)
432fe8fb19SBen Gras	fscale
442fe8fb19SBen Gras	fstp %st(1)		/* clean up stack */
452fe8fb19SBen Gras#endif
462fe8fb19SBen Gras	ret
47