From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 7E7D43AA7C9B for ; Sat, 22 May 2021 01:25:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7E7D43AA7C9B Received: from vapier (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 40311340C08; Sat, 22 May 2021 01:25:22 +0000 (UTC) Date: Fri, 21 May 2021 21:25:21 -0400 From: Mike Frysinger To: Faraz Shahbazker Cc: gdb-patches@sourceware.org, "Maciej W . Rozycki" , Chao-ying Fu Subject: Re: [PATCH 2/5] sim: Factor out NaN handling in floating point operations Message-ID: Mail-Followup-To: Faraz Shahbazker , gdb-patches@sourceware.org, "Maciej W . Rozycki" , Chao-ying Fu References: <20210520074554.1465327-1-fshahbazker@wavecomp.com> <20210520074554.1465327-3-fshahbazker@wavecomp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210520074554.1465327-3-fshahbazker@wavecomp.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 01:25:24 -0000 On 20 May 2021 13:15, Faraz Shahbazker wrote: > --- a/sim/common/sim-fpu.c > +++ b/sim/common/sim-fpu.c > > +/* NaN handling for binary operations. */ > > +INLINE_SIM_FPU (int) > +sim_fpu_op_nan (sim_fpu *f, const sim_fpu *l, const sim_fpu *r) > +{ > + if (sim_fpu_is_snan (l) || sim_fpu_is_snan (r)) > + { > + *f = sim_fpu_is_snan (l) ? *l : *r; > + f->class = sim_fpu_class_qnan; > + return sim_fpu_status_invalid_snan; > + } > + ASSERT (sim_fpu_is_nan (l) || sim_fpu_is_nan (r)); indent style of this func needs fixing as it's all over the place > + if (sim_fpu_is_qnan (l)) > + *f = *l; > + else /* if (sim_fpu_is_qnan (r)) */ > + *f = *r; so some of the logic you replaced below do: if (sim_fpu_is_qnan (l)) { *f = *l; return 0; } if (sim_fpu_is_qnan (r)) { *f = *r; return 0; } but others do: 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; } it seems like we should have been consistently doing the latter ? so it's a good time to fix with your new helper. > + return sim_fpu_op_nan (f, l, r);x looks like you have a typo in there. might want to do a compile test. -mike