From owner-freebsd-alpha@FreeBSD.ORG Wed May 5 21:59:46 2004 Return-Path: Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A1DA616A4CE; Wed, 5 May 2004 21:59:46 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id BEF3343D6A; Wed, 5 May 2004 21:59:36 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.11/8.12.11) with ESMTP id i464xa0m016004; Wed, 5 May 2004 21:59:36 -0700 (PDT) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) i464xait024096; Wed, 5 May 2004 21:59:36 -0700 (PDT) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.11/8.12.11/Submit) id i464xa5A024095; Wed, 5 May 2004 21:59:36 -0700 (PDT) (envelope-from marcel) Date: Wed, 5 May 2004 21:59:36 -0700 From: Marcel Moolenaar To: David Schultz Message-ID: <20040506045936.GA24034@dhcp01.pn.xcllnt.net> References: <20040428064116.GA7870@VARK.homeunix.com> <20040504133904.GA22084@VARK.homeunix.com> <20040506020629.GA23555@dhcp01.pn.xcllnt.net> <20040506043137.GA10641@VARK.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040506043137.GA10641@VARK.homeunix.com> User-Agent: Mutt/1.4.2.1i cc: alpha@FreeBSD.ORG Subject: Re: Problems with floating point exception flags X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2004 04:59:46 -0000 On Wed, May 05, 2004 at 09:31:38PM -0700, David Schultz wrote: > On Wed, May 05, 2004, Marcel Moolenaar wrote: > > On Tue, May 04, 2004 at 06:39:04AM -0700, David Schultz wrote: > > > > > > Here is a better kernel patch. Instead of treating all the bits > > > of the FPCR as sticky, it merely treats the exception flags that > > > way. After reading the source carefully, I'm pretty sure this is > > > the right fix, but I can't test it without working hardware. > > > I also uncovered a bug in the way the software floating-point > > > routines handle underflow. See below. > > > > I built and booted a kernel with these patches. Trying to exercise the > > code with the files at http://people.freebsd.org/~das/alpha yield: > > Thanks! > > > alpha% ./te > > Should be 00: 00 > > Floating exception (core dumped) > > May 5 19:00:11 alpha kernel: pid 638 (te), uid 4152: exited on signal 8 (core dumped) > > You need to compile the program with gcc's -mieee option in order > to get floating point to work in a reasonable way on alpha. If > you could try the program compiled with -mieee, that would be great. Attached a fix for fenv.h. All files newly downloaded from ~das/alpha alpha% cc -g -mieee -o te te.c alpha% ./te Should be 00: 00 Should be 14: 14 Should be 1c: 1c Should be 1e: 1e Should be 1e: 1e alpha% cc -g -mieee -o test-fenv test-fenv.c -lm main() in test-fenv.c:111, "fetestexcept(FE_ALL_EXCEPT) == 0" main() in test-fenv.c:117, "fetestexcept(FE_ALL_EXCEPT) == 0" main() in test-fenv.c:121, "fetestexcept(ALL_STD_EXCEPT) == (ALL_STD_EXCEPT & ~FE_DIVBYZERO)" main() in test-fenv.c:125, "fetestexcept(FE_ALL_EXCEPT) == FE_INEXACT" main() in test-fenv.c:127, "fetestexcept(FE_ALL_EXCEPT) == 0" main() in test-fenv.c:131, "fetestexcept(FE_ALL_EXCEPT) == FE_INEXACT" main() in test-fenv.c:134, "fetestexcept(FE_ALL_EXCEPT) == (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW)" main() in test-fenv.c:136, "fetestexcept(FE_ALL_EXCEPT) == 0" main() in test-fenv.c:139, "(fegetmask() & ALL_STD_EXCEPT) == 0" main() in test-fenv.c:143, "fetestexcept(ALL_STD_EXCEPT) == FE_DIVBYZERO" main() in test-fenv.c:146, "expecting_trap == 0" main() in test-fenv.c:148, "fetestexcept(ALL_STD_EXCEPT) == 0" main() in test-fenv.c:153, "fetestexcept(ALL_STD_EXCEPT) == 0" main() in test-fenv.c:156, "expecting_trap == 0" main() in test-fenv.c:158, "fetestexcept(ALL_STD_EXCEPT) == 0" main() in test-fenv.c:160, "(fegetmask() & ALL_STD_EXCEPT) == 0" main() in test-fenv.c:165, "fegetround() == FE_DOWNWARD" main() in test-fenv.c:166, "getround() == FE_DOWNWARD" main() in test-fenv.c:168, "getround() == FE_UPWARD" main() in test-fenv.c:169, "fegetround() == FE_UPWARD" main() in test-fenv.c:171, "getround() == FE_TOWARDZERO" main() in test-fenv.c:172, "fegetround() == FE_TOWARDZERO" main() in test-fenv.c:179, "getround() == FE_DOWNWARD" main() in test-fenv.c:181, "getround() == FE_UPWARD" FYI, -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net