| |
| Posted by H. S. Teoh in reply to IGotD- | PermalinkReply |
|
H. S. Teoh
Posted in reply to IGotD-
| On Fri, Jul 08, 2022 at 10:34:34PM +0000, IGotD- via Digitalmars-d wrote:
> On Friday, 8 July 2022 at 22:04:38 UTC, Walter Bright wrote:
> > In order for DMD to become a proper cross compiler, it needs to be able to emulate 80 bit floating point. The full x87 doesn't need to be emulated, just add, sub, mul, div, cmp, neg, tst.
[...]
> Is this something that is important? Now DMD has native support for the x87 80-bit floats but is this something worth porting and emulating with other architectures. It's something that I think is going to be hardly used so wouldn't be better to letting the compiler emit an error instead telling the user that 80-bit floats isn't supported?
The keyword here is "cross compiler". Suppose you're compiling on a platform that doesn't have 80-bit floats, but you're targeting x86. You'd want your CTFE float values to match the behavior of 80-bit floats, 'cos otherwise there would be a mismatch between what the compiler computes at compile-time vs. what the program would have produced when run on the target x86 platform.
> Keep in mind that the 80-bit float is like an one off in floating point history. Some other architectures supports 128-bit floats which is more common. I would much rather that we emulate 128-bit floats instead than the 80-bit float.
>
> Also, Intel themselves have more or less deprecated their own x87 in favor of the newer SSE floating point instructions. That leads to the question, shouldn't DMD do the same? Depreciate 80-bit floats?
This is also a valid point. :-P I've also been shying away from 80-bit floats recently because they are slow (80-bit hardware hasn't been improved since decades ago, 'cos nobody is invested in continuing to develop it anymore), and also non-standard (only useful for intermediate computations, not useful for transmission because the target system may not support it -- also, results are peculiar to x86 CPUs and differ from results obtained on other CPUs).
T
--
Time flies like an arrow. Fruit flies like a banana.
|