aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2002-07-23 19:36:20 +0000
committerAndreas Jaeger <aj@suse.de>2002-07-23 19:36:20 +0000
commit83a5fcc0b4ea84bf6d8f786d7c7e4949cf22e43f (patch)
treeab3d21ddf6423e5a820b4197d07637ae3998b9ff
parent67ee6db0fdc36dc8760e44893db9675ea6899dbe (diff)
downloadglibc-83a5fcc0b4ea84bf6d8f786d7c7e4949cf22e43f.zip
glibc-83a5fcc0b4ea84bf6d8f786d7c7e4949cf22e43f.tar.gz
glibc-83a5fcc0b4ea84bf6d8f786d7c7e4949cf22e43f.tar.bz2
Use optimized version.
-rw-r--r--sysdeps/x86_64/fpu/s_copysign.S19
-rw-r--r--sysdeps/x86_64/fpu/s_copysignf.S32
2 files changed, 30 insertions, 21 deletions
diff --git a/sysdeps/x86_64/fpu/s_copysign.S b/sysdeps/x86_64/fpu/s_copysign.S
index f1ebcf8..acb4c3a 100644
--- a/sysdeps/x86_64/fpu/s_copysign.S
+++ b/sysdeps/x86_64/fpu/s_copysign.S
@@ -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)
diff --git a/sysdeps/x86_64/fpu/s_copysignf.S b/sysdeps/x86_64/fpu/s_copysignf.S
index 4691958..415e39b 100644
--- a/sysdeps/x86_64/fpu/s_copysignf.S
+++ b/sysdeps/x86_64/fpu/s_copysignf.S
@@ -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)