From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41116 invoked by alias); 31 Aug 2017 21:11:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 41107 invoked by uid 89); 31 Aug 2017 21:11:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2508 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Aug 2017 21:11:22 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v7VLB8I7023700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 31 Aug 2017 17:11:17 -0400 Received: by simark.ca (Postfix, from userid 112) id 2006E1EA2F; Thu, 31 Aug 2017 17:11:08 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 0CA431E5DA; Thu, 31 Aug 2017 17:10:47 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 31 Aug 2017 21:11:00 -0000 From: Simon Marchi To: Stafford Horne Cc: GDB patches , Openrisc , Mike Frysinger , Peter Gavin Subject: Re: [PATCH v4 1/5] sim: cgen: add remainder functions (needed for OR1K lf.rem.[sd]) In-Reply-To: <643da7dcb7d9913a1b239f3aae0ebaebb85a00d7.1496066478.git.shorne@gmail.com> References: <643da7dcb7d9913a1b239f3aae0ebaebb85a00d7.1496066478.git.shorne@gmail.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 31 Aug 2017 21:11:09 +0000 X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00548.txt.bz2 On 2017-05-29 16:47, Stafford Horne wrote: > diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c > index 0d4d08a..1a79e71 100644 > --- a/sim/common/sim-fpu.c > +++ b/sim/common/sim-fpu.c > @@ -41,6 +41,7 @@ along with this program. If not, see > . */ > #include "sim-io.h" > #include "sim-assert.h" > > +#include /* for drem, remove when soft-float version is > implemented */ > > /* Debugging support. > If digits is -1, then print all digits. */ > @@ -1551,6 +1552,68 @@ sim_fpu_div (sim_fpu *f, > > > INLINE_SIM_FPU (int) > +sim_fpu_rem (sim_fpu *f, > + const sim_fpu *l, > + const sim_fpu *r) > +{ > + if (sim_fpu_is_snan (l)) > + { > + *f = *l; > + f->class = sim_fpu_class_qnan; > + return sim_fpu_status_invalid_snan; > + } > + if (sim_fpu_is_snan (r)) > + { > + *f = *r; > + f->class = sim_fpu_class_qnan; > + return sim_fpu_status_invalid_snan; > + } > + if (sim_fpu_is_qnan (l)) > + { > + *f = *l; > + f->class = sim_fpu_class_qnan; > + return 0; > + } > + if (sim_fpu_is_qnan (r)) > + { > + *f = *r; > + f->class = sim_fpu_class_qnan; > + return 0; > + } > + if (sim_fpu_is_infinity (l)) > + { > + *f = sim_fpu_qnan; > + return sim_fpu_status_invalid_irx; > + } > + if (sim_fpu_is_zero (r)) > + { > + *f = sim_fpu_qnan; > + return sim_fpu_status_invalid_div0; > + } > + if (sim_fpu_is_zero (l)) > + { > + *f = *l; > + return 0; > + } > + if (sim_fpu_is_infinity (r)) > + { > + *f = *l; > + return 0; > + } > + { > + /* TODO: Implement remainder here. */ > + > + sim_fpu_map lval, rval, fval; > + lval.i = pack_fpu(l, 1); > + rval.i = pack_fpu(r, 1); > + fval.d = remainder(lval.d, rval.d); > + unpack_fpu(f, fval.i, 1); > + return 0; > + } I can't tell for sure because I'm not maintainer of sim/, but I suppose that we would need a proper implementation that doesn't use the host fpu here. > +} > + > + > +INLINE_SIM_FPU (int) > sim_fpu_max (sim_fpu *f, > const sim_fpu *l, > const sim_fpu *r) > diff --git a/sim/common/sim-fpu.h b/sim/common/sim-fpu.h > index d27d80a..c108f1f 100644 > --- a/sim/common/sim-fpu.h > +++ b/sim/common/sim-fpu.h > @@ -151,6 +151,7 @@ typedef enum > sim_fpu_status_overflow = 4096, > sim_fpu_status_underflow = 8192, > sim_fpu_status_denorm = 16384, > + sim_fpu_status_invalid_irx = 32768, /* (inf % X) */ > } sim_fpu_status; I think it would make sense to put the new entry with the other "invalid" ones and shift the others. Simon