llvm / llvm/llvm-project

Support `__float128` on Hexagon

Open
#198,298 1 comment 0 reactions 1 assignee Claimed by @SundeepKushwaha View on GitHub
ABI backend:Hexagon clang floating-point
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Excerpt from an email I sent to @androm3da:

> We've been working towards migrating much of the C code we bundle (as part of musl, mingw, etc) to Zig code: https://codeberg.org/ziglang/zig/issues/30978
>
> As part of that effort, we've decided that we would like to also define our own, separate libc API/ABI. Think `hexagon-linux-zig` and so on. There we'd have the freedom to break with some unfortunate legacy in the major libcs, and maybe even try to innovate a little bit...
>
> One thing we'd *really* like to do as part of that is to unify the crazy landscape of C data type sizes, alignments, and formats. This is straightforward on most targets, but there's a wrinkle on Hexagon: `__float128` is not supported, and in the regular ABI, `sizeof(long double) == 8`. So while we could say that `long double` is binary128 in our ABI and we could easily make Clang agree with that, we'd be walking into uncharted territory as far as the calling convention is concerned.
>
> So the question is: Would you guys be on board with specifying `__float128` semantics in the Hexagon psABI and enabling the type in Clang? That way, even though the regular Hexagon ABI would still use binary64 for `long double`, we could define it as binary128 in our ABI without accidentally creating non-standard calling convention rules.
>
> To be clear, I imagine `__float128` would just follow the usual rules for types > 64 bits, but since it's a basic data type, I think it's still good to just mention it in the psABI if only because it removes any doubt.
>
> (Incidentally, it would probably also be good to specify `_Float16` in the psABI since Clang has supported that on Hexagon for a while now.)

Filing here to track.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.