* [PATCH] Removed Soft float from MIPS
@ 2020-08-12 21:35 Eshan dhawan
2020-08-13 8:19 ` Corinna Vinschen
0 siblings, 1 reply; 6+ messages in thread
From: Eshan dhawan @ 2020-08-12 21:35 UTC (permalink / raw)
To: newlib; +Cc: joel, Eshan dhawan
This Patch removes Soft Float code from MIPS.
Instead It adds the soft float code from RISCV
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
---
.../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 <errno.h>
-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 <machine/fenv-softfloat.h>
#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.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Removed Soft float from MIPS
2020-08-12 21:35 [PATCH] Removed Soft float from MIPS Eshan dhawan
@ 2020-08-13 8:19 ` Corinna Vinschen
2020-08-13 13:10 ` Joel Sherrill
0 siblings, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2020-08-13 8:19 UTC (permalink / raw)
To: Eshan dhawan; +Cc: newlib, joel
On Aug 13 03:05, Eshan dhawan via Newlib wrote:
> This Patch removes Soft Float code from MIPS.
> Instead It adds the soft float code from RISCV
Why, and why is that the right thing to do?
Thanks,
Corinna
> Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
> ---
> .../machine/mips/machine/fenv-softfloat.h | 55 +++++++------------
> newlib/libm/machine/mips/fenv.c | 10 ----
> 2 files changed, 21 insertions(+), 44 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Removed Soft float from MIPS
2020-08-13 8:19 ` Corinna Vinschen
@ 2020-08-13 13:10 ` Joel Sherrill
2020-08-14 4:51 ` Sebastian Huber
2020-08-17 9:22 ` Corinna Vinschen
0 siblings, 2 replies; 6+ messages in thread
From: Joel Sherrill @ 2020-08-13 13:10 UTC (permalink / raw)
To: Newlib, Eshan dhawan, joel; +Cc: Corinna Vinschen
On Thu, Aug 13, 2020 at 3:19 AM Corinna Vinschen via Newlib <
newlib@sourceware.org> wrote:
> On Aug 13 03:05, Eshan dhawan via Newlib wrote:
> > This Patch removes Soft Float code from MIPS.
> > Instead It adds the soft float code from RISCV
>
> Why, and why is that the right thing to do?
>
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.
--joel
>
>
> Thanks,
> Corinna
>
> > Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
> > ---
> > .../machine/mips/machine/fenv-softfloat.h | 55 +++++++------------
> > newlib/libm/machine/mips/fenv.c | 10 ----
> > 2 files changed, 21 insertions(+), 44 deletions(-)
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Removed Soft float from MIPS
2020-08-13 13:10 ` Joel Sherrill
@ 2020-08-14 4:51 ` Sebastian Huber
2020-08-17 9:23 ` Corinna Vinschen
2020-08-17 9:22 ` Corinna Vinschen
1 sibling, 1 reply; 6+ messages in thread
From: Sebastian Huber @ 2020-08-14 4:51 UTC (permalink / raw)
To: joel, Newlib, Eshan dhawan, joel; +Cc: Corinna Vinschen
On 13/08/2020 15:10, Joel Sherrill wrote:
> On Thu, Aug 13, 2020 at 3:19 AM Corinna Vinschen via Newlib <
> newlib@sourceware.org> wrote:
>
>> On Aug 13 03:05, Eshan dhawan via Newlib wrote:
>>> This Patch removes Soft Float code from MIPS.
>>> Instead It adds the soft float code from RISCV
>> Why, and why is that the right thing to do?
>>
> 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.
There is now a lot of copy and paste involved in the fenv support. I
think the soft float support should be unified with a shared
implementation. This can be later enhanced with support for the GCC soft
float implementation.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Removed Soft float from MIPS
2020-08-13 13:10 ` Joel Sherrill
2020-08-14 4:51 ` Sebastian Huber
@ 2020-08-17 9:22 ` Corinna Vinschen
1 sibling, 0 replies; 6+ messages in thread
From: Corinna Vinschen @ 2020-08-17 9:22 UTC (permalink / raw)
To: Joel Sherrill; +Cc: Newlib, Eshan dhawan, joel
On Aug 13 08:10, Joel Sherrill wrote:
> On Thu, Aug 13, 2020 at 3:19 AM Corinna Vinschen via Newlib <
> newlib@sourceware.org> wrote:
>
> > On Aug 13 03:05, Eshan dhawan via Newlib wrote:
> > > This Patch removes Soft Float code from MIPS.
> > > Instead It adds the soft float code from RISCV
> >
> > Why, and why is that the right thing to do?
> >
>
> 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.
>
> --joel
That information belongs into the commit message.
Corinna
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Removed Soft float from MIPS
2020-08-14 4:51 ` Sebastian Huber
@ 2020-08-17 9:23 ` Corinna Vinschen
0 siblings, 0 replies; 6+ messages in thread
From: Corinna Vinschen @ 2020-08-17 9:23 UTC (permalink / raw)
To: Sebastian Huber; +Cc: joel, Newlib, Eshan dhawan, joel
On Aug 14 06:51, Sebastian Huber wrote:
> On 13/08/2020 15:10, Joel Sherrill wrote:
>
> > On Thu, Aug 13, 2020 at 3:19 AM Corinna Vinschen via Newlib <
> > newlib@sourceware.org> wrote:
> >
> > > On Aug 13 03:05, Eshan dhawan via Newlib wrote:
> > > > This Patch removes Soft Float code from MIPS.
> > > > Instead It adds the soft float code from RISCV
> > > Why, and why is that the right thing to do?
> > >
> > 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.
> There is now a lot of copy and paste involved in the fenv support. I think
> the soft float support should be unified with a shared implementation. This
> can be later enhanced with support for the GCC soft float implementation.
Sounds like a good idea to me.
Corinna
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-17 9:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 21:35 [PATCH] Removed Soft float from MIPS Eshan dhawan
2020-08-13 8:19 ` Corinna Vinschen
2020-08-13 13:10 ` Joel Sherrill
2020-08-14 4:51 ` Sebastian Huber
2020-08-17 9:23 ` Corinna Vinschen
2020-08-17 9:22 ` Corinna Vinschen
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).