26b2f5c4096c6a17555cba4ba4ac8bfa537da573
[dragonfly.git] / lib / libm / arch / i386 / s_copysignf.S
1 /*
2  * Written by J.T. Conklin <jtc@NetBSD.org>.
3  * Public domain.
4  *
5  * $NetBSD: s_copysignf.S,v 1.7 2011/06/21 21:52:49 joerg Exp
6  */
7
8 #include <machine/asm.h>
9
10 /*
11  * XXXfvdl split this file.
12  */
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         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 END(copysignf)