Skip to content

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

Open
@alexrp

Description

@alexrp

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? f128p (for "paired")?

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, to the point of violating the C/C++ standards. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-powerpc32-bit and 64-bit Power ISAproposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions