From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 5C3EC3856DF1 for ; Wed, 26 Jul 2023 10:03:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C3EC3856DF1 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-66c729f5618so6098577b3a.1 for ; Wed, 26 Jul 2023 03:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1690365813; x=1690970613; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=V6Hu6PkIKm/e4DeoGoqgIrrvqbATKrXr/YoFzHE9R2A=; b=mkYtsBHgScKKcNhDW9wA5Yt1lVLNIg2wy2o09Mi2x8BrIFxpllbrXKO0AQGo4fefmO k6XkHo2vssnBr0iQlyCiCQfiQNxc4Bmji/tu5m+Hng5D1Y92Narm9iFOCEY/Nbq+kZNt D/CVDi8mU3jAcwVTnIZbC3fjWdzqnWZbxNINS0xWKNktQEmGhIhb733DoJcAqD/8Ekv8 iwcTjcOk6pdUpBAQrD6Zhqe1EohBsjHkE9zQWX96MgeP4Chmu1+eg1mL2zTU7L+QRfbu rc2ES//qq9HXBX1yOJf/YY43KuNdAp7i3mPYxaAMiuPT0E9FHEh8Plrpu3FCS9f665Iv eFZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690365813; x=1690970613; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V6Hu6PkIKm/e4DeoGoqgIrrvqbATKrXr/YoFzHE9R2A=; b=MfPYfOjKTuyO6DkMQCpEswFCw+ukl0gQaQLyIuXD4GF6ikgotrOLNHtzQ9R28+x0dr JrrTnIrdDnG9NSAF6ZIqbS4ys8HaHmCnm3pahYhGJQB+h2PkJe9BJ0O2jLi6pInU/dNn JQfPgHlbd6WhY3vETG7dixUzmal6d0MGAcIapl93iUzbNUX3FRTnPy5e98jLupwrYaDo Xbs0FUtmb5qpxDoPyoHtjZzMWNeXUhAx+3kvEMeW/2BoykxQY/A62Q+barNzZbTVqwVt TWnYdo05xwZEMjwXSzbUh3T4zPb8uqhvNJJlxp2QMfW+JUDUdhP5sMW2Hg0VpIdKD+Bn /XwQ== X-Gm-Message-State: ABy/qLZ34yxpUMQXvYY8rLIb6dW+BgooWxUxbz3rbXJq+jVmNJMSgTzS CjdBArCJh3lCvWsHtr2DMKSqK3th3XkXFpb0ZAX2c6+dEWv/c0bjlyn8DnG2UjfRzsjeLszyBs7 +ufSNoskFY/tvMBv570vQDBO0PljmK36go7uZXkAeQhDBRIvQeYwxkS23rs9kDuQi4xQRwv5eLx B7 X-Google-Smtp-Source: APBJJlH/e6oNE1enWKWUhuZYgj4Nnnd/O9nGG5c9c13dzHbUHhnlADKONth1SZIdjdH5ubn8UiS3UQ== X-Received: by 2002:aa7:8894:0:b0:654:4a24:d787 with SMTP id z20-20020aa78894000000b006544a24d787mr2093618pfe.12.1690365812331; Wed, 26 Jul 2023 03:03:32 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id i8-20020aa78d88000000b006765cb32558sm11073201pfr.139.2023.07.26.03.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 03:03:31 -0700 (PDT) From: Kito Cheng To: newlib@sourceware.org, kito.cheng@gmail.com Cc: Kito Cheng , Jesse Huang Subject: [PATCH] RISC-V: Support Zfinx/Zdinx extension. Date: Wed, 26 Jul 2023 18:03:19 +0800 Message-Id: <20230726100319.45915-1-kito.cheng@sifive.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- 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 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 +#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 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 +#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 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 +#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 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 +#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 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) { -- 2.40.1