On Wed, Nov 05, 2025 at 10:34:37AM +0100, Jakub Jelinek wrote:
> On Wed, Nov 05, 2025 at 03:48:46AM -0500, Michael Meissner wrote:
> > This set of patches is a request for comments (RFC) on the support to
> > add 16-bit floating point support to the GCC 16 PowerPC.  In GCC 16, I
> > anticipate this will be listed as an experimental feature, to allow
> > the code to be refined by the time GCC 17 ships.
> > 
> > There are 2 popular 16-bit floating point formats.
> 
> One thing I'm missing in the patchset is libstdc++-v3 part of this.
> I assume that with -mfloat16 -std=c++23 g++ will predefine the
> __STDCPP_FLOAT16_T__ and __STDCPP_BFLOAT16_T__ macros (some g++.target/powerpc
> test should test that), so that enables all of libstdc++ std::float16_t
> and std::bfloat16_t support.

I have a patch that isn't part of the current set (but hopefully will
be) that adds a configuration option to enable the 16-bit types by
default and another to disable the call/return warning.

If I enable __bfloat16_t, I can't build libstdc++ because
include/limits uses __builtin_nansfb16, which I haven't added yet, and
I have debugged why it isn't added automatically.

My patch uses __builtin_nansf and converts it, much like a few lines
earlier, the include file limit used __builtn_nanf and converts it to
__bfloat16.

> Now, for <charconv> std::from_chars and std::to_chars overloads the
> __{from,to}_chars_{,b}float16_t helper functions are exported from libstdc++
> for some years already whenever _Float32 is defined (i.e. when float is IEEE
> single) at some older symbol version (because those functions just use float
> rather than _Float16 or decltype (1.0bf16) types in their ABI).
> But _ZTI{,P,PK}DF16{_,b} symbols needed for std::float16_t and
> std::bfloat16_t RTTI are presumably not exported from libstdc++ and would be
> when libstdc++ is built with -mfloat16 and are actually needed in this
> patchset even when libstdc++ isn't built with that option, because code
> built with -mfloat16 -std=c++23 can use typeid (std::float16_t) or
> typeid (std::bfloat16_t) etc.

Ok.  Is there a test for these issues that I can run before submission?

> But it needs to be exported with the right symbol version (if it is
> introduced in GCC 16, then CXXABI_1.3.17 rather than CXXABI_1.3.14 or not at
> all), because it wasn't available in GCC 13.
> Partly see https://gcc.gnu.org/PR118563 , but in this case for PowerPC you
> actually need more than that, it is not about just the _ZTI{,P,PK}DF16b
> symbols, but also _ZTI{,P,PK}DF16_, and I guess you also need to arrange
> for libstdc++-v3/libsupc++/fundamental_type_info.cc being compiled with
> -mfloat16 on PowerPC.

Ok, thanks for the heads up.

-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: [email protected]

Reply via email to