From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id XvLzD/Kx3mEcewAAWB0awg (envelope-from ) for ; Wed, 12 Jan 2022 05:48:18 -0500 Received: by simark.ca (Postfix, from userid 112) id 314161F0BB; Wed, 12 Jan 2022 05:48:18 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,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 AE9BC1F0BB for ; Wed, 12 Jan 2022 05:48:17 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 497F0393A424 for ; Wed, 12 Jan 2022 10:48:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 497F0393A424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1641984497; bh=smJW/epcKCsuaFEkl728KQnhT1tdkcrDkIPO3zef1K4=; 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=Vf1UqS8Wm1+7899kHebP4EYfwtDA35WURSneEw7/gEfGBWlmnfDs+1K+Vwq95VgU0 UnAnx/api4VbnU7e41k6v183EtNbdBpNP7Iw+/WEUiA+JpvV1rY4lhQgCEFCA9x0Iv tLikVZt5lMHbctEOF1pctYsUf70ZaYEDsQpZQ4qY= Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 7DC683858416 for ; Wed, 12 Jan 2022 10:47:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7DC683858416 Received: by smtp.gentoo.org (Postfix, from userid 559) id EB68A3430E3; Wed, 12 Jan 2022 10:47:57 +0000 (UTC) Date: Wed, 12 Jan 2022 05:47:55 -0500 To: Dragan Mladjenovic Subject: Re: [PATCH v3 3/4] sim: Add partial support for IEEE 754-2008 Message-ID: Mail-Followup-To: Dragan Mladjenovic , gdb-patches@sourceware.org, "Maciej W . Rozycki" , Chao-ying Fu , Faraz Shahbazker References: <20220111212406.32312-1-Dragan.Mladjenovic@syrmia.com> <20220111212406.32312-4-Dragan.Mladjenovic@syrmia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0Zc66SwZx5OlLNcO" Content-Disposition: inline In-Reply-To: <20220111212406.32312-4-Dragan.Mladjenovic@syrmia.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 , Faraz Shahbazker , gdb-patches@sourceware.org, "Maciej W . Rozycki" Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --0Zc66SwZx5OlLNcO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 11 Jan 2022 22:24, Dragan Mladjenovic wrote: > --- a/sim/common/sim-fpu.c > +++ b/sim/common/sim-fpu.c > =20 > +INLINE_SIM_FPU (int) > +sim_fpu_is_un (const sim_fpu *l, > + const sim_fpu *r) the arguments fit on one line > +INLINE_SIM_FPU (int) > +sim_fpu_is_or (const sim_fpu *l, > + const sim_fpu *r) same here > +INLINE_SIM_FPU (int) > +sim_fpu_un (int *is, const sim_fpu *l, const sim_fpu *r) >=20 > +INLINE_SIM_FPU (int) > +sim_fpu_or (int *is, const sim_fpu *l, const sim_fpu *r) sorry, but what are these functions supposed to be doing ? the sim_fpu_{lt,le,eq,ne,...} binary operations are all fairly obvious in that they map directly to < <=3D =3D=3D !=3D ... but what do un & or map to ? they clearly aren't "Specific comparison operators" like the others as they aren't actually testing the value of the operands other than whether they're NaN's. > + if (sim_fpu_is_nan (l) || sim_fpu_is_nan (r)) > + { > + *is =3D 1; > + return 0; > + } the {} section should be indented one more level > +INLINE_SIM_FPU(int) > +sim_fpu_classify (const sim_fpu *f) > +{ > + switch (f->class) > + { > + case sim_fpu_class_snan: return SIM_FPU_IS_SNAN; > + case sim_fpu_class_qnan: return SIM_FPU_IS_QNAN; > + case sim_fpu_class_infinity: > + if (!f->sign) > + return SIM_FPU_IS_PINF; > + else > + return SIM_FPU_IS_NINF; > + case sim_fpu_class_zero: > + if (!f->sign) > + return SIM_FPU_IS_PZERO; > + else > + return SIM_FPU_IS_NZERO; > + case sim_fpu_class_number: > + if (!f->sign) > + return SIM_FPU_IS_PNUMBER; > + else > + return SIM_FPU_IS_NNUMBER; > + case sim_fpu_class_denorm: > + if (!f->sign) > + return SIM_FPU_IS_PDENORM; > + else > + return SIM_FPU_IS_NDENORM; i think these would be a bit more succinct written as: return f->sign ? SIM_FPU_IS_NINF : SIM_FPU_IS_PINF; > /* A number of useful constants */ > =20 > #if EXTERN_SIM_FPU_P > +static sim_fpu_mode sim_fpu_current_mode =3D sim_fpu_ieee754_1985; this isn't a constant. please don't use global variables to hold state. s= ame as the earlier patch, this should go into the (new) sim_fpu_state structure. -mike --0Zc66SwZx5OlLNcO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmHesdsACgkQQWM7n+g3 9YGkQg//QBJviizzYWPmmg3pAKsavfYsGl3jizcMpvPNCCthR3C46TFXPPn6mX2B BZ9TRVIwNztlX73z78tRS9WTgRXHZHYPfVM263kk15AuIZASfqQ3M2lCeVSp4GHt RV56ym83zXtcJlooKfmrSNX/ThSc24OxTroBQ8w/klq3KelKLXgB+xx2rjMORfET GyAhOyIq8kc1rONtS31hExr15DxkMb74G4gqZXJsgaoUDzpanYGTHObnwmMgqlie kY0KoSGHlrNHoDmFNiXyNzYgDyR81KMsq3KFUtObCu81HSDr8CKmyU5bPvq3PQIn sQV3O8YPpnSL0ERJPhy1CfPgqPkwWOMQlk6U0OC/2YvL2NF1HfNJsFBXFFH1jECO qzSmODMlZCAcamYUVh5cqjBM2u/4G83VVT61rXK9wW9gYYVoHv3pIQD7ENwo8UXD KWYTJGQBFOjQ/Trpf0tJb34L3mkwIqv66OFrM7HZRAVD0e+sDBlJg88wzvNCgJhc FTO5K/YzT0mb9pUbY53ohZZrJlZg2IMvKLc3pZKDX/nQoq7GXfA2WCvhaKVbYe+v a/OKMBshF+SnHlaJWKyBjtE7ghbF9luRpwekNcY/bZIyziBv9k8sQAfvusoDt9Gp R5oityj6jgdLeS+xqqUqARUEBPaXpiXjWOMUkFP56PN5XZ9lAuI= =Emzs -----END PGP SIGNATURE----- --0Zc66SwZx5OlLNcO--