// Distributed under the Boost Software License Version 1.0 https://www.boost.org/LICENSE_1_0.txt // Copyright Gero Peterhoff #ifndef BOOST_TYPE_TRAITS_IS_NATIVE_HPP #define BOOST_TYPE_TRAITS_IS_NATIVE_HPP #include #include #include #include namespace boost { template struct is_native : public std::false_type{}; template struct is_native : public is_native{}; template struct is_native : public is_native{}; template struct is_native : public is_native{}; #if !defined(BOOST_NO_INT128_T) template <> struct is_native : public std::integral_constant= 128)>{}; template <> struct is_native : public std::integral_constant= 128)>{}; #endif #if !defined(BOOST_NO_INT64_T) template <> struct is_native : public std::integral_constant= 64)>{}; template <> struct is_native : public std::integral_constant= 64)>{}; #endif #if !defined(BOOST_NO_INT32_T) template <> struct is_native : public std::integral_constant= 32)>{}; template <> struct is_native : public std::integral_constant= 32)>{}; #endif #if !defined(BOOST_NO_INT16_T) template <> struct is_native : public std::integral_constant= 16)>{}; template <> struct is_native : public std::integral_constant= 16)>{}; #endif #if !defined(BOOST_NO_INT8_T) template <> struct is_native : public std::integral_constant= 8)>{}; template <> struct is_native : public std::integral_constant= 8)>{}; #endif #if !defined(BOOST_NO_FLOAT128_T) template <> struct is_native : public std::integral_constant < bool, // todo correct/complete ? // todo riscv Q subset #if defined(BOOST_ARCH_Z_AVAILABLE) || \ defined(BOOST_ARCH_PARISC_AVAILABLE) || \ defined(BOOST_ARCH_SYS390_AVAILABLE) || \ defined(BOOST_ARCH_RISCV_AVAILABLE) || \ (defined(BOOST_ARCH_SPARC_AVAILABLE) && (BOOST_ARCH_SPARC >= 8)) true #else false #endif > {}; #endif #if !defined(BOOST_NO_FLOAT80_T) template <> struct is_native : public std::integral_constant < bool, // todo only x86-HW ? #if defined(BOOST_ARCH_X86_AVAILABLE) true #else false #endif > {}; #endif #if !defined(BOOST_NO_FLOAT64_T) template <> struct is_native : public std::integral_constant{}; #endif #if !defined(BOOST_NO_FLOAT32_T) template <> struct is_native : public std::integral_constant{}; #endif #if !defined(BOOST_NO_FLOAT16_T) template <> struct is_native : public std::integral_constant{}; #endif #if defined(__STDCPP_FLOAT128_T__) template <> struct is_native : public std::integral_constant < bool, // todo correct/complete ? // todo riscv Q subset #if defined(BOOST_ARCH_Z_AVAILABLE) || \ defined(BOOST_ARCH_PARISC_AVAILABLE) || \ defined(BOOST_ARCH_SYS390_AVAILABLE) || \ defined(BOOST_ARCH_RISCV_AVAILABLE) || \ (defined(BOOST_ARCH_SPARC_AVAILABLE) && (BOOST_ARCH_SPARC >= 8)) true #else false #endif > {}; #endif #if defined(__STDCPP_FLOAT32_T__) template <> struct is_native : public std::integral_constant{}; #endif #if defined(__STDCPP_FLOAT32_T__) template <> struct is_native : public std::integral_constant{}; #endif #if defined(__STDCPP_BFLOAT16_T__) template <> struct is_native : public std::integral_constant < bool, // todo no known HW // __AVX512BF16__ contains only conversions and no arithmetic operations // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#avx512techs=AVX512_BF16 false > {}; #endif #if defined(__STDCPP_FLOAT16_T__) template <> struct is_native : public std::integral_constant < bool, // todo correct/complete ? // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#avx512techs=AVX512_FP16 #if defined(__AVX512FP16__) || \ (defined(BOOST_ARCH_ARM_AVAILABLE) && (BOOST_ARCH_ARM >= 8)) true #else false #endif > {}; #endif #if defined(__cpp_unicode_characters) template <> struct is_native : public std::integral_constant= 32)>{}; template <> struct is_native : public std::integral_constant= 16)>{}; #endif #if defined(__cpp_char8_t) template <> struct is_native : public std::integral_constant= 8)>{}; #endif template <> struct is_native : public std::integral_constant < bool, (sizeof(wchar_t) == 4) ? (__WORDSIZE >= 32) : (__WORDSIZE >= 16) > {}; template <> struct is_native : public std::integral_constant= 8)>{}; #if !defined(BOOST_NO_CXX17_INLINE_VARIABLES) template inline constexpr bool is_native_v = is_native::value; #endif } // boost #endif // BOOST_TYPE_TRAITS_IS_NATIVE_HPP