From 48d8d11d697e7433e607b2519a022bd0ee415c12 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 7 Jan 2016 23:35:57 +0100 Subject: Add implementation for copysignl for i386 Patch from OpenWrt. Reported-by: Leonid Lisovskiy --- libc/sysdeps/linux/i386/Makefile.arch | 3 +- libc/sysdeps/linux/i386/copysign.S | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/i386/copysign.S diff --git a/libc/sysdeps/linux/i386/Makefile.arch b/libc/sysdeps/linux/i386/Makefile.arch index 581e10a5e..1c72d23fd 100644 --- a/libc/sysdeps/linux/i386/Makefile.arch +++ b/libc/sysdeps/linux/i386/Makefile.arch @@ -9,7 +9,8 @@ CSRC-y := brk.c __syscall_error.c sigaction.c SSRC-y := \ __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ - sync_file_range.S syscall.S mmap.S + sync_file_range.S syscall.S mmap.S \ + copysign.S SSRC-$(UCLIBC_HAS_LFS) += mmap64.S SSRC-$(if $(findstring yy,$(UCLIBC_HAS_ADVANCED_REALTIME)$(UCLIBC_HAS_LFS)),y) += posix_fadvise64.S 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 . + * Public domain. + */ + +#define _ERRNO_H 1 +#include +#include + +.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) + -- cgit v1.2.3