public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109924] New: missing __builtin_nanf16b
@ 2023-05-21 10:29 g.peterhoff@t-online.de
  2023-05-21 15:00 ` [Bug c++/109924] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: g.peterhoff@t-online.de @ 2023-05-21 10:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

            Bug ID: 109924
           Summary: missing __builtin_nanf16b
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: g.peterhoff@t-online.de
  Target Milestone: ---

like __builtin_nansf16b

regards
Gero

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/109924] missing __builtin_nanf16b
  2023-05-21 10:29 [Bug c++/109924] New: missing __builtin_nanf16b g.peterhoff@t-online.de
@ 2023-05-21 15:00 ` jakub at gcc dot gnu.org
  2023-05-22  8:59 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-21 15:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/109924] missing __builtin_nanf16b
  2023-05-21 10:29 [Bug c++/109924] New: missing __builtin_nanf16b g.peterhoff@t-online.de
  2023-05-21 15:00 ` [Bug c++/109924] " jakub at gcc dot gnu.org
@ 2023-05-22  8:59 ` redi at gcc dot gnu.org
  2023-06-03 14:23 ` g.peterhoff@t-online.de
  2023-06-03 15:13 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-22  8:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
You should just use std::numeric_limits<std::bfloat16_t>::quiet_NaN() instead
of a non-standard, non-portable, non-existent built-in.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/109924] missing __builtin_nanf16b
  2023-05-21 10:29 [Bug c++/109924] New: missing __builtin_nanf16b g.peterhoff@t-online.de
  2023-05-21 15:00 ` [Bug c++/109924] " jakub at gcc dot gnu.org
  2023-05-22  8:59 ` redi at gcc dot gnu.org
@ 2023-06-03 14:23 ` g.peterhoff@t-online.de
  2023-06-03 15:13 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: g.peterhoff@t-online.de @ 2023-06-03 14:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

--- Comment #3 from g.peterhoff@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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/109924] missing __builtin_nanf16b
  2023-05-21 10:29 [Bug c++/109924] New: missing __builtin_nanf16b g.peterhoff@t-online.de
                   ` (2 preceding siblings ...)
  2023-06-03 14:23 ` g.peterhoff@t-online.de
@ 2023-06-03 15:13 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-06-03 15:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109924

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-03 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-21 10:29 [Bug c++/109924] New: missing __builtin_nanf16b g.peterhoff@t-online.de
2023-05-21 15:00 ` [Bug c++/109924] " jakub at gcc dot gnu.org
2023-05-22  8:59 ` redi at gcc dot gnu.org
2023-06-03 14:23 ` g.peterhoff@t-online.de
2023-06-03 15:13 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).