s_copysignf.S revision 1.4 1 /*
2 * Written by J.T. Conklin <jtc (at) netbsd.org>.
3 * Public domain.
4 */
5
6 #include <machine/asm.h>
7
8 /*
9 * XXXfvdl split this file.
10 */
11
12 RCSID("$NetBSD: s_copysignf.S,v 1.4 2001/06/19 00:26:30 fvdl Exp $")
13
14 #ifdef __x86_64__
15 .Lneg:
16 .long 0x7fffffff
17 .Lpos:
18 .long 0x80000000
19 #endif
20
21 ENTRY(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 #if 0
32 /*
33 * XXXfvdl gas doesn't grok this.
34 * but it's legal according to the p4 manual.
35 */
36 movss .Lpos(%rip),%xmm2
37 movss .Lneg(%rip),%xmm3
38 pandq %xmm2,%xmm1
39 pandq %xmm3,%xmm0
40 porq %xmm1,%xmm0
41 #else
42 movss %xmm0,-4(%rsp)
43 movss %xmm1,-8(%rsp)
44 movl -8(%rsp),%edx
45 andl $0x80000000,%edx
46 movl -4(%rsp),%eax
47 andl $0x7fffffff,%eax
48 orl %edx,%eax
49 movl %eax,-4(%rsp)
50 movss -4(%rsp),%xmm0
51 #endif
52 #endif
53 ret
54