From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCU5V-0003u9-0t for qemu-devel@nongnu.org; Wed, 20 Apr 2011 05:52:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCU5U-0001Mp-0y for qemu-devel@nongnu.org; Wed, 20 Apr 2011 05:52:44 -0400 Received: from hall.aurel32.net ([88.191.126.93]:41595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCU5T-0001Md-Rs for qemu-devel@nongnu.org; Wed, 20 Apr 2011 05:52:43 -0400 Date: Wed, 20 Apr 2011 11:37:17 +0200 From: Aurelien Jarno Message-ID: <20110420093717.GF6388@volta.aurel32.net> References: <1303160412-8107-1-git-send-email-aurelien@aurel32.net> <1303160412-8107-12-git-send-email-aurelien@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 11/20] target-i386: fix helper_flbd_ST0() wrt softfloat List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org On Tue, Apr 19, 2011 at 06:06:57PM +0100, Peter Maydell wrote: > On 18 April 2011 22:00, Aurelien Jarno wrote: > > Signed-off-by: Aurelien Jarno > > --- > >  target-i386/op_helper.c |    7 ++++--- > >  1 files changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c > > index f614893..7dddd37 100644 > > --- a/target-i386/op_helper.c > > +++ b/target-i386/op_helper.c > > @@ -3920,9 +3920,10 @@ void helper_fbld_ST0(target_ulong ptr) > >         v = ldub(ptr + i); > >         val = (val * 100) + ((v >> 4) * 10) + (v & 0xf); > >     } > > -    tmp = val; > > -    if (ldub(ptr + 9) & 0x80) > > -        tmp = -tmp; > > +    if (ldub(ptr + 9) & 0x80) { > > +        val = -val; > > +    } > > +    tmp = int64_to_floatx(val, &env->fp_status); > >     fpush(); > >     ST0 = tmp; > >  } > > This doesn't do the right thing for -0 (should generate -0, > not +0). I think: > > tmp = int64_to_floatx(val, &env->fp_status); > if (ldub(ptr + 9) & 0x80) { > floatx_chs(tmp); > } > > ought to do the right thing and work for both softfloat and > sf-native, but I haven't tested it. > Good catch, this solution works. Thanks. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net