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