From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86199 invoked by alias); 13 Jun 2019 12:27:55 -0000 Mailing-List: contact gdb-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: gdb-cvs-owner@sourceware.org List-Subscribe: Sender: gdb-cvs-owner@sourceware.org Received: (qmail 86128 invoked by uid 10182); 13 Jun 2019 12:27:55 -0000 Date: Thu, 13 Jun 2019 12:27:00 -0000 Message-ID: <20190613122755.86126.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Stafford Horne To: gdb-cvs@sourceware.org Subject: [binutils-gdb] sim/common: Wire in df/di conversion X-Act-Checkin: binutils-gdb X-Git-Author: Stafford Horne X-Git-Refname: refs/heads/master X-Git-Oldrev: 7ccbb4437a29896955a6ff3b0406b1cc2a7f6fe2 X-Git-Newrev: 688cea90bc0af3a0188695a25f5c4e8db4ef763b X-SW-Source: 2019-06/txt/msg00066.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=688cea90bc0af3a0188695a25f5c4e8db4ef763b commit 688cea90bc0af3a0188695a25f5c4e8db4ef763b Author: Stafford Horne Date: Thu Jun 13 21:27:10 2019 +0900 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. Diff: --- sim/common/ChangeLog | 5 +++++ sim/common/cgen-accfp.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index fce4702..7b0e617 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2019-06-13 Stafford Horne + + * cgen-accfp.c (floatdidf, fixdfdi): New functions. + (cgen_init_accurate_fpu): Add floatdidf and fixdfdi. + 2019-04-13 Andrew Burgess * cgen-ops.h (SUBWORDXFSI): Compare HOST_BYTE_ORDER not 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; }