From owner-freebsd-sparc64@FreeBSD.ORG Thu Dec 23 17:12:11 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6466716A4E9 for ; Thu, 23 Dec 2004 17:12:11 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5EDC43D49 for ; Thu, 23 Dec 2004 17:12:10 +0000 (GMT) (envelope-from stephen.paskaluk@gmail.com) Received: by rproxy.gmail.com with SMTP id y7so197319rne for ; Thu, 23 Dec 2004 09:12:10 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=fPVf2AMWtaIlu+tnII0unAmUEXNRzEDm3Az35jlWo6g6hTIH07Yz58B3Osstq+fpyWHbQ0XDMxXxCgTfu7oCun/cyRd7+isP2vHfzbOQ8ytQM/NxouB0dok9KNyw6DBqJ0FoC+E4m5TA8LLbpmuX3tjnf974vk13Ku1U31/z0Ac= Received: by 10.38.99.64 with SMTP id w64mr85426rnb; Thu, 23 Dec 2004 09:12:10 -0800 (PST) Received: by 10.38.126.41 with HTTP; Thu, 23 Dec 2004 09:12:10 -0800 (PST) Message-ID: Date: Thu, 23 Dec 2004 10:12:10 -0700 From: Stephen Paskaluk To: "R. Tyler Ballance" In-Reply-To: <1103799791.7216.35.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1103799791.7216.35.camel@localhost.localdomain> cc: freebsd-sparc64@freebsd.org Subject: Re: Possible long double bug fix (Problem Report sparc64/55773) X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Stephen Paskaluk List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Dec 2004 17:12:11 -0000 On Thu, 23 Dec 2004 05:03:11 -0600, R. Tyler Ballance wrote: > sap@ (of the MirOS project) has come up with a patch to fix this bug, > which in my rudimentary testing on my Ultra2 seems to prove that it > works. > The .diff file can be found here: > http://dero.tamu.edu/~tyler/code/freebsd/fpu_qp.diff I did some more testing, this patch doesn't fix the problems completely. It fixes the sign detection, but there's also a problem with the magnitude calculation because __fpu_xtof (IIRC, I'm just going from memory here) will do a two's complement before determining the magnitude. So something like 0xffffffffffffffff will return -1.0 when signed and 1.0 when unsigned. This didn't come up in earlier testing because the border case of 0x8000000000000000 is equal it's own two's complement. There are two potential fixes I can think of, the first is to for __fpu_xtof() to test fp_sign before doing the two's complement. The second is to implement __fpu_uxtof(). The same problem exists with with __fpu_itof(). I think the sign check is probably sufficient, I'll try to put together and test a patch shortly but I'm busier today than I was yesterday. Cheers, -- Stephen Paskaluk