summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/i386/copysign.S
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-01-07 23:35:57 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-01-10 08:39:19 +0100
commit48d8d11d697e7433e607b2519a022bd0ee415c12 (patch)
tree9ebc11daff193639a085eac26d7aae35fd38c8c7 /libc/sysdeps/linux/i386/copysign.S
parentad1fca9b927f469e2fecdfbfa4e3ad130afa66ab (diff)
Add implementation for copysignl for i386
Patch from OpenWrt. Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/i386/copysign.S')
-rw-r--r--libc/sysdeps/linux/i386/copysign.S55
1 files changed, 55 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/i386/copysign.S b/libc/sysdeps/linux/i386/copysign.S
new file mode 100644
index 000000000..6499ce05d
--- /dev/null
+++ b/libc/sysdeps/linux/i386/copysign.S
@@ -0,0 +1,55 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#define _ERRNO_H 1
+#include <features.h>
+#include <bits/errno.h>
+
+.text
+.global copysign
+.type copysign,%function
+copysign:
+ movl 16(%esp),%edx
+ movl 8(%esp),%eax
+ andl $0x80000000,%edx
+ andl $0x7fffffff,%eax
+ orl %edx,%eax
+ movl %eax,8(%esp)
+ fldl 4(%esp)
+ ret
+.size copysign,.-copysign
+
+libc_hidden_def(copysign)
+
+.global copysignf
+.type copysignf,%function
+copysignf:
+ movl 8(%esp),%edx
+ movl 4(%esp),%eax
+ andl $0x80000000,%edx
+ andl $0x7fffffff,%eax
+ orl %edx,%eax
+ movl %eax,4(%esp)
+ flds 4(%esp)
+ ret
+.size copysignf,.-copysignf
+
+libc_hidden_def(copysignf)
+
+.global copysignl
+.type copysignl,%function
+copysignl:
+ movl 24(%esp),%edx
+ movl 12(%esp),%eax
+ andl $0x8000,%edx
+ andl $0x7fff,%eax
+ orl %edx,%eax
+ movl %eax,12(%esp)
+ fldt 4(%esp)
+ ret
+.size copysignl,.-copysignl
+
+libc_hidden_def(copysignl)
+