From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Mike Frysinger To: Dragan Mladjenovic Cc: gdb-patches@sourceware.org, "Maciej W . Rozycki" , Chao-ying Fu , Faraz Shahbazker 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-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 12 Jan 2022 10:47:59 -0000 --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--