On Thu, Jun 24, 2021 at 03:11:01PM +0100, Jonathan Wakely wrote: > On Thu, 24 Jun 2021 at 15:08, Jakub Jelinek wrote: > > > > On Thu, Jun 24, 2021 at 04:01:34PM +0200, Matthias Kretz wrote: > > > --- a/libstdc++-v3/include/experimental/bits/simd.h > > > +++ b/libstdc++-v3/include/experimental/bits/simd.h > > > @@ -1598,7 +1598,9 @@ template <typename _To, typename _From> > > > _GLIBCXX_SIMD_INTRINSIC constexpr _To > > > __bit_cast(const _From __x) > > > { > > > - // TODO: implement with / replace by __builtin_bit_cast ASAP > > > +#if __has_builtin(__builtin_bit_cast) > > > > Shouldn't that use #if _GLIBCXX_HAS_BUILTIN(__builtin_bit_cast) in > > c++config to define a new macro and use that macro here? > > Though it is true that c++config already uses > > #if __has_builtin(__builtin_is_constant_evaluated) > > and so would fail miserably for compilers that don't support __has_builtin > > GCC was the last of our supported compilers to implement > __has_builtin, so for GCC trunk we can assume that it's always > supported.
We don't support mixing GCC and libstdc++ versions, so I'm not worried about GCC. At least according to godbolt, already clang 3.0 supports it which is 10 years old, so probably fine too, but ICC 19.0/19.1 still doesn't support it, only ICC 2021 does. And ICC 19.1 seems to be released in October 2020. So, wouldn't it be better not to #undef _GLIBCXX_HAS_BUILTIN, move its definition a little bit earlier and use it also for __builtin_is_constant_evaluated? Jakub