Use optimized version.
authorAndreas Jaeger <aj@suse.de>
Tue, 23 Jul 2002 19:36:20 +0000 (19:36 +0000)
committerAndreas Jaeger <aj@suse.de>
Tue, 23 Jul 2002 19:36:20 +0000 (19:36 +0000)
sysdeps/x86_64/fpu/s_copysign.S
sysdeps/x86_64/fpu/s_copysignf.S

index f1ebcf8..acb4c3a 100644 (file)
 #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)
index 4691958..415e39b 100644 (file)
 
 #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)