xref: /minix3/lib/libm/arch/i387/s_scalbnf.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_scalbnf.S,v 1.14 2013/05/20 20:27:43 mlelstv Exp $")
92fe8fb19SBen Gras
102fe8fb19SBen Gras#ifdef WEAK_ALIAS
112fe8fb19SBen GrasWEAK_ALIAS(scalbnf,_scalbnf)
12*84d9c625SLionel SambucWEAK_ALIAS(scalblnf,_scalblnf)
13*84d9c625SLionel SambucWEAK_ALIAS(ldexpf,_scalbnf)
142fe8fb19SBen Gras#endif
152fe8fb19SBen Gras
162fe8fb19SBen Gras#ifdef __x86_64__
17*84d9c625SLionel SambucENTRY(_scalbnf)
182fe8fb19SBen Gras	movl %edi,-8(%rsp)
192fe8fb19SBen Gras	fildl -8(%rsp)
202fe8fb19SBen Gras	movss %xmm0,-4(%rsp)
212fe8fb19SBen Gras	flds -4(%rsp)
222fe8fb19SBen Gras	fscale
232fe8fb19SBen Gras	fstps -4(%rsp)
242fe8fb19SBen Gras	movss -4(%rsp),%xmm0
252fe8fb19SBen Gras	fstp %st(0)
26*84d9c625SLionel Sambuc	ret
27*84d9c625SLionel Sambuc#elif defined(STRONG_ALIAS)
28*84d9c625SLionel SambucSTRONG_ALIAS(_scalbnf,_scalblnf)
29*84d9c625SLionel Sambuc#endif
30*84d9c625SLionel Sambuc
31*84d9c625SLionel SambucENTRY(_scalblnf)
32*84d9c625SLionel Sambuc#ifdef __x86_64__
33*84d9c625SLionel Sambuc	movq %rdi,-16(%rsp)
34*84d9c625SLionel Sambuc	fildq -16(%rsp)
35*84d9c625SLionel Sambuc	movss %xmm0,-4(%rsp)
36*84d9c625SLionel Sambuc	flds -4(%rsp)
37*84d9c625SLionel Sambuc	fscale
38*84d9c625SLionel Sambuc	fstps -4(%rsp)
39*84d9c625SLionel Sambuc	movss -4(%rsp),%xmm0
40*84d9c625SLionel Sambuc	fstp %st(0)
412fe8fb19SBen Gras#else
422fe8fb19SBen Gras	fildl 8(%esp)
432fe8fb19SBen Gras	flds 4(%esp)
442fe8fb19SBen Gras	fscale
452fe8fb19SBen Gras	fstp %st(1)		/* clean up stack */
462fe8fb19SBen Gras#endif
472fe8fb19SBen Gras	ret
48