[fpc-devel] softfloat: sizeOf( floatx80 )

Martin Frb lazarus at mfriebe.de
Sat Sep 28 11:26:34 CEST 2024


On 28/09/2024 10:56, Karoly Balogh via fpc-devel wrote:
> Fromt the top of my head, I only know one example of a big endian system
> which has an 80 bit extended type in hardware, and it's the Motorola 68000
> family. Which actually stores exteded in a 96 bit format in memory, with a
> gap. :) (See: Motorola 68000 Family Reference manual, Page 5-110)

Ok, so then on that platform the gap should probably also exist in the 
record.
> Well, 1., see above 2., if you _really_ want to have this compatible among
> all systems, you need to decide on an on-disk format, including actual
> endianness, then just properly serialize-deserialize it to match that.
Yes, that would have to be deserialised to the gap format, for a 
platform that has the gap.

I would assume that e.g. gdb (if it supports the format at all) would 
expect the gap on that platform.

>> I don't know if floatx80 promises such compatibility. But it would be very
>> useful if it did.
> No, I don't think promises anything like that. I'd say it is primarily an
> internal structure, and using it for I/O might simplify your use case, but
> changing it globally to packed will be a massive performance penalty on
> some systems where you need this performance the most. So we can't change
> it globally in the compiler/RTL.
>

Ok, well...

Currently it is only needed on Win-64. For FpDebug. So the 64bit 
debugger can cross debug a 32 bit target and show "extended" values from 
the 32 bit target.

I have test case  that will detect if FPC changes anything.
If that happens, I will simply have to add a copy of the current working 
version to FpDebug.

Technically, I agree it would then be FpDebug's task to translate the 
format. But that would require that the format of floatx80 is documented 
in such a way that it can (and is meant to be) written by 3rd party code.
And of course, if I where cross debugging from Intel to M68000 the 
adaption would certainly be my duty.

Maybe the softfloat libraries can provide some routine that takes memory 
in the native format and store it correctly into the record?
On Intel:  array[0..9] of byte
On M68000: array[0..11] of byte

Or a record of the correct size, or .... As long as it is documented. Or 
does such a doc already exist?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20240928/b488d2a8/attachment-0001.htm>


More information about the fpc-devel mailing list