xref: /minix/lib/libm/arch/i387/s_copysignf.S (revision 84d9c625)
1/*
2 * Written by J.T. Conklin <jtc@NetBSD.org>.
3 * Public domain.
4 */
5
6#include <machine/asm.h>
7
8/*
9 * XXXfvdl split this file.
10 */
11
12RCSID("$NetBSD: s_copysignf.S,v 1.7 2011/06/21 21:52:49 joerg Exp $")
13
14#ifdef __x86_64__
15.Lneg:
16	.long 0x7fffffff
17.Lpos:
18	.long 0x80000000
19#endif
20
21ENTRY(copysignf)
22#ifdef __i386__
23	movl	8(%esp),%edx
24	andl	$0x80000000,%edx
25	movl	4(%esp),%eax
26	andl	$0x7fffffff,%eax
27	orl	%edx,%eax
28	movl	%eax,4(%esp)
29	flds	4(%esp)
30#else
31	movss	.Lpos(%rip),%xmm2
32	movss	.Lneg(%rip),%xmm3
33	pand	%xmm2,%xmm1
34	pand	%xmm3,%xmm0
35	por	%xmm1,%xmm0
36#endif
37	ret
38