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

View File

@ -20,17 +20,29 @@
#include <machine/asm.h> #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) ENTRY(__copysignf)
movss %xmm0,-4(%rsp) movlps MO(mask),%xmm3
mov -4(%rsp,1),%edx andps %xmm3,%xmm0
movss %xmm1,-4(%rsp) andnps %xmm1,%xmm3
mov -4(%rsp),%eax orps %xmm3,%xmm0
and $0x7fffffff,%edx
and $0x80000000,%eax
or %eax,%edx
mov %edx,-4(%rsp)
movss -4(%rsp),%xmm1
movaps %xmm1,%xmm0
retq retq
END (__copysignf) END (__copysignf)