This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v3 07/11] sim/common: Wire in df/di conversion
- From: Stafford Horne <shorne at gmail dot com>
- To: GDB patches <gdb-patches at sourceware dot org>, GNU Binutils <binutils at sourceware dot org>
- Cc: Andrey Bacherov <bandvig at mail dot ru>, Nick Clifton <nickc at redhat dot com>, Andrew Burgess <andrew dot burgess at embecosm dot com>, Richard Henderson <rth at twiddle dot net>, Openrisc <openrisc at lists dot librecores dot org>, Stafford Horne <shorne at gmail dot com>
- Date: Sun, 9 Jun 2019 06:32:23 +0900
- Subject: [PATCH v3 07/11] sim/common: Wire in df/di conversion
- References: <20190608213225.3230-1-shorne@gmail.com>
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.
---
Changes since v2:
- none
sim/common/cgen-accfp.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/sim/common/cgen-accfp.c b/sim/common/cgen-accfp.c
index 5d600c6e41..51f5a29fe2 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;
}
--
2.21.0