Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753834AbdGUPm5 (ORCPT ); Fri, 21 Jul 2017 11:42:57 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:36517 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750802AbdGUPmD (ORCPT ); Fri, 21 Jul 2017 11:42:03 -0400 X-PGP-Universal: processed; by imgpgp01.kl.imgtec.org on Fri, 21 Jul 2017 17:53:07 +0100 Date: Fri, 21 Jul 2017 16:42:01 +0100 From: James Hogan To: Aleksandar Markovic CC: , Aleksandar Markovic , Miodrag Dinic , Goran Ferenc , Douglas Leung , , Paul Burton , Petar Jovanovic , Raghu Gandham , Ralf Baechle Subject: Re: [PATCH v3 08/16] MIPS: math-emu: .: Fix cases of input values with opposite signs Message-ID: <20170721154201.GM6973@jhogan-linux.le.imgtec.org> References: <1500646206-2436-1-git-send-email-aleksandar.markovic@rt-rk.com> <1500646206-2436-9-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SynvOvfBJIiBbhhO" Content-Disposition: inline In-Reply-To: <1500646206-2436-9-git-send-email-aleksandar.markovic@rt-rk.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [192.168.154.110] X-ESG-ENCRYPT-TAG: 1b7d744b Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4283 Lines: 142 --SynvOvfBJIiBbhhO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 21, 2017 at 04:09:06PM +0200, Aleksandar Markovic wrote: > From: Aleksandar Markovic >=20 > Fix the value returned by ., if inputs are normal fp > numbers of the same absolute value, but opposite signs. >=20 > The relevant example: >=20 > MAXA.S fd,fs,ft: > If fs contains -3, and ft contains +3, fd is going to contain +3 > (without this patch, it used to contain -3). I think its worth mentioning also that for MINA.*, it returns the negative one when the absolute values are equal (The phrase "For equal absolute values, returns the smallest positive argument" in the manual is a bit ambiguous IMO, so I ended up checking what I6500 did). >=20 Usual fixes/stable thing. > Signed-off-by: Miodrag Dinic > Signed-off-by: Goran Ferenc > Signed-off-by: Aleksandar Markovic Reviewed-by: James Hogan Thanks James > --- > arch/mips/math-emu/dp_fmax.c | 8 ++++++-- > arch/mips/math-emu/dp_fmin.c | 6 +++++- > arch/mips/math-emu/sp_fmax.c | 8 ++++++-- > arch/mips/math-emu/sp_fmin.c | 6 +++++- > 4 files changed, 22 insertions(+), 6 deletions(-) >=20 > diff --git a/arch/mips/math-emu/dp_fmax.c b/arch/mips/math-emu/dp_fmax.c > index a0175cc..860b43f9 100644 > --- a/arch/mips/math-emu/dp_fmax.c > +++ b/arch/mips/math-emu/dp_fmax.c > @@ -224,7 +224,11 @@ union ieee754dp ieee754dp_fmaxa(union ieee754dp x, u= nion ieee754dp y) > return y; > =20 > /* Compare mantissa */ > - if (xm <=3D ym) > + if (xm < ym) > return y; > - return x; > + else if (xm > ym) > + return x; > + else if (xs =3D=3D 0) > + return x; > + return y; > } > diff --git a/arch/mips/math-emu/dp_fmin.c b/arch/mips/math-emu/dp_fmin.c > index 074a858..73d85e4 100644 > --- a/arch/mips/math-emu/dp_fmin.c > +++ b/arch/mips/math-emu/dp_fmin.c > @@ -224,7 +224,11 @@ union ieee754dp ieee754dp_fmina(union ieee754dp x, u= nion ieee754dp y) > return x; > =20 > /* Compare mantissa */ > - if (xm <=3D ym) > + if (xm < ym) > + return x; > + else if (xm > ym) > + return y; > + else if (xs =3D=3D 1) > return x; > return y; > } > diff --git a/arch/mips/math-emu/sp_fmax.c b/arch/mips/math-emu/sp_fmax.c > index 15825db..fec7f64 100644 > --- a/arch/mips/math-emu/sp_fmax.c > +++ b/arch/mips/math-emu/sp_fmax.c > @@ -224,7 +224,11 @@ union ieee754sp ieee754sp_fmaxa(union ieee754sp x, u= nion ieee754sp y) > return y; > =20 > /* Compare mantissa */ > - if (xm <=3D ym) > + if (xm < ym) > return y; > - return x; > + else if (xm > ym) > + return x; > + else if (xs =3D=3D 0) > + return x; > + return y; > } > diff --git a/arch/mips/math-emu/sp_fmin.c b/arch/mips/math-emu/sp_fmin.c > index f1418f7..74780bc 100644 > --- a/arch/mips/math-emu/sp_fmin.c > +++ b/arch/mips/math-emu/sp_fmin.c > @@ -225,7 +225,11 @@ union ieee754sp ieee754sp_fmina(union ieee754sp x, u= nion ieee754sp y) > return x; > =20 > /* Compare mantissa */ > - if (xm <=3D ym) > + if (xm < ym) > + return x; > + else if (xm > ym) > + return y; > + else if (xs =3D=3D 1) > return x; > return y; > } > --=20 > 2.7.4 >=20 --SynvOvfBJIiBbhhO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAllyIMgACgkQbAtpk944 dnoAuA//dmGmcL/yHnQUkIViJmBN6Hly/2a9FfpFYMabSuX0fyoJG23rGq80fbl6 du35sHVoncEU+bySDOvi+l18gsrEs1wLb2VVq9Q5Dl/duACURYKbYi62XdBZDZqS za61EPNu4qHW1PGtq/eG6xNyDJbLBbQkU2q+U0x7QIrGfofvskDlx+5K/59NB9F3 I5yrWHOXYvU6pbarpsf+Fix8eHf2mo+kzA6NZcUsTIWYhQNQhVJrC9SK2EMKgvO0 jo85wfCBoUwLH3N5I1yA8/HmKtPwW7DUItLRpl2JsO6GmsbCwLS1xe8Ld5uOpUhS CzBMftffE+KDVvgvDfunlwpUbbVc6oZei714GCo0CiKizQxWxHDKvSgRyWjLPzME BRwhry/eytsg8oztysMAeg8wha22TsUDXCxH3THkU3XVTnWX6ke5Zl0Mwlknp+6r ddfdyYlAht4kT7eFe4rnlVJF4qQPd2LSGKEJg9UEA8b90TQBycrTlP04CgYiaD/D NUZb3+Xl8oSwyOjmZjkQSj0MW/ZwHuVxDYgqNuw9nIh6rToQG91KxmwCOcjacWn4 Av4L6FfMBrJ4XsKtGz2WyxpVg8IANcHIyCm4GRZyJXa/p+7kSS4bevvku/HbRn+I FlFxMgcgvSRxJAIH357Wnl1LeA+QeiFmmy0ZZ2ltmAI11yytK2Q= =9W/X -----END PGP SIGNATURE----- --SynvOvfBJIiBbhhO--