public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/main] RISC-V: Support Zfinx/Zdinx extension. Date: Wed, 26 Jul 2023 13:27:12 +0000 (GMT) [thread overview] Message-ID: <20230726132712.912423858D35@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d572c4482b473d7725be0f9380d4f5d8342e4390 commit d572c4482b473d7725be0f9380d4f5d8342e4390 Author: Kito Cheng via Newlib <newlib@sourceware.org> AuthorDate: Wed Jul 26 18:03:19 2023 +0800 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Wed Jul 26 15:21:35 2023 +0200 RISC-V: Support Zfinx/Zdinx extension. Zfinx/Zdinx are new extensions ratified in 2022, it similar to F/D extensions, support hard float operation for single/double precision, but the difference between Zfinx/Zdinx and F/D is Zfinx/Zdinx is operating under general purpose registers rather than dedicated floating-point registers. This patch improve the hard float support detection for RISC-V port, so that Zfinx/Zdinx can have better/right performance. Co-authored-by: Jesse Huang <jesse.huang@sifive.com> Diff: --- newlib/libc/include/machine/ieeefp.h | 4 ++-- newlib/libc/machine/riscv/ieeefp.c | 10 +++++----- newlib/libc/machine/riscv/sys/fenv.h | 2 +- newlib/libm/common/math_config.h | 6 ++++-- newlib/libm/machine/riscv/e_sqrt.c | 2 +- newlib/libm/machine/riscv/ef_sqrt.c | 2 +- newlib/libm/machine/riscv/feclearexcept.c | 3 ++- newlib/libm/machine/riscv/fegetenv.c | 3 ++- newlib/libm/machine/riscv/fegetexceptflag.c | 3 ++- newlib/libm/machine/riscv/fegetround.c | 3 ++- newlib/libm/machine/riscv/feholdexcept.c | 3 ++- newlib/libm/machine/riscv/feraiseexcept.c | 3 ++- newlib/libm/machine/riscv/fesetenv.c | 3 ++- newlib/libm/machine/riscv/fesetexceptflag.c | 3 ++- newlib/libm/machine/riscv/fesetround.c | 3 ++- newlib/libm/machine/riscv/fetestexcept.c | 3 ++- newlib/libm/machine/riscv/feupdateenv.c | 3 ++- newlib/libm/machine/riscv/riscv_math.h | 12 +++++++++--- newlib/libm/machine/riscv/s_copysign.c | 3 ++- newlib/libm/machine/riscv/s_fabs.c | 3 ++- newlib/libm/machine/riscv/s_finite.c | 3 ++- newlib/libm/machine/riscv/s_fmax.c | 3 ++- newlib/libm/machine/riscv/s_fmin.c | 3 ++- newlib/libm/machine/riscv/s_fpclassify.c | 5 ++--- newlib/libm/machine/riscv/s_isinf.c | 4 ++-- newlib/libm/machine/riscv/s_isnan.c | 4 ++-- newlib/libm/machine/riscv/s_llrint.c | 3 ++- newlib/libm/machine/riscv/s_llround.c | 3 ++- newlib/libm/machine/riscv/s_lrint.c | 3 ++- newlib/libm/machine/riscv/s_lround.c | 3 ++- newlib/libm/machine/riscv/sf_copysign.c | 3 ++- newlib/libm/machine/riscv/sf_fabs.c | 3 ++- newlib/libm/machine/riscv/sf_finite.c | 3 ++- newlib/libm/machine/riscv/sf_fmax.c | 3 ++- newlib/libm/machine/riscv/sf_fmin.c | 3 ++- newlib/libm/machine/riscv/sf_fpclassify.c | 3 ++- newlib/libm/machine/riscv/sf_isinf.c | 4 ++-- newlib/libm/machine/riscv/sf_isnan.c | 4 ++-- newlib/libm/machine/riscv/sf_llrint.c | 3 ++- newlib/libm/machine/riscv/sf_llround.c | 3 ++- newlib/libm/machine/riscv/sf_lrint.c | 3 ++- newlib/libm/machine/riscv/sf_lround.c | 3 ++- 42 files changed, 93 insertions(+), 56 deletions(-) diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h index a29557a6d00c..abadf520b47e 100644 --- a/newlib/libc/include/machine/ieeefp.h +++ b/newlib/libc/include/machine/ieeefp.h @@ -218,10 +218,10 @@ #else #define __IEEE_LITTLE_ENDIAN #endif -#ifdef __riscv_flen +#if defined(__riscv_flen) || defined (__riscv_zfinx) # define _SUPPORTS_ERREXCEPT #endif -#if __riscv_flen == 64 +#if (__riscv_flen == 64) || defined (__riscv_zdinx) # define __OBSOLETE_MATH_DEFAULT 0 #else # define __OBSOLETE_MATH_DEFAULT 1 diff --git a/newlib/libc/machine/riscv/ieeefp.c b/newlib/libc/machine/riscv/ieeefp.c index 60ecacfc2914..185da648c8b1 100644 --- a/newlib/libc/machine/riscv/ieeefp.c +++ b/newlib/libc/machine/riscv/ieeefp.c @@ -11,7 +11,7 @@ #include <ieeefp.h> -#ifdef __riscv_flen +#if defined(__riscv_flen) || defined (__riscv_zfinx) static void fssr(unsigned value) { @@ -85,7 +85,7 @@ fpgetmask(void) fp_rnd fpgetround(void) { -#ifdef __riscv_flen +#if defined(__riscv_flen) || defined (__riscv_zfinx) unsigned rm = (frsr () >> 5) & 0x7; return frm_fp_rnd (rm); #else @@ -96,7 +96,7 @@ fpgetround(void) fp_except fpgetsticky(void) { -#ifdef __riscv_flen +#if defined(__riscv_flen) || defined (__riscv_zfinx) return frm_fp_except(frsr ()); #else return 0; @@ -112,7 +112,7 @@ fpsetmask(fp_except mask) fp_rnd fpsetround(fp_rnd rnd_dir) { -#ifdef __riscv_flen +#if defined(__riscv_flen) || defined (__riscv_zfinx) unsigned fsr = frsr (); unsigned rm = (fsr >> 5) & 0x7; unsigned new_rm; @@ -134,7 +134,7 @@ fpsetround(fp_rnd rnd_dir) fp_except fpsetsticky(fp_except sticky) { -#ifdef __riscv_flen +#if defined(__riscv_flen) || defined (__riscv_zfinx) unsigned fsr = frsr (); fssr (frm_except(sticky) | (fsr & ~0x1f)); return frm_fp_except(fsr); diff --git a/newlib/libc/machine/riscv/sys/fenv.h b/newlib/libc/machine/riscv/sys/fenv.h index 772f3833f4a4..1d577d527bb7 100644 --- a/newlib/libc/machine/riscv/sys/fenv.h +++ b/newlib/libc/machine/riscv/sys/fenv.h @@ -14,7 +14,7 @@ #include <stddef.h> -#if __riscv_flen +#if defined(__riscv_f) || defined(__riscv_zfinx) /* Per "The RISC-V Instruction Set Manual: Volume I: User-Level ISA: * Version 2.1", Section 8.2, "Floating-Point Control and Status diff --git a/newlib/libm/common/math_config.h b/newlib/libm/common/math_config.h index 0f78b5c09b4f..bf881e81b819 100644 --- a/newlib/libm/common/math_config.h +++ b/newlib/libm/common/math_config.h @@ -72,7 +72,8 @@ /* Compiler can inline fma as a single instruction. */ #ifndef HAVE_FAST_FMA -# if __aarch64__ || (__ARM_FEATURE_FMA && (__ARM_FP & 8)) || __riscv_flen >= 64 +# if __aarch64__ || (__ARM_FEATURE_FMA && (__ARM_FP & 8)) \ + || __riscv_flen >= 64 || defined (__riscv_zdinx) # define HAVE_FAST_FMA 1 # else # define HAVE_FAST_FMA 0 @@ -80,7 +81,8 @@ #endif #ifndef HAVE_FAST_FMAF -# if HAVE_FAST_FMA || (__ARM_FEATURE_FMA && (__ARM_FP & 4)) || __riscv_flen >= 32 +# if HAVE_FAST_FMA || (__ARM_FEATURE_FMA && (__ARM_FP & 4)) \ + || __riscv_flen >= 32 || defined (__riscv_zfinx) # define HAVE_FAST_FMAF 1 # else # define HAVE_FAST_FMAF 0 diff --git a/newlib/libm/machine/riscv/e_sqrt.c b/newlib/libm/machine/riscv/e_sqrt.c index d6bfd90ad6b9..0c5aaadf3fa2 100644 --- a/newlib/libm/machine/riscv/e_sqrt.c +++ b/newlib/libm/machine/riscv/e_sqrt.c @@ -36,7 +36,7 @@ #include <math.h> #include "math_config.h" -#if defined(__riscv_fsqrt) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 double __ieee754_sqrt (double x) diff --git a/newlib/libm/machine/riscv/ef_sqrt.c b/newlib/libm/machine/riscv/ef_sqrt.c index 1f378f547df4..cc41813dd546 100644 --- a/newlib/libm/machine/riscv/ef_sqrt.c +++ b/newlib/libm/machine/riscv/ef_sqrt.c @@ -36,7 +36,7 @@ #include <math.h> #include "math_config.h" -#if defined(__riscv_fsqrt) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 float __ieee754_sqrtf (float x) diff --git a/newlib/libm/machine/riscv/feclearexcept.c b/newlib/libm/machine/riscv/feclearexcept.c index 90c7775a49c0..e236a59ebae8 100644 --- a/newlib/libm/machine/riscv/feclearexcept.c +++ b/newlib/libm/machine/riscv/feclearexcept.c @@ -33,6 +33,7 @@ #include <fenv.h> #include <stddef.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -47,7 +48,7 @@ int feclearexcept(int excepts) { -#if __riscv_flen +#if __RISCV_HARD_FLOAT /* Mask excepts to be sure only supported flag bits are set */ diff --git a/newlib/libm/machine/riscv/fegetenv.c b/newlib/libm/machine/riscv/fegetenv.c index c1488c789801..10a9af337544 100644 --- a/newlib/libm/machine/riscv/fegetenv.c +++ b/newlib/libm/machine/riscv/fegetenv.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -47,7 +48,7 @@ int fegetenv(fenv_t *envp) { -#if __riscv_flen +#if __RISCV_HARD_FLOAT /* Get the current environment (FCSR) */ diff --git a/newlib/libm/machine/riscv/fegetexceptflag.c b/newlib/libm/machine/riscv/fegetexceptflag.c index ab1b8a66b282..43d5543f73ef 100644 --- a/newlib/libm/machine/riscv/fegetexceptflag.c +++ b/newlib/libm/machine/riscv/fegetexceptflag.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -48,7 +49,7 @@ int fegetexceptflag(fexcept_t *flagp, int excepts) { -#if __riscv_flen +#if __RISCV_HARD_FLOAT /* Mask excepts to be sure only supported flag bits are set */ diff --git a/newlib/libm/machine/riscv/fegetround.c b/newlib/libm/machine/riscv/fegetround.c index b4c0f2b19b14..6d553479b4ad 100644 --- a/newlib/libm/machine/riscv/fegetround.c +++ b/newlib/libm/machine/riscv/fegetround.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -45,7 +46,7 @@ int fegetround() { -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Get current rounding mode */ diff --git a/newlib/libm/machine/riscv/feholdexcept.c b/newlib/libm/machine/riscv/feholdexcept.c index 9d726dabe804..c83a09bc127d 100644 --- a/newlib/libm/machine/riscv/feholdexcept.c +++ b/newlib/libm/machine/riscv/feholdexcept.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -49,7 +50,7 @@ int feholdexcept(fenv_t *envp) { -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Store the current FP environment in envp*/ diff --git a/newlib/libm/machine/riscv/feraiseexcept.c b/newlib/libm/machine/riscv/feraiseexcept.c index 6f28632d1a25..817fa6274c22 100644 --- a/newlib/libm/machine/riscv/feraiseexcept.c +++ b/newlib/libm/machine/riscv/feraiseexcept.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -58,7 +59,7 @@ int feraiseexcept(int excepts) excepts &= FE_ALL_EXCEPT; -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Set the requested exception flags */ diff --git a/newlib/libm/machine/riscv/fesetenv.c b/newlib/libm/machine/riscv/fesetenv.c index 943b272b706b..a752c45d6f6d 100644 --- a/newlib/libm/machine/riscv/fesetenv.c +++ b/newlib/libm/machine/riscv/fesetenv.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -54,7 +55,7 @@ int fesetenv(const fenv_t *envp) { -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Set environment (FCSR) */ diff --git a/newlib/libm/machine/riscv/fesetexceptflag.c b/newlib/libm/machine/riscv/fesetexceptflag.c index 04400f4ff085..8c70bbd00eaf 100644 --- a/newlib/libm/machine/riscv/fesetexceptflag.c +++ b/newlib/libm/machine/riscv/fesetexceptflag.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -53,7 +54,7 @@ int fesetexceptflag(const fexcept_t *flagp, int excepts) { -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Mask excepts to be sure only supported flag bits are set */ diff --git a/newlib/libm/machine/riscv/fesetround.c b/newlib/libm/machine/riscv/fesetround.c index b2451c71bc9e..76585261d07b 100644 --- a/newlib/libm/machine/riscv/fesetround.c +++ b/newlib/libm/machine/riscv/fesetround.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -48,7 +49,7 @@ int fesetround(int round) { -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Mask round to be sure only valid rounding bits are set */ diff --git a/newlib/libm/machine/riscv/fetestexcept.c b/newlib/libm/machine/riscv/fetestexcept.c index 55d880c990e9..8ed0d5ffa572 100644 --- a/newlib/libm/machine/riscv/fetestexcept.c +++ b/newlib/libm/machine/riscv/fetestexcept.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -47,7 +48,7 @@ int fetestexcept(int excepts) { -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Mask excepts to be sure only supported flag bits are set */ diff --git a/newlib/libm/machine/riscv/feupdateenv.c b/newlib/libm/machine/riscv/feupdateenv.c index 737095c2b03c..90235d0210ea 100644 --- a/newlib/libm/machine/riscv/feupdateenv.c +++ b/newlib/libm/machine/riscv/feupdateenv.c @@ -32,6 +32,7 @@ */ #include <fenv.h> +#include "riscv_math.h" /* This implementation is intended to comply with the following * specification: @@ -50,7 +51,7 @@ int feupdateenv(const fenv_t *envp) { -#if __riscv_flen +#ifdef __RISCV_HARD_FLOAT /* Get current exception flags */ diff --git a/newlib/libm/machine/riscv/riscv_math.h b/newlib/libm/machine/riscv/riscv_math.h index 38948ca12dfa..31220ba0e98a 100644 --- a/newlib/libm/machine/riscv/riscv_math.h +++ b/newlib/libm/machine/riscv/riscv_math.h @@ -38,7 +38,13 @@ -#ifdef __riscv_flen +#if defined(__riscv_flen) || defined(__riscv_zfinx) + +#if (__riscv_flen >= 64) || defined(__riscv_zdinx) +#define __RISCV_HARD_FLOAT 64 +#else +#define __RISCV_HARD_FLOAT 32 +#endif #define FCLASS_NEG_INF (1 << 0) #define FCLASS_NEG_NORMAL (1 << 1) @@ -58,7 +64,7 @@ #define FCLASS_SUBNORMAL (FCLASS_NEG_SUBNORMAL | FCLASS_POS_SUBNORMAL) #define FCLASS_NAN (FCLASS_SNAN | FCLASS_QNAN) -#if __riscv_flen >= 64 +#if (__riscv_flen >= 64) || defined(__riscv_zdinx) static inline long _fclass_d(double x){ long fclass; __asm __volatile ("fclass.d\t%0, %1" : "=r" (fclass) : "f" (x)); @@ -66,7 +72,7 @@ static inline long _fclass_d(double x){ } #endif -#if __riscv_flen >= 32 +#if (__riscv_flen >= 32) || defined(__riscv_zfinx) static inline long _fclass_f(float x){ long fclass; __asm __volatile ("fclass.s\t%0, %1" : "=r" (fclass) : "f" (x)); diff --git a/newlib/libm/machine/riscv/s_copysign.c b/newlib/libm/machine/riscv/s_copysign.c index 047535578353..876e4a80eede 100644 --- a/newlib/libm/machine/riscv/s_copysign.c +++ b/newlib/libm/machine/riscv/s_copysign.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 double copysign (double x, double y) diff --git a/newlib/libm/machine/riscv/s_fabs.c b/newlib/libm/machine/riscv/s_fabs.c index abf7d2c0f56d..bb26d3d0aaac 100644 --- a/newlib/libm/machine/riscv/s_fabs.c +++ b/newlib/libm/machine/riscv/s_fabs.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 double fabs (double x) diff --git a/newlib/libm/machine/riscv/s_finite.c b/newlib/libm/machine/riscv/s_finite.c index 1f1f2244d818..d9ad888a4bbc 100644 --- a/newlib/libm/machine/riscv/s_finite.c +++ b/newlib/libm/machine/riscv/s_finite.c @@ -38,8 +38,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 #include "riscv_math.h" int finite(double x) { diff --git a/newlib/libm/machine/riscv/s_fmax.c b/newlib/libm/machine/riscv/s_fmax.c index bc174d0a0978..059b71c47501 100644 --- a/newlib/libm/machine/riscv/s_fmax.c +++ b/newlib/libm/machine/riscv/s_fmax.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 double fmax (double x, double y) diff --git a/newlib/libm/machine/riscv/s_fmin.c b/newlib/libm/machine/riscv/s_fmin.c index 13dbbf5dd0e7..c62dd868d2de 100644 --- a/newlib/libm/machine/riscv/s_fmin.c +++ b/newlib/libm/machine/riscv/s_fmin.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 double fmin (double x, double y) diff --git a/newlib/libm/machine/riscv/s_fpclassify.c b/newlib/libm/machine/riscv/s_fpclassify.c index 8112d4f786b0..42b4e9fcb2f0 100644 --- a/newlib/libm/machine/riscv/s_fpclassify.c +++ b/newlib/libm/machine/riscv/s_fpclassify.c @@ -33,11 +33,10 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <math.h> - -#if defined(__riscv_flen) && __riscv_flen >= 64 - #include "riscv_math.h" +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 + int __fpclassifyd (double x) { diff --git a/newlib/libm/machine/riscv/s_isinf.c b/newlib/libm/machine/riscv/s_isinf.c index 3d6d685a3e9b..2860b3f88864 100644 --- a/newlib/libm/machine/riscv/s_isinf.c +++ b/newlib/libm/machine/riscv/s_isinf.c @@ -35,10 +35,10 @@ #include <math.h> #include <ieeefp.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 -#include "riscv_math.h" #undef isinf int diff --git a/newlib/libm/machine/riscv/s_isnan.c b/newlib/libm/machine/riscv/s_isnan.c index a0209729ae31..96185cd9a1c2 100644 --- a/newlib/libm/machine/riscv/s_isnan.c +++ b/newlib/libm/machine/riscv/s_isnan.c @@ -35,10 +35,10 @@ #include <math.h> #include <ieeefp.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 -#include "riscv_math.h" #undef isnan int diff --git a/newlib/libm/machine/riscv/s_llrint.c b/newlib/libm/machine/riscv/s_llrint.c index 3f93e60b8da6..39aeb1dbfce7 100644 --- a/newlib/libm/machine/riscv/s_llrint.c +++ b/newlib/libm/machine/riscv/s_llrint.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 && __riscv_xlen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 && __riscv_xlen >= 64 long long int llrint (double x) { diff --git a/newlib/libm/machine/riscv/s_llround.c b/newlib/libm/machine/riscv/s_llround.c index ff41394cf153..538ae9a1826f 100644 --- a/newlib/libm/machine/riscv/s_llround.c +++ b/newlib/libm/machine/riscv/s_llround.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 && __riscv_xlen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 && __riscv_xlen >= 64 long long int llround(double x) { diff --git a/newlib/libm/machine/riscv/s_lrint.c b/newlib/libm/machine/riscv/s_lrint.c index 0e9a9bc8baee..9bed894eebc7 100644 --- a/newlib/libm/machine/riscv/s_lrint.c +++ b/newlib/libm/machine/riscv/s_lrint.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 long int lrint (double x) { diff --git a/newlib/libm/machine/riscv/s_lround.c b/newlib/libm/machine/riscv/s_lround.c index 5be778834f6a..8f15a0ad7abc 100644 --- a/newlib/libm/machine/riscv/s_lround.c +++ b/newlib/libm/machine/riscv/s_lround.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 long int lround (double x) { diff --git a/newlib/libm/machine/riscv/sf_copysign.c b/newlib/libm/machine/riscv/sf_copysign.c index 31b1321ad15f..88afbe2f82f1 100644 --- a/newlib/libm/machine/riscv/sf_copysign.c +++ b/newlib/libm/machine/riscv/sf_copysign.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 float copysignf (float x, float y) diff --git a/newlib/libm/machine/riscv/sf_fabs.c b/newlib/libm/machine/riscv/sf_fabs.c index 1ca92d30d359..ac7a4e0d8010 100644 --- a/newlib/libm/machine/riscv/sf_fabs.c +++ b/newlib/libm/machine/riscv/sf_fabs.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 float fabsf (float x) diff --git a/newlib/libm/machine/riscv/sf_finite.c b/newlib/libm/machine/riscv/sf_finite.c index a17b0fa363cf..690985567e62 100644 --- a/newlib/libm/machine/riscv/sf_finite.c +++ b/newlib/libm/machine/riscv/sf_finite.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 #include "riscv_math.h" int finitef(float x) diff --git a/newlib/libm/machine/riscv/sf_fmax.c b/newlib/libm/machine/riscv/sf_fmax.c index 7b18f006234a..e2d4ad774f62 100644 --- a/newlib/libm/machine/riscv/sf_fmax.c +++ b/newlib/libm/machine/riscv/sf_fmax.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 float fmaxf (float x, float y) diff --git a/newlib/libm/machine/riscv/sf_fmin.c b/newlib/libm/machine/riscv/sf_fmin.c index 771613338ef9..7387d46d399f 100644 --- a/newlib/libm/machine/riscv/sf_fmin.c +++ b/newlib/libm/machine/riscv/sf_fmin.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 float fminf (float x, float y) diff --git a/newlib/libm/machine/riscv/sf_fpclassify.c b/newlib/libm/machine/riscv/sf_fpclassify.c index dee9a7a25f53..9b164085389a 100644 --- a/newlib/libm/machine/riscv/sf_fpclassify.c +++ b/newlib/libm/machine/riscv/sf_fpclassify.c @@ -33,8 +33,9 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 #include "riscv_math.h" diff --git a/newlib/libm/machine/riscv/sf_isinf.c b/newlib/libm/machine/riscv/sf_isinf.c index 0c60f33af43d..d6687469485b 100644 --- a/newlib/libm/machine/riscv/sf_isinf.c +++ b/newlib/libm/machine/riscv/sf_isinf.c @@ -35,10 +35,10 @@ #include <math.h> #include <ieeefp.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 -#include "riscv_math.h" #undef isinff int diff --git a/newlib/libm/machine/riscv/sf_isnan.c b/newlib/libm/machine/riscv/sf_isnan.c index e38abf4abb8e..75b17f151a61 100644 --- a/newlib/libm/machine/riscv/sf_isnan.c +++ b/newlib/libm/machine/riscv/sf_isnan.c @@ -35,10 +35,10 @@ #include <math.h> #include <ieeefp.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 -#include "riscv_math.h" #undef isnanf int diff --git a/newlib/libm/machine/riscv/sf_llrint.c b/newlib/libm/machine/riscv/sf_llrint.c index 58f2e5371a7b..9be28402c44c 100644 --- a/newlib/libm/machine/riscv/sf_llrint.c +++ b/newlib/libm/machine/riscv/sf_llrint.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 && __riscv_xlen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 && __riscv_xlen >= 64 long long int llrintf (float x) { diff --git a/newlib/libm/machine/riscv/sf_llround.c b/newlib/libm/machine/riscv/sf_llround.c index 389da692e7c0..c378eb0cbabd 100644 --- a/newlib/libm/machine/riscv/sf_llround.c +++ b/newlib/libm/machine/riscv/sf_llround.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 && __riscv_xlen >= 64 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 && __riscv_xlen >= 64 long long int llroundf (float x) { diff --git a/newlib/libm/machine/riscv/sf_lrint.c b/newlib/libm/machine/riscv/sf_lrint.c index 4f80a93391a6..13320eb15562 100644 --- a/newlib/libm/machine/riscv/sf_lrint.c +++ b/newlib/libm/machine/riscv/sf_lrint.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 long int lrintf (float x) { diff --git a/newlib/libm/machine/riscv/sf_lround.c b/newlib/libm/machine/riscv/sf_lround.c index dda6d984e347..398dfd2d8cac 100644 --- a/newlib/libm/machine/riscv/sf_lround.c +++ b/newlib/libm/machine/riscv/sf_lround.c @@ -34,8 +34,9 @@ */ #include <math.h> +#include "riscv_math.h" -#if defined(__riscv_flen) && __riscv_flen >= 32 +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 long int lroundf(float x) {
reply other threads:[~2023-07-26 13:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230726132712.912423858D35@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).