aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-fpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common/sim-fpu.h')
-rw-r--r--sim/common/sim-fpu.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/sim/common/sim-fpu.h b/sim/common/sim-fpu.h
index 2a14198..a20b286 100644
--- a/sim/common/sim-fpu.h
+++ b/sim/common/sim-fpu.h
@@ -163,8 +163,15 @@ typedef enum
FIXME: This state is global, but should be moved to SIM_CPU. */
+typedef enum
+{
+ sim_fpu_ieee754_1985,
+ sim_fpu_ieee754_2008,
+} sim_fpu_mode;
+
typedef struct _sim_fpu_state {
bool quiet_nan_inverted; /* Toggle quiet NaN semantics. */
+ sim_fpu_mode current_mode;
} sim_fpu_state;
@@ -268,6 +275,8 @@ INLINE_SIM_FPU (int) sim_fpu_sqrt (sim_fpu *f,
INLINE_SIM_FPU (int) sim_fpu_op_nan (sim_fpu *f,
const sim_fpu *l, const sim_fpu *r);
+INLINE_SIM_FPU (int) sim_fpu_minmax_nan (sim_fpu *f,
+ const sim_fpu *l, const sim_fpu *r);
@@ -318,7 +327,8 @@ INLINE_SIM_FPU (double) sim_fpu_2d (const sim_fpu *d);
/* INLINE_SIM_FPU (void) sim_fpu_f2 (sim_fpu *f, float s); */
INLINE_SIM_FPU (void) sim_fpu_d2 (sim_fpu *f, double d);
-
+/* IEEE754-2008 classifiction function. */
+INLINE_SIM_FPU (int) sim_fpu_classify (const sim_fpu *f);
/* Specific number classes.
@@ -367,7 +377,20 @@ INLINE_SIM_FPU (int) sim_fpu_is_ne (const sim_fpu *l, const sim_fpu *r);
INLINE_SIM_FPU (int) sim_fpu_is_ge (const sim_fpu *l, const sim_fpu *r);
INLINE_SIM_FPU (int) sim_fpu_is_gt (const sim_fpu *l, const sim_fpu *r);
+/* Unordered/ordered comparison operators. */
+
+INLINE_SIM_FPU (int) sim_fpu_un (int *is, const sim_fpu *l, const sim_fpu *r);
+INLINE_SIM_FPU (int) sim_fpu_or (int *is, const sim_fpu *l, const sim_fpu *r);
+
+INLINE_SIM_FPU (int) sim_fpu_is_un (const sim_fpu *l, const sim_fpu *r);
+INLINE_SIM_FPU (int) sim_fpu_is_or (const sim_fpu *l, const sim_fpu *r);
+
+/* Changes the behaviour of the library to IEEE754-2008 or IEEE754-1985.
+ The default for the library is IEEE754-1985. */
+INLINE_SIM_FPU (bool) sim_fpu_is_ieee754_1985 (void);
+INLINE_SIM_FPU (bool) sim_fpu_is_ieee754_2008 (void);
+INLINE_SIM_FPU (void) sim_fpu_set_mode (const sim_fpu_mode m);
/* General number class and comparison operators.
@@ -411,6 +434,7 @@ extern sim_fpu_state _sim_fpu;
between pre-R6 and R6 MIPS cores. */
#define sim_fpu_quiet_nan_inverted _sim_fpu.quiet_nan_inverted
+#define sim_fpu_current_mode _sim_fpu.current_mode
/* A number of useful constants. */