Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 May 2004 00:39:13 -0700
From:      David Schultz <das@FreeBSD.ORG>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        alpha@FreeBSD.ORG
Subject:   Re: Problems with floating point exception flags
Message-ID:  <20040506073913.GA35272@VARK.homeunix.com>
In-Reply-To: <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> <20040506045936.GA24034@dhcp01.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 05, 2004, Marcel Moolenaar wrote:
> 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

Applied.  I just fixed a few serious problems that led to some of
the errors you reported below.

> 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

Excellent.  This means the kernel patch worked as intended.  On
beast, I get the following because the kernel is spuriously
clearing some of the status flags:

	Should be 00: 00
	Should be 14: 14
	Should be 1c: 10
	Should be 1e: 12
	Should be 1e: 16

I'll commit the kernel fixes and wait for beast to be updated.
I'll be pretty busy for the next two weeks with real work, so the
timing should work out pretty well.

> 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)"
[...]

Some of these errors are due to the bugs in fenv.h that I just
fixed.  A few of them are expected because they test features I
haven't implemented yet.  Most of the ones at the end work if you
use the compiler flag '-mfp-rounding-mode=d'.  (In gcc/alpha, fast
is the default and IEEE-754 conformance is an option.)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040506073913.GA35272>