[Bug c++/109924] missing __builtin_nanf16b

2023-06-03 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #4 from Jakub Jelinek  ---
I certainly don't see that stated there anywhere.
Furthermore, _Float16 and __bf16 are nothing but normal FP types, there is to
this date no C library support for those formats, and at least for the latter
the only hw support which appears are better or worse instructions to convert
those to float and back.
So, bfloat16_t support is really done using float math library functions and
builtins,
and as I said the only builtins which were added were the really required one
to be able to constexpr evaluate what C++23 mandates.

[Bug c++/109924] missing __builtin_nanf16b

2023-06-03 Thread g.peterhoff--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

--- Comment #3 from g.peterh...@t-online.de ---
But in your documentation
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html it is stated that the
__builtin's would be available for all FP types.

For upcoming standards https://en.cppreference.com/w/c/experimental/fpext1 this
is needed anyway (setpayload etc.)

thx
Gero

[Bug c++/109924] missing __builtin_nanf16b

2023-05-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

--- Comment #2 from Jonathan Wakely  ---
You should just use std::numeric_limits::quiet_NaN() instead
of a non-standard, non-portable, non-existent built-in.

[Bug c++/109924] missing __builtin_nanf16b

2023-05-21 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
Why do you need that?
The std::bfloat16_t builtins are intentionally limited to only what is really
required, there is no support in libc for that type whatever and only minimum
needed in libgcc.
A quiet NaN can be created as (decltype (0.0bf16)) __builtin_nanf ("") etc.
The reason there is __builtin_nansf16b builtin is that the above doesn't really
work for signalling NaNs, as on the cast an exception is emitted and the sNaN
turned into a qNaN.
Similarly, there is __builtin_nextafterf16b builtin so that this operation can
be folded for constexpr.  Most other operations on bfloat16_t as can be seen on
the libstdc++ implementation or even what gcc emits for such arithmetics on the
type is promote to std::float32_t, perform operation in the wider mode and then
cast back (and the fact that the compiler implements excess precision for that
type).