aboutsummaryrefslogtreecommitdiff
path: root/sim/common/cgen-accfp.c
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2019-06-13 21:27:10 +0900
committerStafford Horne <shorne@gmail.com>2019-06-13 21:27:10 +0900
commit688cea90bc0af3a0188695a25f5c4e8db4ef763b (patch)
treedf3335611ca384e08a86a3e42fe3f6e66593d2ba /sim/common/cgen-accfp.c
parent7ccbb4437a29896955a6ff3b0406b1cc2a7f6fe2 (diff)
downloadbinutils-688cea90bc0af3a0188695a25f5c4e8db4ef763b.zip
binutils-688cea90bc0af3a0188695a25f5c4e8db4ef763b.tar.gz
binutils-688cea90bc0af3a0188695a25f5c4e8db4ef763b.tar.bz2
sim/common: Wire in df/di conversion
Up until now these have not been used in any CGEN targets, add them as they are now used by OpenRISC. sim/common/ChangeLog: * cgen-accfp.c (floatdidf, fixdfdi): New functions. (cgen_init_accurate_fpu): Add floatdidf and fixdfdi.
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 5d600c6..51f5a29 100644
--- a/sim/common/cgen-accfp.c
+++ b/sim/common/cgen-accfp.c
@@ -349,6 +349,17 @@ floatsidf (CGEN_FPU* fpu, int how UNUSED, SI x)
return res;
}
+static DF
+floatdidf (CGEN_FPU* fpu, int how UNUSED, DI x)
+{
+ sim_fpu ans;
+ unsigned64 res;
+
+ sim_fpu_i64to (&ans, x, sim_fpu_round_near);
+ sim_fpu_to64 (&res, &ans);
+ return res;
+}
+
static SF
ufloatsisf (CGEN_FPU* fpu, int how UNUSED, USI x)
{
@@ -382,6 +393,17 @@ fixdfsi (CGEN_FPU* fpu, int how UNUSED, DF x)
return res;
}
+static DI
+fixdfdi (CGEN_FPU* fpu, int how UNUSED, DF x)
+{
+ sim_fpu op1;
+ unsigned64 res;
+
+ sim_fpu_64to (&op1, x);
+ sim_fpu_to64i (&res, &op1, sim_fpu_round_near);
+ return res;
+}
+
static USI
ufixsfsi (CGEN_FPU* fpu, int how UNUSED, SF x)
{
@@ -739,8 +761,10 @@ cgen_init_accurate_fpu (SIM_CPU* cpu, CGEN_FPU* fpu, CGEN_FPU_ERROR_FN* error)
o->ftruncdfsf = ftruncdfsf;
o->floatsisf = floatsisf;
o->floatsidf = floatsidf;
+ o->floatdidf = floatdidf;
o->ufloatsisf = ufloatsisf;
o->fixsfsi = fixsfsi;
o->fixdfsi = fixdfsi;
+ o->fixdfdi = fixdfdi;
o->ufixsfsi = ufixsfsi;
}