Merge branch 'vendor/LIBARCHIVE'
[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.5 2003/07/26 19:25:01 salo Exp $
6  * $DragonFly: src/lib/libm/arch/i386/s_copysignf.S,v 1.1 2005/07/26 21:15:19 joerg Exp $
7  */
8
9 #include <machine/asm.h>
10
11 /*
12  * XXXfvdl split this file.
13  */
14
15 #ifdef __x86_64__
16 .Lneg:
17         .long 0x7fffffff
18 .Lpos:
19         .long 0x80000000
20 #endif
21
22 ENTRY(copysignf)
23 #ifdef __i386__
24         movl    8(%esp),%edx
25         andl    $0x80000000,%edx
26         movl    4(%esp),%eax
27         andl    $0x7fffffff,%eax
28         orl     %edx,%eax
29         movl    %eax,4(%esp)
30         flds    4(%esp)
31 #else
32 #if 0
33         /*
34          * XXXfvdl gas doesn't grok this.
35          * but it's legal according to the p4 manual.
36          */
37         movss    .Lpos(%rip),%xmm2
38         movss    .Lneg(%rip),%xmm3
39         pandq   %xmm2,%xmm1
40         pandq   %xmm3,%xmm0
41         porq    %xmm1,%xmm0
42 #else
43         movss   %xmm0,-4(%rsp)
44         movss   %xmm1,-8(%rsp)
45         movl    -8(%rsp),%edx
46         andl    $0x80000000,%edx
47         movl    -4(%rsp),%eax
48         andl    $0x7fffffff,%eax
49         orl     %edx,%eax
50         movl    %eax,-4(%rsp)
51         movss   -4(%rsp),%xmm0
52 #endif
53 #endif
54         ret