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

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



On 7/22/21 5:57 PM, Brad Boyer wrote:
> On Thu, Jul 22, 2021 at 07:32:49PM +1000, Finn Thain wrote:
>>> $ 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
> 
> The m68k PRM does document some minor differences between the 68881/68882
> and the built-in FPU in the 68040 (other than the obvious unimplemented
> instructions in the 68040), but I don't think any of it would rise to
> this level. They're almost entirely compatible. My first guess would be
> an emulation bug. This is the sort of thing that would likely be easy to
> get wrong.
> 
> My apologies for not having any of my 68040 systems available for a test
> on the real hardware. I'm not even sure if any of them still work.
> 
> 	Brad Boyer
> 	flar@allandria.com
> 

Attached are three results of running bug-float80.c on m68k hardware:

1) 68040, Centris 650, Debian SID, gcc 9.2.1
2) 68040, Centris 650, NetBSD 9.1, gcc 7.5.0
3) 68030, Mac SE/30, NetBSD 9.1, gcc 7.5.0

The bug-float80.c program doesn't compile in its current form in A/UX;
not only does stdint.h not exist there, but both Aople's C compiler and
an early gcc (2.7.2) repported syntax errors.

-Stan
1) 68040, Centris 650, Debian SID, gcc 9.2.1

$ cat /proc/cpuinfo
CPU:		68040
MMU:		68040
FPU:		68040
Clocking:	24.3MHz
BogoMips:	16.25
Calibration:	81280 loops

$ gcc 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

2) 68040, Centris 650, NetBSD 9.1, gcc 7.5.0

$ cat /proc/cpuinfo
CPU:            68040
MMU:            68040
FPU:            68040

$ gcc 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 = 0x8.0000000000000000p-16387 = 1.681051571556046753e-4932 = 0x0000_40000000_00000000
k = -16385      x = 0x8.0000000000000000p-16388 = 8.405257857780233766e-4933 = 0x0000_20000000_00000000
k = -16386      x = 0x8.0000000000000000p-16389 = 4.202628928890116883e-4933 = 0x0000_10000000_00000000
k = -16387      x = 0x8.0000000000000000p-16390 = 2.101314464445058441e-4933 = 0x0000_08000000_00000000
k = -16388      x = 0x8.0000000000000000p-16391 = 1.050657232222529221e-4933 = 0x0000_04000000_00000000
k = -16389      x = 0x8.0000000000000000p-16392 = 5.253286161112646104e-4934 = 0x0000_02000000_00000000

3) 68030, SE/30, NetBSD 9.1, gcc 7.5.0

$ cat /proc/cpuinfo
CPU:            68030
MMU:            68030
FPU:            68882

$ gcc 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 = 0x8.0000000000000000p-16387 = 1.681051571556046753e-4932 = 0x0000_40000000_00000000
k = -16385      x = 0x8.0000000000000000p-16388 = 8.405257857780233766e-4933 = 0x0000_20000000_00000000
k = -16386      x = 0x8.0000000000000000p-16389 = 4.202628928890116883e-4933 = 0x0000_10000000_00000000
k = -16387      x = 0x8.0000000000000000p-16390 = 2.101314464445058441e-4933 = 0x0000_08000000_00000000
k = -16388      x = 0x8.0000000000000000p-16391 = 1.050657232222529221e-4933 = 0x0000_04000000_00000000
k = -16389      x = 0x8.0000000000000000p-16392 = 5.253286161112646104e-4934 = 0x0000_02000000_00000000


Reply to: