From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id D9EF0384A02A for ; Wed, 3 Feb 2021 22:04:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D9EF0384A02A Received: by mail-pl1-x635.google.com with SMTP id j11so605738plt.11 for ; Wed, 03 Feb 2021 14:04:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=q8714cquxm3jcKAzAevtiTU2lI7N2l+Vy7sLD12lGtU=; b=Hig6FfqLU+BaXVyDGBAmiHiWneSRnmi3Ddhic0CyjHIXtR2RCTGnhQ6Kcfc1NgQKGV adcE8ItswaDyYiHUJmkT+rwxKthjhFjZ2RKHjDKdONxaVi/+tog6Taq974jkgDSUbd0V n3Mtt80BYiqs5Xj0D6NXUeQAPaLqTVrWLM2B1DJku4RtH4KZ7smKNX3eekirGOSKmXUC emM/gT00CiqNCSpE06CE7T0cfqUWBc9Gmlg9DrfTZ5yRcalMFR+tEpXZLl3eJg6OZuwW LqXll12UW07BvFa1koTNMRQ7sfFnm0Vl3Z4iCtcFkhb4pCDPb0AUf31+bMsD+MS5PNWG /ydg== X-Gm-Message-State: AOAM533kH0ewaf0oS2K+i7NT4ZCRSAYP5g/hnWSYDB/U2ANujDoeOa1U 5/LY/yEE3cM87FVlM1uvgz9QzMiizfl4o32m X-Google-Smtp-Source: ABdhPJwkQVEpyl+h7UxCy+JpEDOtXMH4jEQmFuSP20hhx6WTEMr0BuLhPSstFsm9pGNhzsOQj7FgpQ== X-Received: by 2002:a17:90a:cc03:: with SMTP id b3mr5164578pju.2.1612389861713; Wed, 03 Feb 2021 14:04:21 -0800 (PST) Received: from localhost.localdomain ([45.89.173.198]) by smtp.gmail.com with ESMTPSA id x3sm3427177pfp.98.2021.02.03.14.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 14:04:20 -0800 (PST) From: Eshan Dhawan To: newlib@sourceware.org Subject: [PATCH v2] Removed Soft float from MIPS Date: Thu, 4 Feb 2021 03:34:06 +0530 Message-Id: <20210203220406.108851-1-eshandhawan51@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 22:04:24 -0000 From: Eshan dhawan This Patch removes Soft Float code from MIPS. Instead It adds the soft float code from RISCV The code came from FreeBSD and assumes the FreeBSD softfp implementation not the one with GCC. That was an overlooked and fixed in the other fenv code already. Signed-off-by: Eshan Dhawan --- .../machine/mips/machine/fenv-softfloat.h | 55 +++++++------------ newlib/libm/machine/mips/fenv.c | 10 ---- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/newlib/libc/machine/mips/machine/fenv-softfloat.h b/newlib/libc/machine/mips/machine/fenv-softfloat.h index cf13e73fc..7c8bc3a89 100644 --- a/newlib/libc/machine/mips/machine/fenv-softfloat.h +++ b/newlib/libc/machine/mips/machine/fenv-softfloat.h @@ -50,16 +50,11 @@ * doesn't matter how you define them. */ #include -int __softfloat_float_exception_flags; -int __softfloat_float_exception_mask; -int __softfloat_float_rounding_mode; - __fenv_static inline int feclearexcept(int excepts) { - __softfloat_float_exception_flags &= ~excepts; return (0); } @@ -67,16 +62,14 @@ __fenv_static inline int fegetexceptflag(fexcept_t *flagp, int excepts) { - *flagp = __softfloat_float_exception_flags & excepts; return (0); + } __fenv_static inline int fesetexceptflag(const fexcept_t *flagp, int excepts) { - __softfloat_float_exception_flags &= ~excepts; - __softfloat_float_exception_flags |= *flagp & excepts; return (0); } @@ -84,7 +77,7 @@ __fenv_static inline int feraiseexcept(int excepts) { -return(excepts ? -ENOTSUP : 0 ); + return( excepts != 0 ); } @@ -92,21 +85,25 @@ __fenv_static inline int fetestexcept(int excepts) { - return (__softfloat_float_exception_flags & excepts); + return (0); } __fenv_static inline int fegetround(void) { - return (__softfloat_float_rounding_mode); +#ifdef FE_TONEAREST + return FE_TONEAREST; +#else + return 0; +#endif + } __fenv_static inline int fesetround(int rounding_mode) { - __softfloat_float_rounding_mode = rounding_mode; return (0); } @@ -114,19 +111,13 @@ __fenv_static inline int fegetenv(fenv_t *envp) { - __set_env(*envp, __softfloat_float_exception_flags, - __softfloat_float_exception_mask, __softfloat_float_rounding_mode); return (0); } __fenv_static inline int feholdexcept(fenv_t *envp) { - fenv_t __env; - - fegetenv(envp); - __softfloat_float_exception_flags = 0; - __softfloat_float_exception_mask = 0; + return (0); } @@ -134,19 +125,19 @@ __fenv_static inline int fesetenv(const fenv_t *envp) { - __softfloat_float_exception_flags = __env_flags(*envp); - __softfloat_float_exception_mask = __env_mask(*envp); - __softfloat_float_rounding_mode = __env_round(*envp); + return (0); } __fenv_static inline int feupdateenv(const fenv_t *envp) { - int __oflags = __softfloat_float_exception_flags; - fesetenv(envp); - feraiseexcept(__oflags); +#if defined FE_NOMASK_ENV && FE_ALL_EXCEPT != 0 + if (envp == FE_NOMASK_ENV) + return 1; +#endif + return (0); } @@ -157,26 +148,22 @@ feupdateenv(const fenv_t *envp) __fenv_static inline int feenableexcept(int __mask) { - int __omask = __softfloat_float_exception_mask; - - __softfloat_float_exception_mask |= __mask; - return (__omask); + + return (0); } __fenv_static inline int fedisableexcept(int __mask) { - int __omask = __softfloat_float_exception_mask; - - __softfloat_float_exception_mask &= ~__mask; - return (__omask); + + return (0); } __fenv_static inline int fegetexcept(void) { - return (__softfloat_float_exception_mask); + return (0); } #endif /* __BSD_VISIBLE */ diff --git a/newlib/libm/machine/mips/fenv.c b/newlib/libm/machine/mips/fenv.c index 6e4bb8f33..e2179eb20 100644 --- a/newlib/libm/machine/mips/fenv.c +++ b/newlib/libm/machine/mips/fenv.c @@ -44,20 +44,10 @@ * this as a default environment. */ - #ifdef __mips_soft_float -#define __set_env(env, flags, mask, rnd) env = ((flags) \ - | (mask)<<_FPUSW_SHIFT \ - | (rnd) << 24) -#define __env_flags(env) ((env) & FE_ALL_EXCEPT) -#define __env_mask(env) (((env) >> _FPUSW_SHIFT) \ - & FE_ALL_EXCEPT) -#define __env_round(env) (((env) >> 24) & _ROUND_MASK) #include #endif - - extern inline int feclearexcept(int excepts); extern inline int fegetexceptflag(fexcept_t *flagp, int excepts); extern inline int fesetexceptflag(const fexcept_t *flagp, int excepts); -- 2.27.0