Kernel/userspace: rework floating point math

SSE is now unconditionally enabled any where and most of math.h is now
actually implemented. using __builtin_<func> lead to many hangs where
the builtin function would just call itself.
This commit is contained in:
2024-11-03 20:25:35 +02:00
parent ed19bb11fe
commit f4be37700f
18 changed files with 827 additions and 210 deletions

View File

@@ -7,7 +7,46 @@
__BEGIN_DECLS
// FIXME
#include <stdint.h>
#define FE_INVALID (1 << 0)
#define FE_DIVBYZERO (1 << 2)
#define FE_OVERFLOW (1 << 3)
#define FE_UNDERFLOW (1 << 4)
#define FE_INEXACT (1 << 5)
#define FE_ALL_EXCEPT (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
#define FE_TONEAREST 0
#define FE_DOWNWARD 1
#define FE_UPWARD 2
#define FE_TOWARDZERO 3
typedef struct {
uint32_t control;
uint32_t status;
uint32_t __unused[5];
} __x87_fpu_t;
typedef struct {
__x87_fpu_t x87_fpu;
uint32_t mxcsr;
} fenv_t;
typedef uint8_t fexcept_t;
#define FE_DFL_ENV ((const fenv_t*)0x1)
int feclearexcept(int);
int fegetenv(fenv_t*);
int fegetexceptflag(fexcept_t*, int);
int fegetround(void);
int feholdexcept(fenv_t*);
int feraiseexcept(int);
int fesetenv(const fenv_t*);
int fesetexceptflag(const fexcept_t*, int);
int fesetround(int);
int fetestexcept(int);
int feupdateenv(const fenv_t*);
__END_DECLS