coverity appeasement
[minix.git] / lib / libm / arch / i387 / s_copysign.S
blob54f7b15c717dcc8508d9c69284fc309ed87aff2f
1 /*
2  * Written by J.T. Conklin <jtc@NetBSD.org>.
3  * Public domain.
4  */
6 /*
7  * XXXfvdl might as well split this file.
8  */
10 #include <machine/asm.h>
12 RCSID("$NetBSD: s_copysign.S,v 1.6 2003/07/26 19:25:01 salo Exp $")
14 #ifdef __x86_64__
15 .Lpos:
16         .quad   0x8000000000000000
17 .Lneg:
18         .quad   0x7fffffffffffffff
19 #endif
22 ENTRY(copysign)
23 #ifdef __i386__
24         movl    16(%esp),%edx
25         andl    $0x80000000,%edx
26         movl    8(%esp),%eax
27         andl    $0x7fffffff,%eax
28         orl     %edx,%eax
29         movl    %eax,8(%esp)
30         fldl    4(%esp)
31 #else
32 #if 0
33         /*
34          * XXXfvdl gas doesn't grok this yet.
35          */
36         movq    .Lpos(%rip),%xmm2
37         movq    .Lneg(%rip),%xmm3
38         pand    %xmm2,%xmm1
39         pand    %xmm3,%xmm0
40         por     %xmm1,%xmm0
41 #else
42         movsd   %xmm0,-8(%rsp)
43         movsd   %xmm1,-16(%rsp)
44         movl    -12(%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         movsd   -8(%rsp),%xmm0
51 #endif
52 #endif
53         ret