aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2023-05-05 13:39:17 -0500
committerJoel Sherrill <joel@rtems.org>2023-05-16 09:05:36 -0500
commit048ebea9819b67daefc1ab3cda2add6ebe6f27a0 (patch)
treee208ce66bedbfd432df77cf73dbfcaaaf5e528e5 /newlib/libc
parentc630a6a837fd581d741fb94602aed6a4a5ed9bf4 (diff)
downloadnewlib-048ebea9819b67daefc1ab3cda2add6ebe6f27a0.zip
newlib-048ebea9819b67daefc1ab3cda2add6ebe6f27a0.tar.gz
newlib-048ebea9819b67daefc1ab3cda2add6ebe6f27a0.tar.bz2
newlib: Add non LDBL_EQ_DBL math support for aarch64, i386, and x86_64
Rename s_nearbyint.c, s_fdim.c and s_scalbln.c to remove conflicts Remove functions that are not needed from above files Modify include paths Add includes missing in cygwin build Add missing types Create Makefiles Create header files to resolve dependencies between directories Modify some instances of unsigned long to uint64_t for 32 bit platforms Add HAVE_FPMATH_H
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/acinclude.m43
-rw-r--r--newlib/libc/include/math.h3
-rw-r--r--newlib/libc/machine/aarch64/machine/_fpmath.h20
3 files changed, 18 insertions, 8 deletions
diff --git a/newlib/libc/acinclude.m4 b/newlib/libc/acinclude.m4
index 7cba7db..4266266 100644
--- a/newlib/libc/acinclude.m4
+++ b/newlib/libc/acinclude.m4
@@ -62,4 +62,7 @@ m4_foreach_w([MACHINE], [
z8k
], [AM_CONDITIONAL([HAVE_LIBC_MACHINE_]m4_toupper(MACHINE), test "${machine_dir}" = MACHINE)])
+AM_CONDITIONAL(HAVE_FPMATH_H, test -r "${srcdir}/libc/machine/${machine_dir}/machine/_fpmath.h")
+
+
AM_CONDITIONAL(MACH_ADD_SETJMP, test "x$mach_add_setjmp" = "xtrue")
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index 54e30ef..87f5133 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -445,7 +445,8 @@ extern float hypotf (float, float);
simply call the double functions. On Cygwin the long double functions
are implemented independently from newlib to be able to use optimized
assembler functions despite using the Microsoft x86_64 ABI. */
-#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
+#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__) || \
+ defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
/* Reentrant ANSI C functions. */
#ifndef __math_68881
extern long double atanl (long double);
diff --git a/newlib/libc/machine/aarch64/machine/_fpmath.h b/newlib/libc/machine/aarch64/machine/_fpmath.h
index 71d0a71..fa62ae8 100644
--- a/newlib/libc/machine/aarch64/machine/_fpmath.h
+++ b/newlib/libc/machine/aarch64/machine/_fpmath.h
@@ -27,19 +27,25 @@
* $FreeBSD$
*/
+/*
+ * Change unsigned int/long used by FreeBSD to fixed width types because
+ * ilp32 has a different size for unsigned long. --joel (20 Aug 2022)
+ */
+#include <stdint.h>
+
union IEEEl2bits {
long double e;
struct {
- unsigned long manl :64;
- unsigned long manh :48;
- unsigned int exp :15;
- unsigned int sign :1;
+ uint64_t manl :64;
+ uint64_t manh :48;
+ uint32_t exp :15;
+ uint32_t sign :1;
} bits;
/* TODO andrew: Check the packing here */
struct {
- unsigned long manl :64;
- unsigned long manh :48;
- unsigned int expsign :16;
+ uint64_t manl :64;
+ uint64_t manh :48;
+ uint32_t expsign :16;
} xbits;
};