[newlib-cygwin/main] libm: riscv: Reduce sqrt and sqrtf function for code size

Jeff Johnston jjohnstn@sourceware.org
Wed May 21 15:33:35 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d2a30653f6abb1f20b2c923b8047b26799ba18b6

commit d2a30653f6abb1f20b2c923b8047b26799ba18b6
Author: zhusonghe <zhusonghe@eswincomputing.com>
Date:   Wed May 14 16:56:22 2025 +0800

    libm: riscv: Reduce sqrt and sqrtf function for code size
    
    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 <zhusonghe@eswincomputing.com>

Diff:
---
 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


More information about the Newlib-cvs mailing list