From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vy0fP-0006ZY-Rv for qemu-devel@nongnu.org; Tue, 31 Dec 2013 09:51:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vy0fH-00040W-Dy for qemu-devel@nongnu.org; Tue, 31 Dec 2013 09:51:35 -0500 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]:54116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vy0fH-00040M-6M for qemu-devel@nongnu.org; Tue, 31 Dec 2013 09:51:27 -0500 Received: by mail-pd0-f170.google.com with SMTP id g10so12438756pdj.15 for ; Tue, 31 Dec 2013 06:51:25 -0800 (PST) Sender: Richard Henderson Message-ID: <52C2D9E9.1010800@twiddle.net> Date: Tue, 31 Dec 2013 06:51:21 -0800 From: Richard Henderson MIME-Version: 1.0 References: <1388496958-3542-1-git-send-email-peter.maydell@linaro.org> <1388496958-3542-15-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1388496958-3542-15-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 14/22] softfloat: Add support for ties-away rounding 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, Aurelien Jarno , 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 [Tom, this is exactly what you need to fix FRIN rounding.] On 12/31/2013 05:35 AM, Peter Maydell wrote: > - float_round_to_zero = 3 > + float_round_to_zero = 3, > + float_round_ties_away = 4, I'm not keen on the name. Does anyone else think float_round_nearest_inf is a better name? > +++ b/fpu/softfloat.c > @@ -107,7 +107,7 @@ static int32 roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM) > roundingMode = STATUS(float_rounding_mode); > roundNearestEven = ( roundingMode == float_round_nearest_even ); > roundIncrement = 0x40; > - if ( ! roundNearestEven ) { > + if (!roundNearestEven && roundingMode != float_round_ties_away) { > if ( roundingMode == float_round_to_zero ) { > roundIncrement = 0; > } This whole section of code is now a mess. I know you're looking for minimal changes here, but perhaps I can convince you that switch (roundingMode) { case float_round_nearest_even: case float_round_ties_away: roundIncrement = 0x40; break; case float_round_to_zero: roundIncrement = 0; break; case float_round_up: roundIncrement = zSign ? 0 : 0x7f; break; case float_round_down: roundIncrement = zSign ? 0x7f : 0; break; default: abort(); } is easier to follow? Otherwise, I don't see anything actually wrong in the patch. r~