Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754505AbdGUQBt (ORCPT ); Fri, 21 Jul 2017 12:01:49 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:27834 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753684AbdGUQBs (ORCPT ); Fri, 21 Jul 2017 12:01:48 -0400 X-PGP-Universal: processed; by imgpgp01.kl.imgtec.org on Fri, 21 Jul 2017 18:12:53 +0100 Date: Fri, 21 Jul 2017 17:01:46 +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 10/16] MIPS: math-emu: MINA.: Fix some cases of infinity and zero inputs Message-ID: <20170721160146.GO6973@jhogan-linux.le.imgtec.org> References: <1500646206-2436-1-git-send-email-aleksandar.markovic@rt-rk.com> <1500646206-2436-11-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VKWlozvtPHRkOTl7" Content-Disposition: inline In-Reply-To: <1500646206-2436-11-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: 4159 Lines: 115 --VKWlozvtPHRkOTl7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 21, 2017 at 04:09:08PM +0200, Aleksandar Markovic wrote: > From: Aleksandar Markovic >=20 > Fix following special cases for MINA>.: >=20 > - if one of the inputs is zero, and the other is subnormal, normal, > or infinity, the value of the former should be returned (that is, > a zero). > - if one of the inputs is infinity, and the other input is normal, > or subnormal, the value of the latter should be returned. >=20 > The previous implementation's logic for such cases was incorrect - it > appears as if it implements MAXA, and not MINA instruction. >=20 > The relevant example: >=20 > MINA.S fd,fs,ft: > If fs contains 100.0, and ft contains 0.0, fd is going to contain > 0.0 (without this patch, it used to contain 100.0). Another ouch! >=20 Fixes/stable > Signed-off-by: Miodrag Dinic > Signed-off-by: Goran Ferenc > Signed-off-by: Aleksandar Markovic Reviewed-by: James Hogan Cheers James > --- > arch/mips/math-emu/dp_fmin.c | 4 ++-- > arch/mips/math-emu/sp_fmin.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/arch/mips/math-emu/dp_fmin.c b/arch/mips/math-emu/dp_fmin.c > index d4cd243..1e9ee3d 100644 > --- a/arch/mips/math-emu/dp_fmin.c > +++ b/arch/mips/math-emu/dp_fmin.c > @@ -191,14 +191,14 @@ union ieee754dp ieee754dp_fmina(union ieee754dp x, = union ieee754dp y) > case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM): > case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): > case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): > - return x; > + return y; > =20 > case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): > case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM): > - return y; > + return x; > =20 > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): > return ieee754dp_zero(xs | ys); > diff --git a/arch/mips/math-emu/sp_fmin.c b/arch/mips/math-emu/sp_fmin.c > index 5f1d650..685ce75 100644 > --- a/arch/mips/math-emu/sp_fmin.c > +++ b/arch/mips/math-emu/sp_fmin.c > @@ -192,14 +192,14 @@ union ieee754sp ieee754sp_fmina(union ieee754sp x, = union ieee754sp y) > case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM): > case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): > case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): > - return x; > + return y; > =20 > case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): > case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM): > - return y; > + return x; > =20 > case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): > return ieee754sp_zero(xs | ys); > --=20 > 2.7.4 >=20 --VKWlozvtPHRkOTl7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAllyJWkACgkQbAtpk944 dnrxqA//YUywNkRclY070jn86CEElnUkieLVJJJpgmsTpaO7Ltn/2WPKmzK3W9Lw CvIrUXsvMgQs/UwPfoU4baGvikeNaYAZWwLhvbFDyCiEekaRrbsWM7jJHY1j0WPz gTm2hWRadUor8uDPu1Gbxaf8zUIA5o7/YavvZ4T/3DNGRB32RPjOwYn3Tw6ojdCy JU2wtpdoVt0E/gdma9bCAa/dD4x+qP98kbYrB4pfKkA8ZGKMelBa04vQZ6eCXL8c Ixi4NMWLB3eTgQVpSDxpjSCQQDRDkEMKHq6Q/IHp1vhMFvWQ2CE5U4t3NGsKHmOE WwR5zTMoI5Cx+pmnzOh7Eoj1b2PpWz3zlh+HQOOFiASv1eZfrNQYM8X13nMNwKEy YbpHlf/62WXknksj2oG82+1FYQCy9PFKEPYxvQAjT2RO2IhC3y/9+4XMBbQD2u+p vc/0HHvrGBcZ7F+WBXnL5MQsTD8H6kX2F5mQKm0JKuiFMMkfggjyn/l7ULf6TaIg yCA5L2/nJ74IdJwL1ShdDca1OJHgECDlfZk6g0RZt7buJah3NTngkV1rls+EcW+K 5F2DK8xWCLH1zIBeKeyl6oe2uxUb2iRs4aG87N+DEoSGA4nhGmZAe4/sY7XtQJOX 70oH6g7NELq3bHsz0s3HF5Phqezl7Sb0tvLDmlnWz1ZkLne++u8= =Kw6B -----END PGP SIGNATURE----- --VKWlozvtPHRkOTl7--