Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PowerPC's "double-double" format for long double #20579

Open
alexrp opened this issue Jul 10, 2024 · 1 comment
Open

Support for PowerPC's "double-double" format for long double #20579

alexrp opened this issue Jul 10, 2024 · 1 comment
Labels
arch-powerpc 32-bit and 64-bit Power ISA proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone

Comments

@alexrp
Copy link
Member

alexrp commented Jul 10, 2024

Per #10639, f80 was added partially for C long double compatibility and partially to aid the development of Aro.

We need to consider whether Zig should also have language support for the "double-double" format seen on PowerPC systems for long double. Much like f80, this is a legacy format that only really sees use for compatibility reasons. There has been an effort to migrate PowerPC systems to use IEEE binary128 for long double, but to date, this seems to have only manifested on powerpc64le (being a relatively recent target where breaking the world wasn't a huge concern) and for musl (musl requires that long double is IEEE binary64 on all PowerPC targets). In other words, I believe that any big-endian PowerPC system that isn't using musl is still using the "double-double" format.

The Zig type name for this obviously can't be f128 as that's already an IEEE type. f128_ppc? f64_64? Might also be worth considering renaming f80 while we're at it.

Note that I'm not aware of a complete and correct soft float implementation for this format that is liberally licensed. There is a soft float implementation for it in libgcc, but I have no idea how complete or correct it is, and again, there's the license issue to consider. Also, LLVM's APFloat is known to produce wrong results for this format in quite a few ways, despite nominally supporting it.

It's interesting to note that GCC just categorically refuses to constant-fold long double values when targeting PowerPC systems with the "double-double" format. Clang, on the other hand, will happily do it but sometimes get wrong results due to the incomplete APFloat support.

cc @Vexu because I imagine this would also affect Aro on PowerPC in the same way that f80 did.

@Vexu Vexu added proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. arch-powerpc 32-bit and 64-bit Power ISA labels Jul 15, 2024
@Vexu Vexu added this to the 0.15.0 milestone Jul 15, 2024
@alexrp
Copy link
Member Author

alexrp commented Jul 15, 2024

Correction to what I wrote: Apparently only Fedora has made the transition to binary128 long double by default on powerpc64le. Debian/Ubuntu seem to still be using the old format. So, it's unfortunately not quite as "legacy" as one might have hoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-powerpc 32-bit and 64-bit Power ISA proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Projects
None yet
Development

No branches or pull requests

2 participants