aboutsummaryrefslogtreecommitdiff
path: root/sim/common/cgen-accfp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common/cgen-accfp.c')
-rw-r--r--sim/common/cgen-accfp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sim/common/cgen-accfp.c b/sim/common/cgen-accfp.c
index 8c7b4f4..9ce204f 100644
--- a/sim/common/cgen-accfp.c
+++ b/sim/common/cgen-accfp.c
@@ -268,6 +268,17 @@ floatsisf (CGEN_FPU* fpu, SI x)
return res;
}
+static DF
+floatsidf (CGEN_FPU* fpu, SI x)
+{
+ sim_fpu ans;
+ unsigned64 res;
+
+ sim_fpu_i32to (&ans, x, sim_fpu_round_near);
+ sim_fpu_to64 (&res, &ans);
+ return res;
+}
+
static SF
ufloatsisf (CGEN_FPU* fpu, USI x)
{
@@ -290,6 +301,17 @@ fixsfsi (CGEN_FPU* fpu, SF x)
return res;
}
+static SI
+fixdfsi (CGEN_FPU* fpu, DF x)
+{
+ sim_fpu op1;
+ unsigned32 res;
+
+ sim_fpu_64to (&op1, x);
+ sim_fpu_to32i (&res, &op1, sim_fpu_round_near);
+ return res;
+}
+
static USI
ufixsfsi (CGEN_FPU* fpu, SF x)
{
@@ -596,7 +618,9 @@ cgen_init_accurate_fpu (SIM_CPU* cpu, CGEN_FPU* fpu, CGEN_FPU_ERROR_FN* error)
o->gtdf = gtdf;
o->gedf = gedf;
o->floatsisf = floatsisf;
+ o->floatsidf = floatsidf;
o->ufloatsisf = ufloatsisf;
o->fixsfsi = fixsfsi;
+ o->fixdfsi = fixdfsi;
o->ufixsfsi = ufixsfsi;
}