public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/1] RISC-V: Use the new libm code if possible
@ 2023-02-22  1:59 Hau Hsu
  2023-02-22  3:18 ` Kito Cheng
  2023-02-22 11:29 ` Corinna Vinschen
  0 siblings, 2 replies; 3+ messages in thread
From: Hau Hsu @ 2023-02-22  1:59 UTC (permalink / raw)
  To: hau.hsu, kito.cheng, newlib

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 <hau.hsu@sifive.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] RISC-V: Use the new libm code if possible
  2023-02-22  1:59 [PATCH 1/1] RISC-V: Use the new libm code if possible Hau Hsu
@ 2023-02-22  3:18 ` Kito Cheng
  2023-02-22 11:29 ` Corinna Vinschen
  1 sibling, 0 replies; 3+ messages in thread
From: Kito Cheng @ 2023-02-22  3:18 UTC (permalink / raw)
  To: Hau Hsu; +Cc: newlib

LGTM, thank Hau :)


On Wed, Feb 22, 2023 at 9:59 AM Hau Hsu <hau.hsu@sifive.com> wrote:
>
> 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 <hau.hsu@sifive.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] RISC-V: Use the new libm code if possible
  2023-02-22  1:59 [PATCH 1/1] RISC-V: Use the new libm code if possible Hau Hsu
  2023-02-22  3:18 ` Kito Cheng
@ 2023-02-22 11:29 ` Corinna Vinschen
  1 sibling, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2023-02-22 11:29 UTC (permalink / raw)
  To: Hau Hsu; +Cc: kito.cheng, newlib

On Feb 22 09:59, Hau Hsu wrote:
> 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 <hau.hsu@sifive.com>
> ---
>  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

Pushed.


Thanks,
Corinna


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-22 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22  1:59 [PATCH 1/1] RISC-V: Use the new libm code if possible Hau Hsu
2023-02-22  3:18 ` Kito Cheng
2023-02-22 11:29 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).