[PATCH 1/1] RISC-V: Use the new libm code if possible

Hau Hsu <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Set  __OBSOLETE_MATH_DEFAULT to 0 if 'd' extension is supported (i.e.
__riscv_flen == 64).

Base on the comment for  __OBSOLETE_MATH_DEFAULT:

> ... it assumes that the toolchain has ISO C99 support (hexfloat
> literals, standard fenv semantics), the target has IEEE-754 conforming
> binary32 float and binary64 double (not mixed endian) representation,
> standard SNaN representation, double and single precision arithmetics
> has similar latency and it has no legacy SVID matherr support, only
> POSIX errno and fenv exception based error handling.

Signed-off-by: Hau Hsu <[email protected]>
---
 newlib/libc/include/machine/ieeefp.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h
index 9bb8af02f..a29557a6d 100644
--- a/newlib/libc/include/machine/ieeefp.h
+++ b/newlib/libc/include/machine/ieeefp.h
@@ -221,6 +221,11 @@
 #ifdef __riscv_flen
 # define _SUPPORTS_ERREXCEPT
 #endif
+#if __riscv_flen == 64
+# define __OBSOLETE_MATH_DEFAULT 0
+#else
+# define __OBSOLETE_MATH_DEFAULT 1
+#endif
 #endif
 
 #ifdef __i960__
-- 
2.39.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.