Use optimized version.

This commit is contained in:
Andreas Jaeger 2002-07-23 19:36:20 +00:00
parent 67ee6db0fd
commit 83a5fcc0b4
2 changed files with 30 additions and 21 deletions

View File

@ -27,14 +27,10 @@
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(signmask,@object)
signmask:
ASM_TYPE_DIRECTIVE(mask,@object)
mask:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
.byte 0, 0, 0, 0, 0, 0, 0, 0
othermask:
.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
.byte 0, 0, 0, 0, 0, 0, 0, 0
ASM_SIZE_DIRECTIVE(othermask)
ASM_SIZE_DIRECTIVE(mask)
#ifdef PIC
#define MO(op) op##(%rip)
@ -43,10 +39,11 @@ othermask:
#endif
ENTRY(__copysign)
andpd MO(othermask),%xmm0
andpd MO(signmask),%xmm1
orpd %xmm1,%xmm0
ret
movlpd MO(mask),%xmm3
andps %xmm3,%xmm0
andnpd %xmm1,%xmm3
orpd %xmm3,%xmm0
retq
END (__copysign)
weak_alias (__copysign, copysign)

View File

@ -20,17 +20,29 @@
#include <machine/asm.h>
#ifdef __ELF__
.section .rodata
#else
.text
#endif
.align ALIGNARG(4)
ASM_TYPE_DIRECTIVE(mask,@object)
mask:
.byte 0xff, 0xff, 0xff, 0x7f
ASM_SIZE_DIRECTIVE(mask)
#ifdef PIC
#define MO(op) op##(%rip)
#else
#define MO(op) op
#endif
ENTRY(__copysignf)
movss %xmm0,-4(%rsp)
mov -4(%rsp,1),%edx
movss %xmm1,-4(%rsp)
mov -4(%rsp),%eax
and $0x7fffffff,%edx
and $0x80000000,%eax
or %eax,%edx
mov %edx,-4(%rsp)
movss -4(%rsp),%xmm1
movaps %xmm1,%xmm0
movlps MO(mask),%xmm3
andps %xmm3,%xmm0
andnps %xmm1,%xmm3
orps %xmm3,%xmm0
retq
END (__copysignf)