[RFC] Appropriate portable data type for IEEE half-precision on C/C++

Jonathan Wakely jwakely.gcc@gmail.com
Fri Mar 12 09:44:44 GMT 2021


On Fri, 12 Mar 2021 at 09:38, Kito Cheng <kito.cheng@gmail.com> wrote:
>
> Hi Jonathan:
>
> > > C++ also has another proposal for extended floating-point types
> > > (https://wg21.link/p1467), which included half-precision types, so in
> > > my understanding, _Float16 won't be a portable typen between C/C++.
> >
> > Why not just make _Float16 available in C++ as a GCC extension?
>
> Not sure it would introduce any ABI issue or not? Especially the function
> name mangling for _Decimal* types, or maybe we could just implement the
> interchanged floating point type (_FloatN) part to C++ is fine?

I would forget about the decimal types. I thought you were just
talking about _Float16?

You will need to decide on a mangling for it in C++, which should be
co-ordinated with other compilers that are likely to support the type.
You could mangle it as "u8_Float16" which is in the namespace reserved
for vendor-extensions but if you wanted to assign a new shorter,
non-extension then it should be discussed at
https://github.com/itanium-cxx-abi/cxx-abi/issues (which will need to
happen anyway if std::float16 is expected to go into the C++
standard).

Are you planning to support this in Clang too?


More information about the Gcc mailing list