mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-02 04:20:28 +08:00
Removed Soft float from MIPS
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 <eshandhawan51@gmail.com>
This commit is contained in:
parent
d4f285329b
commit
7c5a0c04ae
@ -50,16 +50,11 @@
|
|||||||
* doesn't matter how you define them.
|
* doesn't matter how you define them.
|
||||||
*/
|
*/
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
int __softfloat_float_exception_flags;
|
|
||||||
int __softfloat_float_exception_mask;
|
|
||||||
int __softfloat_float_rounding_mode;
|
|
||||||
|
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
feclearexcept(int excepts)
|
feclearexcept(int excepts)
|
||||||
{
|
{
|
||||||
|
|
||||||
__softfloat_float_exception_flags &= ~excepts;
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,16 +62,14 @@ __fenv_static inline int
|
|||||||
fegetexceptflag(fexcept_t *flagp, int excepts)
|
fegetexceptflag(fexcept_t *flagp, int excepts)
|
||||||
{
|
{
|
||||||
|
|
||||||
*flagp = __softfloat_float_exception_flags & excepts;
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
fesetexceptflag(const fexcept_t *flagp, int excepts)
|
fesetexceptflag(const fexcept_t *flagp, int excepts)
|
||||||
{
|
{
|
||||||
|
|
||||||
__softfloat_float_exception_flags &= ~excepts;
|
|
||||||
__softfloat_float_exception_flags |= *flagp & excepts;
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +77,7 @@ __fenv_static inline int
|
|||||||
feraiseexcept(int excepts)
|
feraiseexcept(int excepts)
|
||||||
{
|
{
|
||||||
|
|
||||||
return(excepts ? -ENOTSUP : 0 );
|
return( excepts != 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,21 +85,25 @@ __fenv_static inline int
|
|||||||
fetestexcept(int excepts)
|
fetestexcept(int excepts)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (__softfloat_float_exception_flags & excepts);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
fegetround(void)
|
fegetround(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (__softfloat_float_rounding_mode);
|
#ifdef FE_TONEAREST
|
||||||
|
return FE_TONEAREST;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
fesetround(int rounding_mode)
|
fesetround(int rounding_mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
__softfloat_float_rounding_mode = rounding_mode;
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,19 +111,13 @@ __fenv_static inline int
|
|||||||
fegetenv(fenv_t *envp)
|
fegetenv(fenv_t *envp)
|
||||||
{
|
{
|
||||||
|
|
||||||
__set_env(*envp, __softfloat_float_exception_flags,
|
|
||||||
__softfloat_float_exception_mask, __softfloat_float_rounding_mode);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
feholdexcept(fenv_t *envp)
|
feholdexcept(fenv_t *envp)
|
||||||
{
|
{
|
||||||
fenv_t __env;
|
|
||||||
|
|
||||||
fegetenv(envp);
|
|
||||||
__softfloat_float_exception_flags = 0;
|
|
||||||
__softfloat_float_exception_mask = 0;
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,19 +125,19 @@ __fenv_static inline int
|
|||||||
fesetenv(const fenv_t *envp)
|
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);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
feupdateenv(const fenv_t *envp)
|
feupdateenv(const fenv_t *envp)
|
||||||
{
|
{
|
||||||
int __oflags = __softfloat_float_exception_flags;
|
|
||||||
|
|
||||||
fesetenv(envp);
|
#if defined FE_NOMASK_ENV && FE_ALL_EXCEPT != 0
|
||||||
feraiseexcept(__oflags);
|
if (envp == FE_NOMASK_ENV)
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,26 +148,22 @@ feupdateenv(const fenv_t *envp)
|
|||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
feenableexcept(int __mask)
|
feenableexcept(int __mask)
|
||||||
{
|
{
|
||||||
int __omask = __softfloat_float_exception_mask;
|
|
||||||
|
|
||||||
__softfloat_float_exception_mask |= __mask;
|
return (0);
|
||||||
return (__omask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
fedisableexcept(int __mask)
|
fedisableexcept(int __mask)
|
||||||
{
|
{
|
||||||
int __omask = __softfloat_float_exception_mask;
|
|
||||||
|
|
||||||
__softfloat_float_exception_mask &= ~__mask;
|
return (0);
|
||||||
return (__omask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static inline int
|
||||||
fegetexcept(void)
|
fegetexcept(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (__softfloat_float_exception_mask);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __BSD_VISIBLE */
|
#endif /* __BSD_VISIBLE */
|
||||||
|
@ -44,20 +44,10 @@
|
|||||||
* this as a default environment.
|
* this as a default environment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __mips_soft_float
|
#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>
|
#include <machine/fenv-softfloat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern inline int feclearexcept(int excepts);
|
extern inline int feclearexcept(int excepts);
|
||||||
extern inline int fegetexceptflag(fexcept_t *flagp, int excepts);
|
extern inline int fegetexceptflag(fexcept_t *flagp, int excepts);
|
||||||
extern inline int fesetexceptflag(const fexcept_t *flagp, int excepts);
|
extern inline int fesetexceptflag(const fexcept_t *flagp, int excepts);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user