[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 80-bit subnormals printed incorrectly on Debian 11 M68K



On Wed, 21 Jul 2021, Stan Johnson wrote:

> > 
> > Here is the output from Debian 11 on M68k (identical with both gcc-9
> > and gcc-10):
> > 
> >     k = -16380	x = 0x8.0000000000000000p-16383 = 1.344841257244837403e-4931 = 0x0003_80000000_00000000
> >     k = -16381	x = 0x8.0000000000000000p-16384 = 6.724206286224187013e-4932 = 0x0002_80000000_00000000
> >     k = -16382	x = 0x8.0000000000000000p-16385 = 3.362103143112093506e-4932 = 0x0001_80000000_00000000
> > 
> >     ---------- begin subnormals ----------
> > 
> >     k = -16383	x = 0x4.0000000000000000p-16386 = 8.405257857780233766e-4933 = 0x0000_40000000_00000000
> >     k = -16384	x = 0x2.0000000000000000p-16386 = 4.202628928890116883e-4933 = 0x0000_20000000_00000000
> >     k = -16385	x = 0x1.0000000000000000p-16386 = 2.101314464445058441e-4933 = 0x0000_10000000_00000000
> > 
> 
> Here's the output of your program from a Mac IIci running Debian SID
> (using gcc version 9.2.1):
> 
> -----
> 
> $ cat /proc/cpuinfo
> CPU:		68030
> MMU:		68030
> FPU:		68882

I wonder if that hardware should be expected to give the same result as 
68040 hardware (?) Both QEMU and Aranym emulate the latter:

CPU:            68040
MMU:            68040
FPU:            68040
Clocking:       211.0MHz
BogoMips:       140.69
Calibration:    703488 loops

> Clocking:	23.1MHz
> BogoMips:	5.78
> Calibration:	28928 loops
> 
> $ cc bug-float80.c
> $ ./a.out
> Addressing is big-endian
> sizeof(long double) = 12
> 
> LDBL_MANT_DIG = 64
> LDBL_MIN_EXP  = -16382
> LDBL_MIN      = 0x8.0000000000000000p-16386 = 1.681051571556046753e-4932
> 
> k = -16381	x = 0xd.eadbeefcafefeed0p-16385 = 5.848974526544159967e-4932 = 0x0001_deadbeef_cafefeed
> k = -16381	x = 0xd.eadbeefcafefeed0p-16385 = 5.848974526544159967e-4932 = 0x0001_deadbeef_cafefeed
> 
> k = -16376	x = 0x8.0000000000000000p-16379 = 2.151746011591739844e-4930 = 0x0007_80000000_00000000
> k = -16377	x = 0x8.0000000000000000p-16380 = 1.075873005795869922e-4930 = 0x0006_80000000_00000000
> k = -16378	x = 0x8.0000000000000000p-16381 = 5.379365028979349610e-4931 = 0x0005_80000000_00000000
> k = -16379	x = 0x8.0000000000000000p-16382 = 2.689682514489674805e-4931 = 0x0004_80000000_00000000
> k = -16380	x = 0x8.0000000000000000p-16383 = 1.344841257244837403e-4931 = 0x0003_80000000_00000000
> k = -16381	x = 0x8.0000000000000000p-16384 = 6.724206286224187013e-4932 = 0x0002_80000000_00000000
> k = -16382	x = 0x8.0000000000000000p-16385 = 3.362103143112093506e-4932 = 0x0001_80000000_00000000
> 
> ---------- begin subnormals ----------
> 
> k = -16383	x = 0x8.0000000000000000p-16386 = 1.681051571556046753e-4932 = 0x0000_80000000_00000000
> k = -16384	x = 0x4.0000000000000000p-16386 = 8.405257857780233766e-4933 = 0x0000_40000000_00000000
> k = -16385	x = 0x2.0000000000000000p-16386 = 4.202628928890116883e-4933 = 0x0000_20000000_00000000
> k = -16386	x = 0x1.0000000000000000p-16386 = 2.101314464445058441e-4933 = 0x0000_10000000_00000000
> k = -16387	x = 0x0.8000000000000000p-16386 = 1.050657232222529221e-4933 = 0x0000_08000000_00000000
> k = -16388	x = 0x0.4000000000000000p-16386 = 5.253286161112646104e-4934 = 0x0000_04000000_00000000
> k = -16389	x = 0x0.2000000000000000p-16386 = 2.626643080556323052e-4934 = 0x0000_02000000_00000000
> 

My Aranym 68040 test agrees with the Motorola 68882 result from Stan.

My QEMU 68040 test agrees with Nelson's results.

It's suprising to see a discrepancy between the two emulators, but it 
seems to be real (same rootfs image).

$ qemu-system-m68k --version
QEMU emulator version 6.0.0
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

$ aranym-mmu --version
ARAnyM 1.1.0 2020/06/16 (git:3ab938a4)
Using config file: '/home/fthain/.aranym/config'
Configuration:
SDL (compiled)   : 2.0.10
SDL (linked)     : 2.0.14
CPU JIT compiler : disabled
FPU JIT compiler : disabled
Addressing mode  : direct
Memory check     : page
Full MMU         : enabled
FPU              : MPFR
DSP              : enabled
DSP disassembler : disabled
OpenGL support   : enabled
Native features  : audio bootstrap xhdi ethernet hostfs cdrom(linux) scsi jpeg vdi(opengl,sw) exec config clipboard

> ...
> > At present, I have no other operating system than Debian 11 on M68K.
> > Web searches indicate that OpenBSD 5.1 ran on that CPU, but its
> > package archives have been been deleted.  NetBSD 9.2 has an ISO image
> > for M68K, but I have not yet successfully created a VM for it.
> > Suggestions for other O/Ses to try are welcome.
> 
> NetBSD runs on m68k systems; see http://www.netbsd.org.  You could also
> try an earlier version of Debian (3.0 or 4.0) on m68k.  And you might
> want to compare the musl libc to glibc; see
> https://wiki.musl-libc.org/functional-differences-from-glibc.html
> 

Another possibility would be A/UX, if more results are needed. There is an 
emulator that's intented to run A/UX called Shoebill.
https://github.com/pruten/shoebill

I don't know whether any of the many available emulators is capable of 
running a NetBSD/m68k port. That might be a question for a different 
mailing list.


Reply to: