From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0Eql-0003PK-U2 for qemu-devel@nongnu.org; Mon, 06 Jan 2014 13:24:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0Eqh-00034k-Fa for qemu-devel@nongnu.org; Mon, 06 Jan 2014 13:24:31 -0500 Received: from mail-qa0-x233.google.com ([2607:f8b0:400d:c00::233]:56826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0Eqh-00034W-9R for qemu-devel@nongnu.org; Mon, 06 Jan 2014 13:24:27 -0500 Received: by mail-qa0-f51.google.com with SMTP id o15so3277856qap.17 for ; Mon, 06 Jan 2014 10:24:26 -0800 (PST) Sender: Richard Henderson Message-ID: <52CAF4D5.5080805@twiddle.net> Date: Mon, 06 Jan 2014 10:24:21 -0800 From: Richard Henderson MIME-Version: 1.0 References: <1389013881-15726-1-git-send-email-peter.maydell@linaro.org> <1389013881-15726-7-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1389013881-15726-7-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 06/24] softfloat: Only raise Invalid when conversions to int are out of range List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: Tom Musta , Peter Crosthwaite , patches@linaro.org, Michael Matz , Alexander Graf , Claudio Fontana , Dirk Mueller , Will Newton , Laurent Desnogues , =?ISO-8859-1?Q?Alex_Benn=E9e?= , kvmarm@lists.cs.columbia.edu, Christoffer Dall On 01/06/2014 05:11 AM, Peter Maydell wrote: > We implement a number of float-to-integer conversions using conversion > to an integer type with a wider range and then a check against the > narrower range we are actually converting to. If we find the result to > be out of range we correctly raise the Invalid exception, but we must > also suppress other exceptions which might have been raised by the > conversion function we called. > > This won't throw away exceptions we should have preserved, because for > the 'core' exception flags the IEEE spec mandates that the only valid > combinations of exception that can be raised by a single operation are > Inexact + Overflow and Inexact + Underflow. For the non-IEEE softfloat > flag for input denormals, we can guarantee that that flag won't have > been set for out of range float-to-int conversions because a squashed > denormal by definition goes to plus or minus zero, which is always in > range after conversion to integer zero. > > This bug has been fixed for some of the float-to-int conversion routines > by previous patches; fix it for the remaining functions as well, so > that they all restore the pre-conversion status flags prior to raising > Invalid. > > Signed-off-by: Peter Maydell > Reviewed-by: Aurelien Jarno > --- > fpu/softfloat.c | 28 ++++++++++++++++------------ > 1 file changed, 16 insertions(+), 12 deletions(-) Reviewed-by: Richard Henderson r~