]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim/common: Wire in df/di conversion
authorStafford Horne <shorne@gmail.com>
Thu, 13 Jun 2019 12:27:10 +0000 (21:27 +0900)
committerStafford Horne <shorne@gmail.com>
Thu, 13 Jun 2019 12:27:10 +0000 (21:27 +0900)
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.

sim/common/ChangeLog
sim/common/cgen-accfp.c

index fce47023729a42f23a41fa15ba0a01304b99d793..7b0e617bf8ae0c921cd01096b0949b1e856e96a6 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-13  Stafford Horne  <shorne@gmail.com>
+
+       * cgen-accfp.c (floatdidf, fixdfdi): New functions.
+       (cgen_init_accurate_fpu): Add floatdidf and fixdfdi.
+
 2019-04-13  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * cgen-ops.h (SUBWORDXFSI): Compare HOST_BYTE_ORDER not
index 5d600c6e418a2ac4503a8a33e6bed582905c43e4..51f5a29fe24d3cd4ca1105a743d657654d83c85d 100644 (file)
@@ -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;
 }