Port-alpha archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: NetBSD 9.2 Alpha: error in handling of IEEE 754 binary 32-bit subnormals
> On Sep 14, 2021, at 10:23 AM, Nelson H. F. Beebe <beebe%math.utah.edu@localhost> wrote:
>
> I've now begun testing on NetBSD Alpha a large mathematical library
> that I'm developing, and already have running successfully on numerous
> operating systems and CPU architectures (AMD64 (x86_64), ARM32, ARM64,
> Alpha, HPPA (PA-RISC), M68K, MIPS32, MIPS64, RISC-V64, S390x, SPARC64,
> and x86) in various physical and virtual machines in our large test
> farm of more than 500 O/S--CPU pairs.
>
> The Debian 11 Alpha port of my library passes all of its tests, and
> test output matches satisfactorily with that from other CPU types.
>
> However, for NetBSD Alpha, I quickly found an anomaly: IEEE 754 binary
> 32-bit subnormals are printed incorrectly.
As you might be aware, the FP situation on the Alpha is kind of complicated. It's possible that this is a bug in the kernel's FP completion code (certainly wouldn't be the first time).
>
> The C compiler versions are gcc 10.2.1 on Debian, and 10.3.0 on
> NetBSD.
>
> Another anomaly is shown by the ufl32.c program: it reports the status
> of the IEEE 754 floating-point underflow and inexact flags, and
> whether the result is subnormal or not. The SPARC64 flag settings are
> as expected, and the AMD64 flags differ because of the different
> rounding behavior of those two architectures. There is a discussion
> and explanation here in the section that begins on page 10:
>
> http://www.math.utah.edu/~beebe/ufl/pages-13-21.pdf
>
> However, the Linux and NetBSD outputs of ufl32.c show that the Linux
> Alpha test shows correct expected exception flags, but the NetBSD
> Alpha demonstrates that underflow is abrupt: subnormals are computed
> as zero.
Yes, there some bugs in the this area in NetBSD/alpha at the moment.
> Adding the compiler flag -mieee to the tests produces the output in
> the *.lst-*-mieee files. For the ufl32.c test, that flag produces no
> changes in the Linux output, but the NetBSD output now has nonzero
> subnormals, and the exception flags are all unexpectedly zero. The
> NetBSD is consistent with what DEC did on our physical Alpha systems
> (all now retired) on OSF/1 and Tru64: default to abrupt underflow, but
> restore it with gcc's -mieee, or its equivalent, but differently
> named, flag for DEC's native compilers.
>
> Because both Debian and NetBSD VMs are running on QEMU (6.0.0 and
> 6.1.0, respectively), the Alpha architecture is almost 30 years old,
> and QEMU is generally a solid and reliable emulation of numerous
> architectures, the different flag behavior for subnormals is
> unexpected, and it seems that NetBSD is wrong here too.
I do have some changes sitting in the Project Queue that should improve some of this stuff, but I haven't had time / motivation to get around to finishing them. I'll try to bubble this up in priority and I will definitely take a look at your math library to glean additional test cases.
-- thorpej
Home |
Main Index |
Thread Index |
Old Index