diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h index a29557a6d..abadf520b 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 60ecacfc2..185da648c 100644 --- a/newlib/libc/machine/riscv/ieeefp.c +++ b/newlib/libc/machine/riscv/ieeefp.c @@ -11,7 +11,7 @@ #include -#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 772f3833f..1d577d527 100644 --- a/newlib/libc/machine/riscv/sys/fenv.h +++ b/newlib/libc/machine/riscv/sys/fenv.h @@ -14,7 +14,7 @@ #include -#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 0f78b5c09..bf881e81b 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 d6bfd90ad..0c5aaadf3 100644 --- a/newlib/libm/machine/riscv/e_sqrt.c +++ b/newlib/libm/machine/riscv/e_sqrt.c @@ -36,7 +36,7 @@ #include #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 1f378f547..cc41813dd 100644 --- a/newlib/libm/machine/riscv/ef_sqrt.c +++ b/newlib/libm/machine/riscv/ef_sqrt.c @@ -36,7 +36,7 @@ #include #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 90c7775a4..e236a59eb 100644 --- a/newlib/libm/machine/riscv/feclearexcept.c +++ b/newlib/libm/machine/riscv/feclearexcept.c @@ -33,6 +33,7 @@ #include #include +#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 c1488c789..10a9af337 100644 --- a/newlib/libm/machine/riscv/fegetenv.c +++ b/newlib/libm/machine/riscv/fegetenv.c @@ -32,6 +32,7 @@ */ #include +#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 ab1b8a66b..43d5543f7 100644 --- a/newlib/libm/machine/riscv/fegetexceptflag.c +++ b/newlib/libm/machine/riscv/fegetexceptflag.c @@ -32,6 +32,7 @@ */ #include +#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 b4c0f2b19..6d553479b 100644 --- a/newlib/libm/machine/riscv/fegetround.c +++ b/newlib/libm/machine/riscv/fegetround.c @@ -32,6 +32,7 @@ */ #include +#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 9d726dabe..c83a09bc1 100644 --- a/newlib/libm/machine/riscv/feholdexcept.c +++ b/newlib/libm/machine/riscv/feholdexcept.c @@ -32,6 +32,7 @@ */ #include +#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 6f28632d1..817fa6274 100644 --- a/newlib/libm/machine/riscv/feraiseexcept.c +++ b/newlib/libm/machine/riscv/feraiseexcept.c @@ -32,6 +32,7 @@ */ #include +#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 943b272b7..a752c45d6 100644 --- a/newlib/libm/machine/riscv/fesetenv.c +++ b/newlib/libm/machine/riscv/fesetenv.c @@ -32,6 +32,7 @@ */ #include +#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 04400f4ff..8c70bbd00 100644 --- a/newlib/libm/machine/riscv/fesetexceptflag.c +++ b/newlib/libm/machine/riscv/fesetexceptflag.c @@ -32,6 +32,7 @@ */ #include +#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 b2451c71b..76585261d 100644 --- a/newlib/libm/machine/riscv/fesetround.c +++ b/newlib/libm/machine/riscv/fesetround.c @@ -32,6 +32,7 @@ */ #include +#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 55d880c99..8ed0d5ffa 100644 --- a/newlib/libm/machine/riscv/fetestexcept.c +++ b/newlib/libm/machine/riscv/fetestexcept.c @@ -32,6 +32,7 @@ */ #include +#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 737095c2b..90235d021 100644 --- a/newlib/libm/machine/riscv/feupdateenv.c +++ b/newlib/libm/machine/riscv/feupdateenv.c @@ -32,6 +32,7 @@ */ #include +#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 38948ca12..31220ba0e 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 047535578..876e4a80e 100644 --- a/newlib/libm/machine/riscv/s_copysign.c +++ b/newlib/libm/machine/riscv/s_copysign.c @@ -34,8 +34,9 @@ */ #include +#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 abf7d2c0f..bb26d3d0a 100644 --- a/newlib/libm/machine/riscv/s_fabs.c +++ b/newlib/libm/machine/riscv/s_fabs.c @@ -34,8 +34,9 @@ */ #include +#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 1f1f2244d..d9ad888a4 100644 --- a/newlib/libm/machine/riscv/s_finite.c +++ b/newlib/libm/machine/riscv/s_finite.c @@ -38,8 +38,9 @@ */ #include +#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 bc174d0a0..059b71c47 100644 --- a/newlib/libm/machine/riscv/s_fmax.c +++ b/newlib/libm/machine/riscv/s_fmax.c @@ -34,8 +34,9 @@ */ #include +#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 13dbbf5dd..c62dd868d 100644 --- a/newlib/libm/machine/riscv/s_fmin.c +++ b/newlib/libm/machine/riscv/s_fmin.c @@ -34,8 +34,9 @@ */ #include +#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 8112d4f78..42b4e9fcb 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 - -#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 3d6d685a3..2860b3f88 100644 --- a/newlib/libm/machine/riscv/s_isinf.c +++ b/newlib/libm/machine/riscv/s_isinf.c @@ -35,10 +35,10 @@ #include #include - -#if defined(__riscv_flen) && __riscv_flen >= 64 - #include "riscv_math.h" + +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 + #undef isinf int diff --git a/newlib/libm/machine/riscv/s_isnan.c b/newlib/libm/machine/riscv/s_isnan.c index a0209729a..96185cd9a 100644 --- a/newlib/libm/machine/riscv/s_isnan.c +++ b/newlib/libm/machine/riscv/s_isnan.c @@ -35,10 +35,10 @@ #include #include - -#if defined(__riscv_flen) && __riscv_flen >= 64 - #include "riscv_math.h" + +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 64 + #undef isnan int diff --git a/newlib/libm/machine/riscv/s_llrint.c b/newlib/libm/machine/riscv/s_llrint.c index 3f93e60b8..39aeb1dbf 100644 --- a/newlib/libm/machine/riscv/s_llrint.c +++ b/newlib/libm/machine/riscv/s_llrint.c @@ -34,8 +34,9 @@ */ #include +#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 ff41394cf..538ae9a18 100644 --- a/newlib/libm/machine/riscv/s_llround.c +++ b/newlib/libm/machine/riscv/s_llround.c @@ -34,8 +34,9 @@ */ #include +#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 0e9a9bc8b..9bed894ee 100644 --- a/newlib/libm/machine/riscv/s_lrint.c +++ b/newlib/libm/machine/riscv/s_lrint.c @@ -34,8 +34,9 @@ */ #include +#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 5be778834..8f15a0ad7 100644 --- a/newlib/libm/machine/riscv/s_lround.c +++ b/newlib/libm/machine/riscv/s_lround.c @@ -34,8 +34,9 @@ */ #include +#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 31b1321ad..88afbe2f8 100644 --- a/newlib/libm/machine/riscv/sf_copysign.c +++ b/newlib/libm/machine/riscv/sf_copysign.c @@ -34,8 +34,9 @@ */ #include +#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 1ca92d30d..ac7a4e0d8 100644 --- a/newlib/libm/machine/riscv/sf_fabs.c +++ b/newlib/libm/machine/riscv/sf_fabs.c @@ -34,8 +34,9 @@ */ #include +#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 a17b0fa36..690985567 100644 --- a/newlib/libm/machine/riscv/sf_finite.c +++ b/newlib/libm/machine/riscv/sf_finite.c @@ -34,8 +34,9 @@ */ #include +#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 7b18f0062..e2d4ad774 100644 --- a/newlib/libm/machine/riscv/sf_fmax.c +++ b/newlib/libm/machine/riscv/sf_fmax.c @@ -34,8 +34,9 @@ */ #include +#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 771613338..7387d46d3 100644 --- a/newlib/libm/machine/riscv/sf_fmin.c +++ b/newlib/libm/machine/riscv/sf_fmin.c @@ -34,8 +34,9 @@ */ #include +#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 dee9a7a25..9b1640853 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 +#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 0c60f33af..d66874694 100644 --- a/newlib/libm/machine/riscv/sf_isinf.c +++ b/newlib/libm/machine/riscv/sf_isinf.c @@ -35,10 +35,10 @@ #include #include - -#if defined(__riscv_flen) && __riscv_flen >= 32 - #include "riscv_math.h" + +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 + #undef isinff int diff --git a/newlib/libm/machine/riscv/sf_isnan.c b/newlib/libm/machine/riscv/sf_isnan.c index e38abf4ab..75b17f151 100644 --- a/newlib/libm/machine/riscv/sf_isnan.c +++ b/newlib/libm/machine/riscv/sf_isnan.c @@ -35,10 +35,10 @@ #include #include - -#if defined(__riscv_flen) && __riscv_flen >= 32 - #include "riscv_math.h" + +#if defined(__RISCV_HARD_FLOAT) && __RISCV_HARD_FLOAT >= 32 + #undef isnanf int diff --git a/newlib/libm/machine/riscv/sf_llrint.c b/newlib/libm/machine/riscv/sf_llrint.c index 58f2e5371..9be28402c 100644 --- a/newlib/libm/machine/riscv/sf_llrint.c +++ b/newlib/libm/machine/riscv/sf_llrint.c @@ -34,8 +34,9 @@ */ #include +#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 389da692e..c378eb0cb 100644 --- a/newlib/libm/machine/riscv/sf_llround.c +++ b/newlib/libm/machine/riscv/sf_llround.c @@ -34,8 +34,9 @@ */ #include +#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 4f80a9339..13320eb15 100644 --- a/newlib/libm/machine/riscv/sf_lrint.c +++ b/newlib/libm/machine/riscv/sf_lrint.c @@ -34,8 +34,9 @@ */ #include +#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 dda6d984e..398dfd2d8 100644 --- a/newlib/libm/machine/riscv/sf_lround.c +++ b/newlib/libm/machine/riscv/sf_lround.c @@ -34,8 +34,9 @@ */ #include +#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) {