Re: [PATCH] libm: riscv: Reduce sqrt and sqrtf function for code size

Kito Cheng <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CA+yXCZBe9vnWHO1gWd_2ysbq-WDFY5c2zNJmegD1irDYrXjA_A@mail.gmail.com>
LGTM, thanks :)

On Wed, May 14, 2025 at 4:57 PM Songhe Zhu <[email protected]> wrote:
>
> From: zhusonghe <[email protected]>
>
> The merged below patch modifies the __ieee754_sqrtf and __ieee754_sqrt functions to use a shared implementation, replacing the original fsqrt.d[s] instruction usage.
>
> patch:https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;h=d572c4482b473d7725be0f9380d4f5d8342e4390
>
> Signed-off-by: Songhe Zhu <[email protected]>
> ---
>  newlib/libm/machine/riscv/e_sqrt.c  | 1 +
>  newlib/libm/machine/riscv/ef_sqrt.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/newlib/libm/machine/riscv/e_sqrt.c b/newlib/libm/machine/riscv/e_sqrt.c
> index 0c5aaadf3..ba000d36c 100644
> --- a/newlib/libm/machine/riscv/e_sqrt.c
> +++ b/newlib/libm/machine/riscv/e_sqrt.c
> @@ -35,6 +35,7 @@
>
>  #include <math.h>
>  #include "math_config.h"
> +#include "riscv_math.h"
>
>  #if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64
>
> diff --git a/newlib/libm/machine/riscv/ef_sqrt.c b/newlib/libm/machine/riscv/ef_sqrt.c
> index cc41813dd..fd7ab4b41 100644
> --- a/newlib/libm/machine/riscv/ef_sqrt.c
> +++ b/newlib/libm/machine/riscv/ef_sqrt.c
> @@ -35,6 +35,7 @@
>
>  #include <math.h>
>  #include "math_config.h"
> +#include "riscv_math.h"
>
>  #if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32
>
> --
> 2.17.1
>
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.