Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin. Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l}, isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib. Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin. Cygwin: * math: New subdir with math functions. * Makefile.in (VPATH): Add math subdir. (MATH_OFILES): List of object files collected from building files in math subdir. (DLL_OFILES): Add $(MATH_OFILES). ${CURDIR}/libm.a: Add $(MATH_OFILES) to build. * common.din: Add new functions from math subdir. * i686.din: Align to new math subdir. Remove functions now commonly available. * x86_64.din: Ditto. * math.h: math.h wrapper to define mingw structs used in some files in math subdir. * include/cygwin/version.h: Bump API minor version. newlib: * libc/include/complex.h: Add prototypes for complex long double functions. Only define for Cygwin. * libc/include/math.h: Additionally enable prototypes of long double functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl, exp10l and pow10l. Explain why we don't add them to newlib. * libc/include/tgmath.h: Enable long double handling on Cygwin. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
65
winsup/cygwin/math/ilogbl.S
Normal file
65
winsup/cygwin/math/ilogbl.S
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the mingw-w64 runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <_mingw_mac.h>
|
||||
|
||||
.file "ilogbl.S"
|
||||
.text
|
||||
#ifdef __x86_64__
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl __MINGW_USYMBOL(ilogbl)
|
||||
.def __MINGW_USYMBOL(ilogbl); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(ilogbl):
|
||||
#ifdef __x86_64__
|
||||
fldt (%rcx)
|
||||
fxam /* Is NaN or +-Inf? */
|
||||
fstsw %ax
|
||||
movb $0x45, %dh
|
||||
andb %ah, %dh
|
||||
cmpb $0x05, %dh
|
||||
je 1f /* Is +-Inf, jump. */
|
||||
|
||||
fxtract
|
||||
pushq %rax
|
||||
fstp %st
|
||||
|
||||
fistpl (%rsp)
|
||||
fwait
|
||||
popq %rax
|
||||
|
||||
ret
|
||||
|
||||
1: fstp %st
|
||||
movl $0x7fffffff, %eax
|
||||
ret
|
||||
#else
|
||||
fldt 4(%esp)
|
||||
/* I added the following ugly construct because ilogb(+-Inf) is
|
||||
required to return INT_MAX in ISO C99.
|
||||
-- jakub@redhat.com. */
|
||||
fxam /* Is NaN or +-Inf? */
|
||||
fstsw %ax
|
||||
movb $0x45, %dh
|
||||
andb %ah, %dh
|
||||
cmpb $0x05, %dh
|
||||
je 1f /* Is +-Inf, jump. */
|
||||
|
||||
fxtract
|
||||
pushl %eax
|
||||
fstp %st
|
||||
|
||||
fistpl (%esp)
|
||||
fwait
|
||||
popl %eax
|
||||
|
||||
ret
|
||||
|
||||
1: fstp %st
|
||||
movl $0x7fffffff, %eax
|
||||
ret
|
||||
#endif
|
Reference in New Issue
Block a user