From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id HAOUOoZdqGCzCwAAWB0awg (envelope-from ) for ; Fri, 21 May 2021 21:25:26 -0400 Received: by simark.ca (Postfix, from userid 112) id E29111F11C; Fri, 21 May 2021 21:25:26 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 469E31E783 for ; Fri, 21 May 2021 21:25:26 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E856E3AA9409; Sat, 22 May 2021 01:25:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E856E3AA9409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621646725; bh=VniTVFX/LRB/G7E7nwSrazW4Nrl8QtXBy0YzRFwaXHU=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=KOpF6Fh7TcUkppYcoSSnMVGfQGjYL5DRum2/TnRTVSKUd+Jkor37oAHnyrSSHqZKf xR8kxYBVJ8kJdzKDuH02qRplPI0WntJlxa00MK3mvkIIPXmMyOs+X+TD8Rk6RiD49U 6hv14f5sDf8I2bcUVvW6A7Ij4Kyq/+/RBeStNE/U= 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 To: Faraz Shahbazker 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-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: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Cc: Chao-ying Fu , gdb-patches@sourceware.org, "Maciej W . Rozycki" Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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