On Sun, 16 Oct 2022 at 11:23, Jakub Jelinek <ja...@redhat.com> wrote: > > Hi! > > As the __bf16 support is now in at least on x86_64/i686, I've > updated my patch to cover bfloat16_t as well and implemented almost > everything for <cmath> - the only thing missing I'm aware of is > std::nextafter std::float16_t and std::bfloat16_t overloads (I think > we probably need to implement that out of line somewhere, or inline? - might > need inline asm barriers) and std::nexttoward overloads (those are > intentional, you said there is a LWG issue about that).
Yes, that's now https://cplusplus.github.io/LWG/issue3790 The current proposed resolution is to just restore the C++20 functions and not provide anything for the new types. > If you want to have <cmath> done in a different way, e.g. the patch > groups a lot of different function overloads by the floating point type, > is that ok or do you want to have them one function at a time for all types, > then next? No, I think this way makes more sense. Otherwise the line count in the file will baloon with all the repeated #if #endif directives. The only comment I have about the <cmath> changes is that I think all the new functions should be just 'constexpr' not 'inline _GLIBCXX_CONSTEXPR'. The __STDCPP_FLOATN__ macros are only defined for C++23, right? So _GLIBCXX_CONSTEXPR is always just 'constexpr' (it's only something different for C++98), and that already implies 'inline' too. So just: constexpr _Float16 log10(_Float16 __x) { return _Float16(__builtin_log10f(__x)); } > I could try to handle <complex> too, but am kind of lost there. > The paper dropped the explicit std::complex specializations, can they stay > around as is and should new overloads be added for the > _Float*/__gnu_cxx::__bfloat16_t types? The explicit specializations can stay, they do no harm. I think to handle the new FP types we can modify the primary template as shown in P1467. I don't think we'll need to add any new function overloads for the new types. I can take care of the <complex> changes. > And I/O etc. support is missing, not sure I'm able to handle that and if it > is e.g. possible to keep that support out of libstdc++.so.6, because what > extended floating point types one has on a particular arch could change over > time (I mean e.g. bfloat16_t support or float16_t support can be added > etc.). Yes, I think we can add the I/O functions as always_inline because all they're going to do is convert the argument to float, double, or long double and then call the existing overloads. There will be no new virtual functions. I can take care of that too. > --- libstdc++-v3/include/bits/c++config.jj 2022-05-23 21:44:49.082847038 > +0200 > +++ libstdc++-v3/include/bits/c++config 2022-10-14 22:32:55.411346463 +0200 > @@ -1,4 +1,4 @@ > -// Predefined symbols and macros -*- C++ -*- > + // Predefined symbols and macros -*- C++ -*- This whitespace change looks accidental. Apart from that and simplifying 'inline _GLIBCXX_CONSTEXPR' to just 'constexpr' this looks good for trunk.