diff --git a/.github/workflows/cxx-versions.yml b/.github/workflows/cxx-versions.yml index e6b8a2f01..5ec2f0768 100644 --- a/.github/workflows/cxx-versions.yml +++ b/.github/workflows/cxx-versions.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - cxx-version: [11, 14, 17, 20] + cxx-version: [14, 17, 20] steps: - uses: actions/checkout@v3 - name: Install dependencies diff --git a/README.md b/README.md index 0ff4ad6e6..9b7861210 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ The mathematical functions are a lightweight implementation of the algorithms or ## Requirements -`xsimd` requires a C++11 compliant compiler. The following C++ compilers are supported: +`xsimd` requires a C++14 compliant compiler. The following C++ compilers are supported: Compiler | Version ------------------------|------------------------------- diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 8cfad36c0..732d8d7b7 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -35,19 +35,18 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" endif() if(NOT MSVC) - CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_CPP11_FLAG) if (ENABLE_XTL_COMPLEX) - CHECK_CXX_COMPILER_FLAG("-std=c++14" HAS_CPP14_FLAG) - if (NOT HAS_CPP14_FLAG) - message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++14 support when xtl complex support is enabled") + CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP17_FLAG) + if (NOT HAS_CPP17_FLAG) + message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++17 support when xtl complex support is enabled") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") else() - CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_CPP11_FLAG) - if (NOT HAS_CPP11_FLAG) - message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++11 support!") + CHECK_CXX_COMPILER_FLAG("-std=c++14" HAS_CPP14_FLAG) + if (NOT HAS_CPP14_FLAG) + message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++14 support!") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") endif() endif() endif() diff --git a/docs/source/index.rst b/docs/source/index.rst index e6f0fcf40..ac24da463 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -69,7 +69,7 @@ The following SIMD instruction set extensions are supported: +--------------+---------------------------------------------------------+ -`xsimd` requires a C++11 compliant compiler. The following C++ compilers are supported: +`xsimd` requires a C++14 compliant compiler. The following C++ compilers are supported: +-------------------------+-------------------------------+ | Compiler | Version | diff --git a/examples/pico_bench.hpp b/examples/pico_bench.hpp index b948cfbf5..727f5e35e 100644 --- a/examples/pico_bench.hpp +++ b/examples/pico_bench.hpp @@ -202,16 +202,14 @@ namespace pico_bench } template - typename std::enable_if()())>::value, - stats_type>::type + std::enable_if_t()())>::value, stats_type> operator()(Fn fn) const { return (*this)(BenchWrapper { fn }); } template - typename std::enable_if()()), T>::value, - stats_type>::type + std::enable_if_t()()), T>::value, stats_type> operator()(Fn fn) const { // Do a single un-timed warm up run diff --git a/include/xsimd/arch/common/xsimd_common_arithmetic.hpp b/include/xsimd/arch/common/xsimd_common_arithmetic.hpp index f7c3ad524..ff2fb4118 100644 --- a/include/xsimd/arch/common/xsimd_common_arithmetic.hpp +++ b/include/xsimd/arch/common/xsimd_common_arithmetic.hpp @@ -28,14 +28,14 @@ namespace xsimd using namespace types; // bitwise_lshift - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept { return x << y; }, self, other); } - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE batch bitwise_lshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -44,14 +44,14 @@ namespace xsimd } // bitwise_rshift - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept { return x >> y; }, self, other); } - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -74,7 +74,7 @@ namespace xsimd } // div - template ::value>::type> + template ::value>> XSIMD_INLINE batch div(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T @@ -169,7 +169,7 @@ namespace xsimd } // mul - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T @@ -213,7 +213,7 @@ namespace xsimd { return add(self, other); // no saturated arithmetic on floating point numbers } - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -241,7 +241,7 @@ namespace xsimd { return sub(self, other); // no saturated arithmetic on floating point numbers } - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) diff --git a/include/xsimd/arch/common/xsimd_common_details.hpp b/include/xsimd/arch/common/xsimd_common_details.hpp index 2c8adc97d..efe01806b 100644 --- a/include/xsimd/arch/common/xsimd_common_details.hpp +++ b/include/xsimd/arch/common/xsimd_common_details.hpp @@ -95,7 +95,7 @@ namespace xsimd template XSIMD_INLINE batch sqrt(batch const& self) noexcept; template - XSIMD_INLINE typename std::enable_if::value, batch>::type + XSIMD_INLINE std::enable_if_t::value, batch> swizzle(batch const& x, batch_constant mask) noexcept; template XSIMD_INLINE batch tan(batch const& self) noexcept; diff --git a/include/xsimd/arch/common/xsimd_common_logical.hpp b/include/xsimd/arch/common/xsimd_common_logical.hpp index 69ab75305..83e9a9f11 100644 --- a/include/xsimd/arch/common/xsimd_common_logical.hpp +++ b/include/xsimd/arch/common/xsimd_common_logical.hpp @@ -116,7 +116,7 @@ namespace xsimd } // isinf - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool isinf(batch const&, requires_arch) noexcept { return batch_bool(false); @@ -143,7 +143,7 @@ namespace xsimd } // isfinite - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool isfinite(batch const&, requires_arch) noexcept { return batch_bool(true); @@ -160,14 +160,14 @@ namespace xsimd } // isnan - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool isnan(batch const&, requires_arch) noexcept { return batch_bool(false); } // le - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return (self < other) || (self == other); @@ -220,7 +220,7 @@ namespace xsimd using is_batch_bool_register_same = std::is_same::register_type, typename batch::register_type>; } - template ::value, int>::type = 3> + template ::value, int> = 3> XSIMD_INLINE batch_bool select(batch_bool const& cond, batch_bool const& true_br, batch_bool const& false_br, requires_arch) { using register_type = typename batch_bool::register_type; @@ -230,7 +230,7 @@ namespace xsimd return batch_bool { select(cond, true_v, false_v) }; } - template ::value, int>::type = 3> + template ::value, int> = 3> XSIMD_INLINE batch_bool select(batch_bool const& cond, batch_bool const& true_br, batch_bool const& false_br, requires_arch) { return (true_br & cond) | (bitwise_andnot(false_br, cond)); diff --git a/include/xsimd/arch/common/xsimd_common_math.hpp b/include/xsimd/arch/common/xsimd_common_math.hpp index 75d4f1096..f84883405 100644 --- a/include/xsimd/arch/common/xsimd_common_math.hpp +++ b/include/xsimd/arch/common/xsimd_common_math.hpp @@ -60,7 +60,7 @@ namespace xsimd // Inspired by // https://stackoverflow.com/questions/5697500/take-the-average-of-two-signed-numbers-in-c auto t = (x & y) + ((x ^ y) >> 1); - auto t_u = bitwise_cast::type>(t); + auto t_u = bitwise_cast>(t); auto avg = t + (bitwise_cast(t_u >> (8 * sizeof(T) - 1)) & (x ^ y)); return avg; } @@ -286,7 +286,7 @@ namespace xsimd } // copysign - template ::value>::type> + template ::value>> XSIMD_INLINE batch copysign(batch const& self, batch const& other, requires_arch) noexcept { return abs(self) | bitofsign(other); @@ -613,7 +613,7 @@ namespace xsimd } template - XSIMD_INLINE B eval(::xsimd::detail::index_sequence, const Tuple& tuple) + XSIMD_INLINE B eval(std::index_sequence, const Tuple& tuple) { return estrin { x * x }(std::get(tuple)...); } @@ -621,7 +621,7 @@ namespace xsimd template XSIMD_INLINE B eval(const std::tuple& tuple) noexcept { - return eval(::xsimd::detail::make_index_sequence(), tuple); + return eval(std::make_index_sequence(), tuple); } template @@ -1877,7 +1877,7 @@ namespace xsimd } // mod - template ::value>::type> + template ::value>> XSIMD_INLINE batch mod(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T @@ -1886,7 +1886,7 @@ namespace xsimd } // nearbyint - template ::value>::type> + template ::value>> XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept { return self; @@ -1926,7 +1926,7 @@ namespace xsimd } // nearbyint_as_int - template ::value>::type> + template ::value>> XSIMD_INLINE batch nearbyint_as_int(batch const& self, requires_arch) noexcept { return self; @@ -2088,7 +2088,7 @@ namespace xsimd } // reciprocal - template ::value>::type> + template ::value>> XSIMD_INLINE batch reciprocal(batch const& self, requires_arch) noexcept { @@ -2103,7 +2103,7 @@ namespace xsimd return { reduce_add(self.real()), reduce_add(self.imag()) }; } - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { alignas(A::alignment()) T buffer[batch::size]; @@ -2175,7 +2175,7 @@ namespace xsimd return res; } - template ::value>::type*/> + template ::value>*/> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { alignas(A::alignment()) T buffer[batch::size]; @@ -2199,7 +2199,7 @@ namespace xsimd { return fnma(nearbyint(self / other), other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept { auto mod = self % other; @@ -2214,7 +2214,7 @@ namespace xsimd } // sign - template ::value>::type> + template ::value>> XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept { using batch_type = batch; @@ -2260,7 +2260,7 @@ namespace xsimd } // signnz - template ::value>::type> + template ::value>> XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept { using batch_type = batch; diff --git a/include/xsimd/arch/common/xsimd_common_memory.hpp b/include/xsimd/arch/common/xsimd_common_memory.hpp index 2d4f1515f..6a301dd44 100644 --- a/include/xsimd/arch/common/xsimd_common_memory.hpp +++ b/include/xsimd/arch/common/xsimd_common_memory.hpp @@ -63,7 +63,7 @@ namespace xsimd namespace detail { template - XSIMD_INLINE batch create_compress_swizzle_mask(I bitmask, ::xsimd::detail::index_sequence) + XSIMD_INLINE batch create_compress_swizzle_mask(I bitmask, std::index_sequence) { batch swizzle_mask(IT(0)); alignas(A::alignment()) IT mask_buffer[batch::size] = { Is... }; @@ -84,7 +84,7 @@ namespace xsimd constexpr std::size_t size = batch_bool::size; auto bitmask = mask.mask(); auto z = select(mask, x, batch((T)0)); - auto compress_mask = detail::create_compress_swizzle_mask(bitmask, ::xsimd::detail::make_index_sequence()); + auto compress_mask = detail::create_compress_swizzle_mask(bitmask, std::make_index_sequence()); return swizzle(z, compress_mask); } @@ -136,14 +136,14 @@ namespace xsimd namespace detail { // Not using XSIMD_INLINE here as it makes msvc hand got ever on avx512 - template ::type = 0> + template = 0> inline batch gather(U const* src, batch const& index, ::xsimd::index I) noexcept { return insert(batch {}, static_cast(src[index.get(I)]), I); } - template ::type = 0> + template = 0> inline batch gather(U const* src, batch const& index, ::xsimd::index I) noexcept { @@ -222,7 +222,7 @@ namespace xsimd } template - XSIMD_INLINE auto get(batch, A> const& self, ::xsimd::index, requires_arch) noexcept -> typename batch, A>::value_type + XSIMD_INLINE typename batch, A>::value_type get(batch, A> const& self, ::xsimd::index, requires_arch) noexcept { alignas(A::alignment()) T buffer[batch, A>::size]; self.store_aligned(&buffer[0]); @@ -246,7 +246,7 @@ namespace xsimd } template - XSIMD_INLINE auto get(batch, A> const& self, std::size_t i, requires_arch) noexcept -> typename batch, A>::value_type + XSIMD_INLINE typename batch, A>::value_type get(batch, A> const& self, std::size_t i, requires_arch) noexcept { using T2 = typename batch, A>::value_type; alignas(A::alignment()) T2 buffer[batch, A>::size]; @@ -268,7 +268,7 @@ namespace xsimd } template - XSIMD_INLINE auto first(batch, A> const& self, requires_arch) noexcept -> typename batch, A>::value_type + XSIMD_INLINE typename batch, A>::value_type first(batch, A> const& self, requires_arch) noexcept { return { first(self.real(), A {}), first(self.imag(), A {}) }; } @@ -397,7 +397,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, batch>::type + XSIMD_INLINE std::enable_if_t::value, batch> load_masked(int64_t const* mem, batch_bool_constant, convert, Mode, requires_arch) noexcept { const auto d = load_masked(reinterpret_cast(mem), batch_bool_constant {}, convert {}, Mode {}, A {}); @@ -405,7 +405,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, batch>::type + XSIMD_INLINE std::enable_if_t::value, batch> load_masked(uint64_t const* mem, batch_bool_constant, convert, Mode, requires_arch) noexcept { const auto d = load_masked(reinterpret_cast(mem), batch_bool_constant {}, convert {}, Mode {}, A {}); @@ -425,14 +425,14 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, void>::type + XSIMD_INLINE std::enable_if_t::value> store_masked(int64_t* mem, batch const& src, batch_bool_constant, Mode, requires_arch) noexcept { store_masked(reinterpret_cast(mem), bitwise_cast(src), batch_bool_constant {}, Mode {}, A {}); } template - XSIMD_INLINE typename std::enable_if::value, void>::type + XSIMD_INLINE std::enable_if_t::value> store_masked(uint64_t* mem, batch const& src, batch_bool_constant, Mode, requires_arch) noexcept { store_masked(reinterpret_cast(mem), bitwise_cast(src), batch_bool_constant {}, Mode {}, A {}); @@ -483,7 +483,7 @@ namespace xsimd // Scatter with runtime indexes. namespace detail { - template ::type = 0> + template = 0> XSIMD_INLINE void scatter(batch const& src, U* dst, batch const& index, ::xsimd::index I) noexcept @@ -491,7 +491,7 @@ namespace xsimd dst[index.get(I)] = static_cast(src.get(I)); } - template ::type = 0> + template = 0> XSIMD_INLINE void scatter(batch const& src, U* dst, batch const& index, ::xsimd::index I) noexcept @@ -829,7 +829,7 @@ namespace xsimd } // transpose - template ::size == 8>::type> + template ::size == 8>> XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept { assert((matrix_end - matrix_begin == batch::size) && "correctly sized matrix"); @@ -873,7 +873,7 @@ namespace xsimd transpose(reinterpret_cast*>(matrix_begin), reinterpret_cast*>(matrix_end), A {}); } - template ::size == 16>::type> + template ::size == 16>> XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept { assert((matrix_end - matrix_begin == batch::size) && "correctly sized matrix"); diff --git a/include/xsimd/arch/common/xsimd_common_rounding.hpp b/include/xsimd/arch/common/xsimd_common_rounding.hpp index 251a9f819..af2a5c2a7 100644 --- a/include/xsimd/arch/common/xsimd_common_rounding.hpp +++ b/include/xsimd/arch/common/xsimd_common_rounding.hpp @@ -49,7 +49,7 @@ namespace xsimd } // trunc - template ::value>::type> + template ::value>> XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept { return self; diff --git a/include/xsimd/arch/common/xsimd_common_swizzle.hpp b/include/xsimd/arch/common/xsimd_common_swizzle.hpp index 535f1bf74..5f51aaf9b 100644 --- a/include/xsimd/arch/common/xsimd_common_swizzle.hpp +++ b/include/xsimd/arch/common/xsimd_common_swizzle.hpp @@ -54,11 +54,11 @@ namespace xsimd // ──────────────────────────────────────────────────────────────────────── // dup_lo_impl template ::type = 0> + T... Vs, std::enable_if_t = 0> XSIMD_INLINE constexpr bool dup_lo_impl() noexcept { return true; } template ::type = 0> + T... Vs, std::enable_if_t<(I < N / 2), int> = 0> XSIMD_INLINE constexpr bool dup_lo_impl() noexcept { return get_at::value < static_cast(N / 2) @@ -69,11 +69,11 @@ namespace xsimd // ──────────────────────────────────────────────────────────────────────── // dup_hi_impl template ::type = 0> + T... Vs, std::enable_if_t = 0> XSIMD_INLINE constexpr bool dup_hi_impl() noexcept { return true; } template ::type = 0> + T... Vs, std::enable_if_t<(I < N / 2), int> = 0> XSIMD_INLINE constexpr bool dup_hi_impl() noexcept { return get_at::value >= static_cast(N / 2) diff --git a/include/xsimd/arch/common/xsimd_common_trigo.hpp b/include/xsimd/arch/common/xsimd_common_trigo.hpp index dedfd3982..7f90cc559 100644 --- a/include/xsimd/arch/common/xsimd_common_trigo.hpp +++ b/include/xsimd/arch/common/xsimd_common_trigo.hpp @@ -158,7 +158,7 @@ namespace xsimd */ namespace detail { - template ::value>::type> + template ::value>> XSIMD_INLINE batch average(const batch& x1, const batch& x2) noexcept { diff --git a/include/xsimd/arch/xsimd_avx.hpp b/include/xsimd/arch/xsimd_avx.hpp index 66ef31bf4..27f14b505 100644 --- a/include/xsimd/arch/xsimd_avx.hpp +++ b/include/xsimd/arch/xsimd_avx.hpp @@ -115,7 +115,7 @@ namespace xsimd } // add - template ::value>::type> + template ::value>> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -144,7 +144,7 @@ namespace xsimd { return _mm256_testc_pd(self, batch_bool(true)) != 0; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool all(batch_bool const& self, requires_arch) noexcept { return _mm256_testc_si256(self, batch_bool(true)) != 0; @@ -161,7 +161,7 @@ namespace xsimd { return !_mm256_testz_pd(self, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE bool any(batch_bool const& self, requires_arch) noexcept { return !_mm256_testz_si256(self, self); @@ -197,14 +197,14 @@ namespace xsimd return _mm256_and_pd(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept { return bitwise_and(batch(s), batch(o)); }, self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_and(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -235,14 +235,14 @@ namespace xsimd return _mm256_andnot_pd(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept { return bitwise_andnot(batch(s), batch(o)); }, self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_andnot(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -251,7 +251,7 @@ namespace xsimd } // bitwise_lshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, int32_t o) noexcept @@ -260,14 +260,14 @@ namespace xsimd } // bitwise_not - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s) noexcept { return bitwise_not(batch(s), sse4_2 {}); }, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_not(batch_bool const& self, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s) noexcept @@ -296,14 +296,14 @@ namespace xsimd { return _mm256_or_pd(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept { return bitwise_or(batch(s), batch(o)); }, self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_or(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -312,7 +312,7 @@ namespace xsimd } // bitwise_rshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, int32_t o) noexcept @@ -341,14 +341,14 @@ namespace xsimd { return _mm256_xor_pd(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept { return bitwise_xor(batch(s), batch(o), sse4_2 {}); }, self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -357,17 +357,17 @@ namespace xsimd } // bitwise_cast - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castsi256_ps(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castsi256_pd(self); } - template ::type>::value>::type> + template >::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return batch(self.data); @@ -377,7 +377,7 @@ namespace xsimd { return _mm256_castps_pd(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castps_si256(self); @@ -387,7 +387,7 @@ namespace xsimd { return _mm256_castpd_ps(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castpd_si256(self); @@ -416,7 +416,7 @@ namespace xsimd } // broadcast - template ::value>::type> + template ::value>> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -535,7 +535,7 @@ namespace xsimd } // decr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self + batch(mask.data); @@ -574,7 +574,7 @@ namespace xsimd { return ~(self != other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -582,7 +582,7 @@ namespace xsimd self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return ~(self != other); @@ -637,7 +637,7 @@ namespace xsimd assert(!(mask & ~0xFul) && "inbound mask"); return _mm256_castsi256_pd(_mm256_load_si256((const __m256i*)lut64[mask])); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool from_mask(batch_bool const&, uint64_t mask, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -742,14 +742,14 @@ namespace xsimd } // incr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self - batch(mask.data); } // insert - template ::value>::type> + template ::value>> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { #if !defined(_MSC_VER) || _MSC_VER > 1900 @@ -798,7 +798,7 @@ namespace xsimd } // load_aligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return _mm256_load_si256((__m256i const*)mem); @@ -856,7 +856,7 @@ namespace xsimd } // load_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return _mm256_loadu_si256((__m256i const*)mem); @@ -914,7 +914,7 @@ namespace xsimd } // load_masked (single overload for float/double) - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { using int_t = as_integer_t; @@ -994,7 +994,7 @@ namespace xsimd return _mm256_cmp_pd(self, other, _CMP_LT_OQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -1003,7 +1003,7 @@ namespace xsimd } // mask - template ::value>::type> + template ::value>> XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1 || sizeof(T) == 2) @@ -1048,7 +1048,7 @@ namespace xsimd { return _mm256_max_pd(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { return select(self > other, self, other); @@ -1065,7 +1065,7 @@ namespace xsimd { return _mm256_min_pd(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { return select(self <= other, self, other); @@ -1104,7 +1104,7 @@ namespace xsimd } // neg - template ::value>::type> + template ::value>> XSIMD_INLINE batch neg(batch const& self, requires_arch) noexcept { return 0 - self; @@ -1131,7 +1131,7 @@ namespace xsimd { return _mm256_cmp_pd(self, other, _CMP_NEQ_UQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~(self == other); @@ -1147,7 +1147,7 @@ namespace xsimd { return _mm256_xor_pd(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(self.data), _mm256_castsi256_ps(other.data))); @@ -1162,7 +1162,7 @@ namespace xsimd } // reduce_add - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { typename batch::register_type low = detail::lower_half(self), high = detail::upper_half(self); @@ -1171,7 +1171,7 @@ namespace xsimd } // reduce_max - template ::type> + template > XSIMD_INLINE T reduce_max(batch const& self, requires_arch) noexcept { constexpr auto mask = detail::shuffle(1, 0); @@ -1182,7 +1182,7 @@ namespace xsimd } // reduce_min - template ::type> + template > XSIMD_INLINE T reduce_min(batch const& self, requires_arch) noexcept { constexpr auto mask = detail::shuffle(1, 0); @@ -1193,7 +1193,7 @@ namespace xsimd } // reduce_mul - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { typename batch::register_type low = detail::lower_half(self), high = detail::upper_half(self); @@ -1214,7 +1214,7 @@ namespace xsimd } // sadd - template ::value>::type> + template ::value>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1243,7 +1243,7 @@ namespace xsimd { return _mm256_blendv_pd(false_br, true_br, cond); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { __m128i cond_low = detail::lower_half(cond), cond_hi = detail::upper_half(cond); @@ -1256,7 +1256,7 @@ namespace xsimd __m128i res_hi = select(batch_bool(cond_hi), batch(true_hi), batch(false_hi), sse4_2 {}); return detail::merge_sse(res_low, res_hi); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool_constant const&, batch const& true_br, batch const& false_br, requires_arch) noexcept { return select(batch_bool { Values... }, true_br, false_br, avx2 {}); @@ -1290,29 +1290,29 @@ namespace xsimd static_assert(sizeof...(Values) == batch::size, "consistent init"); return _mm256_setr_pd(values...); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3) noexcept { return _mm256_set_epi64x(v3, v2, v1, v0); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7) noexcept { return _mm256_setr_epi32(v0, v1, v2, v3, v4, v5, v6, v7); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15) noexcept { return _mm256_setr_epi16(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15, T v16, T v17, T v18, T v19, T v20, T v21, T v22, T v23, T v24, T v25, T v26, T v27, T v28, T v29, T v30, T v31) noexcept { return _mm256_setr_epi8(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool set(batch_bool const&, requires_arch, Values... values) noexcept { return set(batch(), A {}, static_cast(values ? -1LL : 0LL)...).data; @@ -1457,7 +1457,7 @@ namespace xsimd } // ssub - template ::value>::type> + template ::value>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1472,12 +1472,12 @@ namespace xsimd } // store_aligned - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return _mm256_store_si256((__m256i*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm256_store_si256((__m256i*)mem, self); @@ -1494,12 +1494,12 @@ namespace xsimd } // store_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return _mm256_storeu_si256((__m256i*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm256_storeu_si256((__m256i*)mem, self); @@ -1516,7 +1516,7 @@ namespace xsimd } // sub - template ::value>::type> + template ::value>> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -1872,7 +1872,7 @@ namespace xsimd } // zip_hi - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1 || sizeof(T) == 2) @@ -1935,7 +1935,7 @@ namespace xsimd } // zip_lo - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1 || sizeof(T) == 2) @@ -2011,7 +2011,7 @@ namespace xsimd return _mm256_cvtsd_f64(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) diff --git a/include/xsimd/arch/xsimd_avx2.hpp b/include/xsimd/arch/xsimd_avx2.hpp index f9628f450..699f40ec3 100644 --- a/include/xsimd/arch/xsimd_avx2.hpp +++ b/include/xsimd/arch/xsimd_avx2.hpp @@ -28,7 +28,7 @@ namespace xsimd using namespace types; // abs - template ::value>::type> + template ::value>> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { if (std::is_signed::value) @@ -54,7 +54,7 @@ namespace xsimd } // add - template ::value>::type> + template ::value>> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -80,7 +80,7 @@ namespace xsimd } // avgr - template ::value>::type> + template ::value>> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -98,7 +98,7 @@ namespace xsimd } // avg - template ::value>::type> + template ::value>> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -139,11 +139,11 @@ namespace xsimd // single templated implementation for integer masked loads (32/64-bit) template - XSIMD_INLINE typename std::enable_if::value && (sizeof(T) >= 4), batch>::type + XSIMD_INLINE std::enable_if_t::value && (sizeof(T) >= 4), batch> load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { static_assert(sizeof(T) == 4 || sizeof(T) == 8, "load_masked supports only 32/64-bit integers on AVX2"); - using int_t = typename std::conditional::type; + using int_t = std::conditional_t; // Use the raw register-level maskload helpers for the remaining cases. return detail::maskload(reinterpret_cast(mem), mask.as_batch()); } @@ -230,43 +230,43 @@ namespace xsimd } // bitwise_and - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_and_si256(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_and(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm256_and_si256(self, other); } // bitwise_andnot - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_andnot_si256(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_andnot(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm256_andnot_si256(other, self); } // bitwise_not - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return _mm256_xor_si256(self, _mm256_set1_epi32(-1)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_not(batch_bool const& self, requires_arch) noexcept { return _mm256_xor_si256(self, _mm256_set1_epi32(-1)); } // bitwise_lshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 2) @@ -287,7 +287,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -315,7 +315,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -333,19 +333,19 @@ namespace xsimd } // bitwise_or - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_or_si256(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_or(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm256_or_si256(self, other); } // bitwise_rshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { if (std::is_signed::value) @@ -395,7 +395,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -452,7 +452,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -484,12 +484,12 @@ namespace xsimd } // bitwise_xor - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_xor_si256(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm256_xor_si256(self, other); @@ -548,7 +548,7 @@ namespace xsimd } // eq - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -631,7 +631,7 @@ namespace xsimd } // lt - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -689,7 +689,7 @@ namespace xsimd // load_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool load_unaligned(bool const* mem, batch_bool, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -741,7 +741,7 @@ namespace xsimd } // mask - template ::value>::type> + template ::value>> XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -760,7 +760,7 @@ namespace xsimd } // max - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -804,7 +804,7 @@ namespace xsimd } // min - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -848,7 +848,7 @@ namespace xsimd } // mul - template ::value>::type> + template ::value>> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -876,7 +876,7 @@ namespace xsimd } // reduce_add - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -948,7 +948,7 @@ namespace xsimd } // sadd - template ::value>::type> + template ::value>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -984,7 +984,7 @@ namespace xsimd } // select - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1008,7 +1008,7 @@ namespace xsimd return select(cond, true_br, false_br, avx {}); } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool_constant const&, batch const& true_br, batch const& false_br, requires_arch) noexcept { // FIXME: for some reason mask here is not considered as an immediate, @@ -1150,7 +1150,7 @@ namespace xsimd } // ssub - template ::value>::type> + template ::value>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1186,7 +1186,7 @@ namespace xsimd } // sub - template ::value>::type> + template ::value>> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1287,17 +1287,16 @@ namespace xsimd } template - constexpr auto swizzle_make_self_batch_impl(::xsimd::detail::index_sequence) - -> batch_constant(sizeof...(Vals)))...> + constexpr batch_constant(sizeof...(Vals)))...> + swizzle_make_self_batch_impl(std::index_sequence) { return {}; } template constexpr auto swizzle_make_self_batch() - -> decltype(swizzle_make_self_batch_impl(::xsimd::detail::make_index_sequence())) { - return {}; + return swizzle_make_self_batch_impl(std::make_index_sequence()); } template @@ -1309,17 +1308,16 @@ namespace xsimd } template - constexpr auto swizzle_make_cross_batch_impl(::xsimd::detail::index_sequence) - -> batch_constant(sizeof...(Vals)))...> + constexpr batch_constant(sizeof...(Vals)))...> + swizzle_make_cross_batch_impl(std::index_sequence) { return {}; } template constexpr auto swizzle_make_cross_batch() - -> decltype(swizzle_make_cross_batch_impl(::xsimd::detail::make_index_sequence())) { - return {}; + return swizzle_make_cross_batch_impl(std::make_index_sequence()); } } @@ -1452,7 +1450,7 @@ namespace xsimd } // zip_hi - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1487,7 +1485,7 @@ namespace xsimd } // zip_lo - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1522,7 +1520,7 @@ namespace xsimd } // widen - template ::value>::type> + template ::value>> XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept { __m128i x_lo = detail::lower_half(x); diff --git a/include/xsimd/arch/xsimd_avx512bw.hpp b/include/xsimd/arch/xsimd_avx512bw.hpp index 767c5960b..28e2e98d6 100644 --- a/include/xsimd/arch/xsimd_avx512bw.hpp +++ b/include/xsimd/arch/xsimd_avx512bw.hpp @@ -72,7 +72,7 @@ namespace xsimd } // abs - template ::value>::type> + template ::value>> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { if (std::is_unsigned::value) @@ -95,7 +95,7 @@ namespace xsimd } // add - template ::value>::type> + template ::value>> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -113,7 +113,7 @@ namespace xsimd } // avgr - template ::value>::type> + template ::value>> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -131,7 +131,7 @@ namespace xsimd } // avg - template ::value>::type> + template ::value>> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -151,7 +151,7 @@ namespace xsimd } // bitwise_lshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { #if defined(XSIMD_AVX512_SHIFT_INTRINSICS_IMM_ONLY) @@ -171,7 +171,7 @@ namespace xsimd } // bitwise_rshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { if (std::is_signed::value) @@ -225,7 +225,7 @@ namespace xsimd } // decr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -244,28 +244,28 @@ namespace xsimd } // eq - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // ge - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // gt - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // incr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -284,7 +284,7 @@ namespace xsimd } // insert - template ::value>::type> + template ::value>> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -302,21 +302,21 @@ namespace xsimd } // le - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // lt - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // load - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool load_unaligned(bool const* mem, batch_bool, requires_arch) noexcept { using mask_type = typename batch_bool::register_type; @@ -347,7 +347,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool load_aligned(bool const* mem, batch_bool, requires_arch) noexcept { using mask_type = typename batch_bool::register_type; @@ -379,7 +379,7 @@ namespace xsimd } // max - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -415,7 +415,7 @@ namespace xsimd } // min - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -451,7 +451,7 @@ namespace xsimd } // mul - template ::value>::type> + template ::value>> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -471,14 +471,14 @@ namespace xsimd } // neq - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // sadd - template ::value>::type> + template ::value>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -514,7 +514,7 @@ namespace xsimd } // select - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -532,7 +532,7 @@ namespace xsimd } // slide_left - template ::type> + template > XSIMD_INLINE batch slide_left(batch const& x, requires_arch) noexcept { static_assert((N & 3) == 2 && N < 64, "The AVX512F implementation may have a lower latency."); @@ -543,7 +543,7 @@ namespace xsimd } // slide_right - template ::type> + template > XSIMD_INLINE batch slide_right(batch const& x, requires_arch) noexcept { static_assert((N & 3) == 2 && N < 64, "The AVX512F implementation may have a lower latency."); @@ -554,7 +554,7 @@ namespace xsimd } // ssub - template ::value>::type> + template ::value>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -600,7 +600,7 @@ namespace xsimd } // sub - template ::value>::type> + template ::value>> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -664,7 +664,7 @@ namespace xsimd } // zip_hi - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { __m512i lo, hi; @@ -692,7 +692,7 @@ namespace xsimd } // zip_lo - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { __m512i lo, hi; diff --git a/include/xsimd/arch/xsimd_avx512dq.hpp b/include/xsimd/arch/xsimd_avx512dq.hpp index 480511ddb..0bedb9b41 100644 --- a/include/xsimd/arch/xsimd_avx512dq.hpp +++ b/include/xsimd/arch/xsimd_avx512dq.hpp @@ -236,8 +236,9 @@ namespace xsimd XSIMD_IF_CONSTEXPR(dup_lo || dup_hi) { const batch half = _mm512_extractf32x8_ps(self, dup_lo ? 0 : 1); - constexpr typename std::conditional, - batch_constant>::type half_mask {}; + constexpr std::conditional_t, + batch_constant> + half_mask {}; auto permuted = swizzle(half, half_mask, avx2 {}); // merge the two slices into an AVX512F register: return _mm512_broadcast_f32x8(permuted); // duplicates the 256-bit perm into both halves diff --git a/include/xsimd/arch/xsimd_avx512f.hpp b/include/xsimd/arch/xsimd_avx512f.hpp index 5b8599a8d..b9ec7916b 100644 --- a/include/xsimd/arch/xsimd_avx512f.hpp +++ b/include/xsimd/arch/xsimd_avx512f.hpp @@ -299,7 +299,7 @@ namespace xsimd } // namespace detail template = 4), void>::type> + typename = std::enable_if_t<(sizeof(T) >= 4)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept @@ -325,7 +325,7 @@ namespace xsimd } template = 4), void>::type> + typename = std::enable_if_t<(sizeof(T) >= 4)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, @@ -369,7 +369,7 @@ namespace xsimd self_asi); return *reinterpret_cast<__m512d*>(&res_asi); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { if (std::is_unsigned::value) @@ -405,7 +405,7 @@ namespace xsimd } // add - template ::value>::type> + template ::value>> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -484,7 +484,7 @@ namespace xsimd return _mm512_castsi512_pd(_mm512_and_si512(_mm512_castpd_si512(self), _mm512_castpd_si512(other))); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_and_si512(self, other); @@ -509,7 +509,7 @@ namespace xsimd return _mm512_castsi512_pd(_mm512_andnot_si512(_mm512_castpd_si512(other), _mm512_castpd_si512(self))); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_andnot_si512(other, self); @@ -523,7 +523,7 @@ namespace xsimd } // bitwise_lshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -568,7 +568,7 @@ namespace xsimd } // bitwise_not - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return _mm512_xor_si512(self, _mm512_set1_epi32(-1)); @@ -610,14 +610,14 @@ namespace xsimd return register_type(self.data | other.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_or_si512(self, other); } // bitwise_rshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { if (std::is_signed::value) @@ -687,7 +687,7 @@ namespace xsimd } // rotl - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotl(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -702,12 +702,12 @@ namespace xsimd { return rotl(batch(s), batch(o), avx2 {}); }, self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotl(batch const& self, int32_t other, requires_arch) noexcept { return rotl(self, batch(other), A {}); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotl(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -727,7 +727,7 @@ namespace xsimd } // rotr - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotr(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) < 4) @@ -749,13 +749,13 @@ namespace xsimd } return rotr(self, other, common {}); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotr(batch const& self, int32_t other, requires_arch) noexcept { return rotr(self, batch(other), A {}); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotr(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -799,24 +799,24 @@ namespace xsimd return register_type(self.data ^ other.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_xor_si512(self, other); } // bitwise_cast - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castsi512_ps(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castsi512_pd(self); } - template ::type>::value>::type> + template >::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return batch(self.data); @@ -826,7 +826,7 @@ namespace xsimd { return _mm512_castps_pd(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castps_si512(self); @@ -836,14 +836,14 @@ namespace xsimd { return _mm512_castpd_ps(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castpd_si512(self); } // broadcast - template ::value>::type> + template ::value>> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -982,7 +982,7 @@ namespace xsimd } } // incr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -1024,7 +1024,7 @@ namespace xsimd return _mm512_cmp_pd_mask(self, other, _CMP_EQ_OQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1208,7 +1208,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_GE_OQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1225,7 +1225,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_GT_OQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1328,7 +1328,7 @@ namespace xsimd } // incr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -1361,7 +1361,7 @@ namespace xsimd int64_t tmp = bit_cast(val); return _mm512_castsi512_pd(_mm512_mask_set1_epi64(_mm512_castpd_si512(self), __mmask8(1 << (I & 7)), tmp)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -1417,7 +1417,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_LE_OQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1457,7 +1457,7 @@ namespace xsimd } // load_aligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return _mm512_load_si512((__m512i const*)mem); @@ -1497,7 +1497,7 @@ namespace xsimd } // load_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return _mm512_loadu_si512((__m512i const*)mem); @@ -1525,7 +1525,7 @@ namespace xsimd return _mm512_cmp_pd_mask(self, other, _CMP_LT_OQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1549,7 +1549,7 @@ namespace xsimd { return _mm512_max_pd(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1599,7 +1599,7 @@ namespace xsimd { return _mm512_min_pd(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1649,7 +1649,7 @@ namespace xsimd { return _mm512_mul_pd(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -1702,7 +1702,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_NEQ_UQ); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~(self == other); @@ -1743,7 +1743,7 @@ namespace xsimd { return _mm512_reduce_add_pd(rhs); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { __m256i low = detail::lower_half(self), high = detail::upper_half(self); @@ -1752,7 +1752,7 @@ namespace xsimd } // reduce_max - template ::type> + template > XSIMD_INLINE T reduce_max(batch const& self, requires_arch) noexcept { constexpr batch_constant mask; @@ -1763,7 +1763,7 @@ namespace xsimd } // reduce_min - template ::type> + template > XSIMD_INLINE T reduce_min(batch const& self, requires_arch) noexcept { constexpr batch_constant mask; @@ -1784,7 +1784,7 @@ namespace xsimd { return _mm512_reduce_mul_pd(rhs); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -1816,7 +1816,7 @@ namespace xsimd } // sadd - template ::value>::type> + template ::value>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1836,7 +1836,7 @@ namespace xsimd // scatter template ::value || std::is_same::value>::type> + class = std::enable_if_t::value || std::is_same::value>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -1845,7 +1845,7 @@ namespace xsimd } template ::value || std::is_same::value>::type> + class = std::enable_if_t::value || std::is_same::value>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -1881,7 +1881,7 @@ namespace xsimd return _mm512_mask_blend_pd(cond, false_br, true_br); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1927,7 +1927,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool_constant const&, batch const& true_br, batch const& false_br, requires_arch) noexcept { return select(batch_bool { Values... }, true_br, false_br, avx512f {}); @@ -1936,12 +1936,12 @@ namespace xsimd namespace detail { template - using enable_signed_integer_t = typename std::enable_if::value && std::is_signed::value, - int>::type; + using enable_signed_integer_t = std::enable_if_t::value && std::is_signed::value, + int>; template - using enable_unsigned_integer_t = typename std::enable_if::value && std::is_unsigned::value, - int>::type; + using enable_unsigned_integer_t = std::enable_if_t::value && std::is_unsigned::value, + int>; } // set @@ -1956,12 +1956,12 @@ namespace xsimd { return _mm512_setr_pd(v0, v1, v2, v3, v4, v5, v6, v7); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7) noexcept { return _mm512_set_epi64(v7, v6, v5, v4, v3, v2, v1, v0); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15) noexcept { @@ -2217,7 +2217,7 @@ namespace xsimd } // ssub - template ::value>::type> + template ::value>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -2242,12 +2242,12 @@ namespace xsimd } // store_aligned - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return _mm512_store_si512((__m512i*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm512_store_si512((__m512i*)mem, self); @@ -2264,12 +2264,12 @@ namespace xsimd } // store_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return _mm512_storeu_si512((__m512i*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm512_storeu_si512((__m512i*)mem, self); @@ -2286,7 +2286,7 @@ namespace xsimd } // sub - template ::value>::type> + template ::value>> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -2405,8 +2405,9 @@ namespace xsimd XSIMD_IF_CONSTEXPR(dup_lo || dup_hi) { const batch half = _mm512_extractf64x4_pd(self, dup_lo ? 0 : 1); - constexpr typename std::conditional, - batch_constant>::type half_mask {}; + constexpr std::conditional_t, + batch_constant> + half_mask {}; return _mm512_broadcast_f64x4(swizzle(half, half_mask, avx2 {})); } // General case @@ -2464,7 +2465,7 @@ namespace xsimd } - template ::value>::type> + template ::value>> XSIMD_INLINE batch swizzle(batch const& self, batch_constant, requires_arch) noexcept { constexpr typename detail::fold_batch_constant::type mask32; @@ -2583,7 +2584,7 @@ namespace xsimd } // zip_hi - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { @@ -2651,7 +2652,7 @@ namespace xsimd } // zip_lo - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { @@ -2731,7 +2732,7 @@ namespace xsimd return _mm512_cvtsd_f64(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) diff --git a/include/xsimd/arch/xsimd_avx512vbmi.hpp b/include/xsimd/arch/xsimd_avx512vbmi.hpp index 7158ec839..7c00d94ea 100644 --- a/include/xsimd/arch/xsimd_avx512vbmi.hpp +++ b/include/xsimd/arch/xsimd_avx512vbmi.hpp @@ -25,7 +25,7 @@ namespace xsimd using namespace types; // slide_left - template ::type> + template > XSIMD_INLINE batch slide_left(batch const& x, requires_arch) noexcept { static_assert((N & 3) != 0 && N < 64, "The AVX512F implementation may have a lower latency."); @@ -36,7 +36,7 @@ namespace xsimd } // slide_right - template ::type> + template > XSIMD_INLINE batch slide_right(batch const& x, requires_arch) noexcept { static_assert((N & 3) != 0 && N < 64, "The AVX512F implementation may have a lower latency."); diff --git a/include/xsimd/arch/xsimd_avx512vbmi2.hpp b/include/xsimd/arch/xsimd_avx512vbmi2.hpp index 229acb28e..8852b2a1e 100644 --- a/include/xsimd/arch/xsimd_avx512vbmi2.hpp +++ b/include/xsimd/arch/xsimd_avx512vbmi2.hpp @@ -69,7 +69,7 @@ namespace xsimd } // rotl - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotl(batch const& self, int32_t other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 2) @@ -82,7 +82,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotl(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -98,7 +98,7 @@ namespace xsimd } // rotr - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotr(batch const& self, int32_t other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 2) @@ -111,7 +111,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch rotr(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; diff --git a/include/xsimd/arch/xsimd_common_fwd.hpp b/include/xsimd/arch/xsimd_common_fwd.hpp index 21f99b004..74bcd2351 100644 --- a/include/xsimd/arch/xsimd_common_fwd.hpp +++ b/include/xsimd/arch/xsimd_common_fwd.hpp @@ -43,27 +43,27 @@ namespace xsimd namespace kernel { // forward declaration - template ::value>::type> + template ::value>> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept; template XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept; - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept; template XSIMD_INLINE batch rotl(batch const& self, STy other, requires_arch) noexcept; @@ -86,17 +86,17 @@ namespace xsimd template XSIMD_INLINE batch load_masked(uint32_t const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept; template - XSIMD_INLINE typename std::enable_if::value, batch>::type load_masked(int64_t const*, batch_bool_constant, convert, Mode, requires_arch) noexcept; + XSIMD_INLINE std::enable_if_t::value, batch> load_masked(int64_t const*, batch_bool_constant, convert, Mode, requires_arch) noexcept; template - XSIMD_INLINE typename std::enable_if::value, batch>::type load_masked(uint64_t const*, batch_bool_constant, convert, Mode, requires_arch) noexcept; + XSIMD_INLINE std::enable_if_t::value, batch> load_masked(uint64_t const*, batch_bool_constant, convert, Mode, requires_arch) noexcept; template XSIMD_INLINE void store_masked(int32_t* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept; template XSIMD_INLINE void store_masked(uint32_t* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept; template - XSIMD_INLINE typename std::enable_if::value, void>::type store_masked(int64_t*, batch const&, batch_bool_constant, Mode, requires_arch) noexcept; + XSIMD_INLINE std::enable_if_t::value> store_masked(int64_t*, batch const&, batch_bool_constant, Mode, requires_arch) noexcept; template - XSIMD_INLINE typename std::enable_if::value, void>::type store_masked(uint64_t*, batch const&, batch_bool_constant, Mode, requires_arch) noexcept; + XSIMD_INLINE std::enable_if_t::value> store_masked(uint64_t*, batch const&, batch_bool_constant, Mode, requires_arch) noexcept; // Forward declarations for pack-level helpers namespace detail diff --git a/include/xsimd/arch/xsimd_emulated.hpp b/include/xsimd/arch/xsimd_emulated.hpp index 639850335..4437174a9 100644 --- a/include/xsimd/arch/xsimd_emulated.hpp +++ b/include/xsimd/arch/xsimd_emulated.hpp @@ -46,21 +46,21 @@ namespace xsimd namespace detail { template - auto emulated_apply(F func, Bs const&... bs) -> decltype(func(bs.data[I]...)) + auto emulated_apply(F func, Bs const&... bs) { return func(bs.data[I]...); } template - auto emulated_apply(F func, ::xsimd::detail::index_sequence, B const& b, Bs const&... bs) -> std::array + auto emulated_apply(F func, std::index_sequence, B const& b, Bs const&... bs) -> std::array { return { emulated_apply(func, b, bs...)... }; } template - auto emulated_apply(F func, B const& b, Bs const&... bs) -> std::array + auto emulated_apply(F func, B const& b, Bs const&... bs) { - return emulated_apply(func, ::xsimd::detail::make_index_sequence(), b, bs...); + return emulated_apply(func, std::make_index_sequence(), b, bs...); } } @@ -433,7 +433,7 @@ namespace xsimd } // isnan - template ::size, class = typename std::enable_if::value>::type> + template ::size, class = std::enable_if_t::value>> XSIMD_INLINE batch_bool isnan(batch const& self, requires_arch>) noexcept { return detail::emulated_apply([](T v) diff --git a/include/xsimd/arch/xsimd_neon.hpp b/include/xsimd/arch/xsimd_neon.hpp index d97be3cc2..6bf5b4dad 100644 --- a/include/xsimd/arch/xsimd_neon.hpp +++ b/include/xsimd/arch/xsimd_neon.hpp @@ -169,7 +169,7 @@ namespace xsimd return_type apply(U rhs) const noexcept { using func_type = return_type (*)(U); - auto func = xsimd::detail::get(m_func); + auto func = std::get(m_func); return func(rhs); } }; @@ -183,7 +183,7 @@ namespace xsimd return_type apply(U lhs, U rhs) const noexcept { using func_type = return_type (*)(U, U); - auto func = xsimd::detail::get(m_func); + auto func = std::get(m_func); return func(lhs, rhs); } }; @@ -295,12 +295,12 @@ namespace xsimd **************************************/ template - using enable_neon_type_t = typename std::enable_if::value || std::is_same::value, - int>::type; + using enable_neon_type_t = std::enable_if_t::value || std::is_same::value, + int>; template using exclude_int64_neon_t - = typename std::enable_if<(std::is_integral::value && sizeof(T) != 8) || std::is_same::value, int>::type; + = std::enable_if_t<(std::is_integral::value && sizeof(T) != 8) || std::is_same::value, int>; } /************* @@ -870,7 +870,7 @@ namespace xsimd WRAP_BINARY_UINT_EXCLUDING_64(vhaddq, detail::identity_return_type) - template ::value && sizeof(T) != 8)>::type> + template ::value && sizeof(T) != 8)>> XSIMD_INLINE batch avg(batch const& lhs, batch const& rhs, requires_arch) noexcept { using register_type = typename batch::register_type; @@ -886,7 +886,7 @@ namespace xsimd WRAP_BINARY_UINT_EXCLUDING_64(vrhaddq, detail::identity_return_type) - template ::value && sizeof(T) != 8)>::type> + template ::value && sizeof(T) != 8)>> XSIMD_INLINE batch avgr(batch const& lhs, batch const& rhs, requires_arch) noexcept { using register_type = typename batch::register_type; @@ -1866,7 +1866,7 @@ namespace xsimd U apply(comp_return_type cond, U lhs, U rhs) const noexcept { using func_type = U (*)(comp_return_type, U, U); - auto func = xsimd::detail::get(m_func); + auto func = std::get(m_func); return func(cond, lhs, rhs); } }; @@ -2097,14 +2097,14 @@ namespace xsimd namespace detail { template - XSIMD_INLINE batch extract_pair(batch const&, batch const& /*rhs*/, std::size_t, ::xsimd::detail::index_sequence<>) noexcept + XSIMD_INLINE batch extract_pair(batch const&, batch const& /*rhs*/, std::size_t, std::index_sequence<>) noexcept { assert(false && "extract_pair out of bounds"); return batch {}; } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2112,12 +2112,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2125,12 +2125,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2138,12 +2138,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2151,12 +2151,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2164,12 +2164,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2177,12 +2177,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2190,12 +2190,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template = 0> - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2203,12 +2203,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template - XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -2216,12 +2216,12 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } template - XSIMD_INLINE batch extract_pair_impl(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence<0, Is...>) noexcept + XSIMD_INLINE batch extract_pair_impl(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence<0, Is...>) noexcept { if (n == 0) { @@ -2229,7 +2229,7 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } } @@ -2239,7 +2239,7 @@ namespace xsimd { constexpr std::size_t size = batch::size; assert(n < size && "index in bounds"); - return detail::extract_pair_impl(lhs, rhs, n, ::xsimd::detail::make_index_sequence()); + return detail::extract_pair_impl(lhs, rhs, n, std::make_index_sequence()); } /****************** @@ -2886,7 +2886,7 @@ namespace xsimd R apply(U rhs) const noexcept { using func_type = R (*)(U); - auto func = xsimd::detail::get(m_func); + auto func = std::get(m_func); return func(rhs); } }; @@ -2915,7 +2915,7 @@ namespace xsimd V apply(U rhs) const noexcept { using caster_type = bitwise_caster_impl; - auto caster = xsimd::detail::get(m_caster); + auto caster = std::get(m_caster); return caster.apply(rhs); } }; diff --git a/include/xsimd/arch/xsimd_neon64.hpp b/include/xsimd/arch/xsimd_neon64.hpp index 565747446..c13ee1fa7 100644 --- a/include/xsimd/arch/xsimd_neon64.hpp +++ b/include/xsimd/arch/xsimd_neon64.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "../types/xsimd_neon64_register.hpp" #include "../types/xsimd_utils.hpp" @@ -857,8 +858,8 @@ namespace xsimd uint64x2_t, int64x2_t, float32x4_t, float64x2_t>; template - using enable_neon64_type_t = typename std::enable_if::value || std::is_same::value || std::is_same::value, - int>::type; + using enable_neon64_type_t = std::enable_if_t::value || std::is_same::value || std::is_same::value, + int>; } /************** @@ -1132,7 +1133,7 @@ namespace xsimd { template XSIMD_INLINE batch extract_pair(batch const& lhs, batch const& rhs, std::size_t n, - ::xsimd::detail::index_sequence) noexcept + std::index_sequence) noexcept { if (n == I) { @@ -1140,7 +1141,7 @@ namespace xsimd } else { - return extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return extract_pair(lhs, rhs, n, std::index_sequence()); } } } @@ -1150,7 +1151,7 @@ namespace xsimd { constexpr std::size_t size = batch::size; assert(n < size && "index in bounds"); - return detail::extract_pair(lhs, rhs, n, ::xsimd::detail::make_index_sequence()); + return detail::extract_pair(lhs, rhs, n, std::make_index_sequence()); } /****************** @@ -1240,7 +1241,7 @@ namespace xsimd V apply(float64x2_t rhs) const { using func_type = V (*)(float64x2_t); - auto func = xsimd::detail::get(m_func); + auto func = std::get(m_func); return func(rhs); } }; @@ -1396,8 +1397,6 @@ namespace xsimd namespace detail { using ::xsimd::batch_constant; - using ::xsimd::detail::integer_sequence; - using ::xsimd::detail::make_integer_sequence; template struct index_burst_impl; @@ -1405,7 +1404,7 @@ namespace xsimd template struct index_burst_impl, batch_constant, - integer_sequence> + std::integer_sequence> { using type = batch_constant; }; @@ -1413,11 +1412,11 @@ namespace xsimd template struct index_burst_impl, batch_constant, - integer_sequence> + std::integer_sequence> { using next_input = batch_constant; using next_output = batch_constant; - using type = typename index_burst_impl>::type; + using type = typename index_burst_impl>::type; }; template @@ -1429,7 +1428,7 @@ namespace xsimd static constexpr size_t mul = sizeof(Tp) / sizeof(T); using input = batch_constant; using output = batch_constant; - using type = typename index_burst_impl>::type; + using type = typename index_burst_impl>::type; }; template diff --git a/include/xsimd/arch/xsimd_rvv.hpp b/include/xsimd/arch/xsimd_rvv.hpp index 610c0944f..c659c14e4 100644 --- a/include/xsimd/arch/xsimd_rvv.hpp +++ b/include/xsimd/arch/xsimd_rvv.hpp @@ -436,23 +436,23 @@ namespace xsimd // enable for signed integers template - using rvv_enable_signed_int_t = typename std::enable_if::value && std::is_signed::value, int>::type; + using rvv_enable_signed_int_t = std::enable_if_t::value && std::is_signed::value, int>; // enable for unsigned integers template - using rvv_enable_unsigned_int_t = typename std::enable_if::value && std::is_unsigned::value, int>::type; + using rvv_enable_unsigned_int_t = std::enable_if_t::value && std::is_unsigned::value, int>; // enable for floating points template - using rvv_enable_floating_point_t = typename std::enable_if::value, int>::type; + using rvv_enable_floating_point_t = std::enable_if_t::value, int>; // enable for signed integers or floating points template - using rvv_enable_signed_int_or_floating_point_t = typename std::enable_if::value, int>::type; + using rvv_enable_signed_int_or_floating_point_t = std::enable_if_t::value, int>; // enable for all RVE supported types template - using rvv_enable_all_t = typename std::enable_if::value, int>::type; + using rvv_enable_all_t = std::enable_if_t::value, int>; } // namespace detail /******************** @@ -505,7 +505,7 @@ namespace xsimd // load_complex namespace detail { - template = types::detail::rvv_width_m1, int>::type = 0> + template = types::detail::rvv_width_m1, int> = 0> XSIMD_INLINE rvv_reg_t rvvabut(rvv_reg_t const& lo, rvv_reg_t const& hi) noexcept { typename rvv_reg_t::register_type tmp; @@ -513,7 +513,7 @@ namespace xsimd return __riscv_vset(tmp, 1, hi); } - template ::type = 0> XSIMD_INLINE rvv_reg_t rvvabut(rvv_reg_t const& lo, rvv_reg_t const& hi) noexcept + template ::type = 0> D_INLINE rvv_reg_t rvvabut(rvv_reg_t const& lo, rvv_reg_t const& hi) noexcept { return __riscv_vslideup(lo, hi, lo.vl, lo.vl * 2); } @@ -521,24 +521,24 @@ namespace xsimd XSIMD_RVV_OVERLOAD(rvvget_lo_, (__riscv_vget_ XSIMD_RVV_TSM), _DROP_1ST_CUSTOM_ARGS_NOVL, vec(T, wide_vec), args..., 0) XSIMD_RVV_OVERLOAD(rvvget_hi_, (__riscv_vget_ XSIMD_RVV_TSM), _DROP_1ST_CUSTOM_ARGS_NOVL, vec(T, wide_vec), args..., 1) - template = types::detail::rvv_width_m1, int>::type = 0> + template = types::detail::rvv_width_m1, int> = 0> rvv_reg_t rvvget_lo(rvv_reg_t const& vv) noexcept { typename rvv_reg_t::register_type tmp = rvvget_lo_(T {}, vv); return tmp; } - template = types::detail::rvv_width_m1, int>::type = 0> + template = types::detail::rvv_width_m1, int> = 0> rvv_reg_t rvvget_hi(rvv_reg_t const& vv) noexcept { typename rvv_reg_t::register_type tmp = rvvget_hi_(T {}, vv); return tmp; } - template ::type = 0> rvv_reg_t rvvget_lo(rvv_reg_t const& vv) noexcept + template = 0> rvv_reg_t rvvget_lo(rvv_reg_t const& vv) noexcept { typename rvv_reg_t::register_type tmp = vv; return tmp; } - template ::type = 0> rvv_reg_t rvvget_hi(rvv_reg_t const& vv) noexcept + template ::type = 0> reg_t rvvget_hi(rvv_reg_t const& vv) noexcept { return __riscv_vslidedown(vv, vv.vl / 2, vv.vl); } @@ -579,7 +579,7 @@ namespace xsimd namespace detail { template - using rvv_enable_sg_t = typename std::enable_if<(sizeof(T) == sizeof(U) && (sizeof(T) == 4 || sizeof(T) == 8)), int>::type; + using rvv_enable_sg_t = std::enable_if_t<(sizeof(T) == sizeof(U) && (sizeof(T) == 4 || sizeof(T) == 8)), int>; XSIMD_RVV_OVERLOAD(rvvloxei, (__riscv_vloxei XSIMD_RVV_S), , vec(T const*, uvec)) XSIMD_RVV_OVERLOAD(rvvsoxei, (__riscv_vsoxei XSIMD_RVV_S), , void(T*, uvec, vec)) XSIMD_RVV_OVERLOAD3(rvvmul_splat, @@ -1289,9 +1289,9 @@ namespace xsimd XSIMD_RVV_OVERLOAD_INTS(rvvfcvt_f, (__riscv_vfcvt_f), , fvec(vec)) template - using rvv_enable_ftoi_t = typename std::enable_if<(sizeof(T) == sizeof(U) && std::is_floating_point::value && !std::is_floating_point::value), int>::type; + using rvv_enable_ftoi_t = std::enable_if_t<(sizeof(T) == sizeof(U) && std::is_floating_point::value && !std::is_floating_point::value), int>; template - using rvv_enable_itof_t = typename std::enable_if<(sizeof(T) == sizeof(U) && !std::is_floating_point::value && std::is_floating_point::value), int>::type; + using rvv_enable_itof_t = std::enable_if_t<(sizeof(T) == sizeof(U) && !std::is_floating_point::value && std::is_floating_point::value), int>; template = 0> XSIMD_INLINE batch fast_cast(batch const& arg, batch const&, requires_arch) noexcept diff --git a/include/xsimd/arch/xsimd_scalar.hpp b/include/xsimd/arch/xsimd_scalar.hpp index f4ffb8c80..6d9f19b31 100644 --- a/include/xsimd/arch/xsimd_scalar.hpp +++ b/include/xsimd/arch/xsimd_scalar.hpp @@ -84,14 +84,14 @@ namespace xsimd using std::trunc; template - XSIMD_INLINE constexpr typename std::enable_if::value && std::is_signed::value, T>::type + XSIMD_INLINE constexpr std::enable_if_t::value && std::is_signed::value, T> abs(T v) noexcept { return v < 0 ? -v : v; } template - XSIMD_INLINE constexpr typename std::enable_if::value && std::is_unsigned::value, T>::type + XSIMD_INLINE constexpr std::enable_if_t::value && std::is_unsigned::value, T> abs(T v) noexcept { return v; @@ -105,42 +105,42 @@ namespace xsimd // Windows defines catch all templates template - XSIMD_INLINE typename std::enable_if::value, bool>::type + XSIMD_INLINE std::enable_if_t::value, bool> isfinite(T var) noexcept { return std::isfinite(var); } template - XSIMD_INLINE typename std::enable_if::value, bool>::type + XSIMD_INLINE std::enable_if_t::value, bool> isfinite(T var) noexcept { return isfinite(double(var)); } template - XSIMD_INLINE typename std::enable_if::value, bool>::type + XSIMD_INLINE std::enable_if_t::value, bool> isinf(T var) noexcept { return std::isinf(var); } template - XSIMD_INLINE typename std::enable_if::value, bool>::type + XSIMD_INLINE std::enable_if_t::value, bool> isinf(T var) noexcept { return isinf(double(var)); } template - XSIMD_INLINE typename std::enable_if::value, bool>::type + XSIMD_INLINE std::enable_if_t::value, bool> isnan(T var) noexcept { return std::isnan(var); } template - XSIMD_INLINE typename std::enable_if::value, bool>::type + XSIMD_INLINE std::enable_if_t::value, bool> isnan(T var) noexcept { return isnan(double(var)); @@ -148,15 +148,15 @@ namespace xsimd #endif template - XSIMD_INLINE typename std::common_type::type add(T const& x, Tp const& y) noexcept + XSIMD_INLINE std::common_type_t add(T const& x, Tp const& y) noexcept { return x + y; } template - XSIMD_INLINE typename std::common_type::type avg(T const& x, Tp const& y) noexcept + XSIMD_INLINE std::common_type_t avg(T const& x, Tp const& y) noexcept { - using common_type = typename std::common_type::type; + using common_type = std::common_type_t; if (std::is_floating_point::value) return (x + y) / 2; else if (std::is_unsigned::value) @@ -168,16 +168,16 @@ namespace xsimd // Inspired by // https://stackoverflow.com/questions/5697500/take-the-average-of-two-signed-numbers-in-c auto t = (x & y) + ((x ^ y) >> 1); - auto t_u = static_cast::type>(t); + auto t_u = static_cast>(t); auto avg = t + (static_cast(t_u >> (8 * sizeof(T) - 1)) & (x ^ y)); return avg; } } template - XSIMD_INLINE typename std::common_type::type avgr(T const& x, Tp const& y) noexcept + XSIMD_INLINE std::common_type_t avgr(T const& x, Tp const& y) noexcept { - using common_type = typename std::common_type::type; + using common_type = std::common_type_t; if (std::is_floating_point::value) return avg(x, y); else @@ -214,7 +214,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> bitwise_and(T x, T y) noexcept { return x & y; @@ -252,14 +252,14 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value && std::is_integral::value, T0>::type + XSIMD_INLINE std::enable_if_t::value && std::is_integral::value, T0> bitwise_lshift(T0 x, T1 shift) noexcept { return x << shift; } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> bitwise_lshift(T x) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -268,13 +268,13 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value && std::is_integral::value, T0>::type + XSIMD_INLINE std::enable_if_t::value && std::is_integral::value, T0> bitwise_rshift(T0 x, T1 shift) noexcept { return x >> shift; } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> bitwise_rshift(T x) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -283,7 +283,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> bitwise_not(T x) noexcept { return ~x; @@ -315,13 +315,13 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, T>::type bitwise_andnot(T x, T y) noexcept + XSIMD_INLINE std::enable_if_t::value, T> bitwise_andnot(T x, T y) noexcept { return bitwise_and(x, bitwise_not(y)); } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> bitwise_or(T x, T y) noexcept { return x | y; @@ -350,7 +350,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> bitwise_xor(T x, T y) noexcept { return x ^ y; @@ -379,19 +379,19 @@ namespace xsimd } template - XSIMD_INLINE typename std::common_type::type div(T const& x, Tp const& y) noexcept + XSIMD_INLINE std::common_type_t div(T const& x, Tp const& y) noexcept { return x / y; } template - XSIMD_INLINE auto mod(T const& x, Tp const& y) noexcept -> decltype(x % y) + XSIMD_INLINE auto mod(T const& x, Tp const& y) noexcept { return x % y; } template - XSIMD_INLINE typename std::common_type::type mul(T const& x, Tp const& y) noexcept + XSIMD_INLINE std::common_type_t mul(T const& x, Tp const& y) noexcept { return x * y; } @@ -403,7 +403,7 @@ namespace xsimd } template - XSIMD_INLINE auto pos(T const& x) noexcept -> decltype(+x) + XSIMD_INLINE auto pos(T const& x) noexcept { return +x; } @@ -419,14 +419,14 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value && std::is_integral::value, T0>::type + XSIMD_INLINE std::enable_if_t::value && std::is_integral::value, T0> rotl(T0 x, T1 shift) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; return (x << shift) | (x >> (bits - shift)); } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> rotl(T x) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -435,14 +435,14 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value && std::is_integral::value, T0>::type + XSIMD_INLINE std::enable_if_t::value && std::is_integral::value, T0> rotr(T0 x, T1 shift) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; return (x >> shift) | (x << (bits - shift)); } template - XSIMD_INLINE typename std::enable_if::value, T>::type + XSIMD_INLINE std::enable_if_t::value, T> rotr(T x) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -491,14 +491,14 @@ namespace xsimd using xtl::tanh; #endif - template ::value>::type> + template ::value>> XSIMD_INLINE T clip(const T& val, const T& low, const T& hi) noexcept { assert(low <= hi && "ordered clipping bounds"); return low > val ? low : (hi < val ? hi : val); } - template ::value>::type> + template ::value>> XSIMD_INLINE bool is_flint(const T& x) noexcept { #ifdef __FAST_MATH__ @@ -508,13 +508,13 @@ namespace xsimd #endif } - template ::value>::type> + template ::value>> XSIMD_INLINE bool is_even(const T& x) noexcept { return is_flint(x * T(0.5)); } - template ::value>::type> + template ::value>> XSIMD_INLINE bool is_odd(const T& x) noexcept { return is_even(x - 1.); @@ -530,7 +530,7 @@ namespace xsimd return static_cast(std::nearbyint(var)); } - template ::value>::type> + template ::value>> XSIMD_INLINE bool eq(const T& x0, const T& x1) noexcept { return x0 == x1; @@ -542,31 +542,31 @@ namespace xsimd return x0 == x1; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool ge(const T& x0, const T& x1) noexcept { return x0 >= x1; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool gt(const T& x0, const T& x1) noexcept { return x0 > x1; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool le(const T& x0, const T& x1) noexcept { return x0 <= x1; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool lt(const T& x0, const T& x1) noexcept { return x0 < x1; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool neq(const T& x0, const T& x1) noexcept { return x0 != x1; @@ -606,7 +606,7 @@ namespace xsimd return __builtin_exp10(x); } #elif defined(_WIN32) - template ::value>::type> + template ::value>> XSIMD_INLINE T exp10(const T& x) noexcept { // Very inefficient but other implementations give incorrect results @@ -626,8 +626,8 @@ namespace xsimd } #endif - template ::value>::type> - XSIMD_INLINE auto rsqrt(const T& x) noexcept -> decltype(std::sqrt(x)) + template ::value>> + XSIMD_INLINE auto rsqrt(const T& x) noexcept { using float_type = decltype(std::sqrt(x)); return static_cast(1) / std::sqrt(x); @@ -684,7 +684,7 @@ namespace xsimd return log(val) / std::log(T(2)); } - template ::value>::type> + template ::value>> XSIMD_INLINE T sadd(const T& lhs, const T& rhs) noexcept { if (std::numeric_limits::is_signed) @@ -715,7 +715,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE T ssub(const T& lhs, const T& rhs) noexcept { if (std::numeric_limits::is_signed) @@ -738,7 +738,7 @@ namespace xsimd namespace detail { template - XSIMD_INLINE typename std::enable_if::value, T0>::type + XSIMD_INLINE std::enable_if_t::value, T0> ipow(const T0& x, const T1& n) noexcept { static_assert(std::is_integral::value, "second argument must be an integer"); @@ -764,43 +764,41 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, T0>::type + XSIMD_INLINE std::enable_if_t::value, T0> pow(const T0& x, const T1& n) noexcept { return detail::ipow(x, n); } - template + template ::value && std::is_floating_point::value>> XSIMD_INLINE auto pow(const T0& t0, const T1& t1) noexcept - -> typename std::enable_if::value && std::is_floating_point::value, decltype(std::pow(t0, t1))>::type { return std::pow(t0, t1); } template - XSIMD_INLINE typename std::enable_if::value, std::complex>::type + XSIMD_INLINE std::enable_if_t::value, std::complex> pow(const std::complex& t0, const T1& t1) noexcept { return detail::ipow(t0, t1); } template - XSIMD_INLINE typename std::enable_if::value, std::complex>::type + XSIMD_INLINE std::enable_if_t::value, std::complex> pow(const std::complex& t0, const T1& t1) noexcept { return std::pow(t0, t1); } - template + template ::value>> XSIMD_INLINE auto pow(const T0& t0, const std::complex& t1) noexcept - -> typename std::enable_if::value, decltype(std::pow(t0, t1))>::type { return std::pow(t0, t1); } - template ::value>::type> + template ::value>> XSIMD_INLINE T bitofsign(T const& x) noexcept { return T(x < T(0)); @@ -822,7 +820,7 @@ namespace xsimd } template - XSIMD_INLINE auto signbit(T const& v) noexcept -> decltype(bitofsign(v)) + XSIMD_INLINE auto signbit(T const& v) noexcept { return bitofsign(v); } @@ -832,7 +830,7 @@ namespace xsimd return v; } - template ::value>::type> + template ::value>> XSIMD_INLINE T sign(const T& v) noexcept { return v < T(0) ? T(-1.) : v == T(0) ? T(0.) @@ -875,14 +873,14 @@ namespace xsimd return 1; } - template ::value>::type> + template ::value>> XSIMD_INLINE T signnz(const T& v) noexcept { return v < T(0) ? T(-1.) : T(1.); } template - XSIMD_INLINE typename std::common_type::type sub(T const& x, Tp const& y) noexcept + XSIMD_INLINE std::common_type_t sub(T const& x, Tp const& y) noexcept { return x - y; } @@ -915,52 +913,48 @@ namespace xsimd } #endif - template + template ::value && std::is_scalar::value>> XSIMD_INLINE auto min(T0 const& self, T1 const& other) noexcept - -> typename std::enable_if::value && std::is_scalar::value, - typename std::decay other ? other : self)>::type>::type { return self > other ? other : self; } // numpy defines minimum operator on complex using lexical comparison template - XSIMD_INLINE std::complex::type> + XSIMD_INLINE std::complex> min(std::complex const& self, std::complex const& other) noexcept { return (self.real() < other.real()) ? (self) : (self.real() == other.real() ? (self.imag() < other.imag() ? self : other) : other); } - template + template ::value && std::is_scalar::value>> XSIMD_INLINE auto max(T0 const& self, T1 const& other) noexcept - -> typename std::enable_if::value && std::is_scalar::value, - typename std::decay other ? other : self)>::type>::type { return self < other ? other : self; } // numpy defines maximum operator on complex using lexical comparison template - XSIMD_INLINE std::complex::type> + XSIMD_INLINE std::complex> max(std::complex const& self, std::complex const& other) noexcept { return (self.real() > other.real()) ? (self) : (self.real() == other.real() ? (self.imag() > other.imag() ? self : other) : other); } template - XSIMD_INLINE typename std::enable_if::value, T>::type fma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t::value, T> fma(const T& a, const T& b, const T& c) noexcept { return a * b + c; } template - XSIMD_INLINE typename std::enable_if::value, T>::type fma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t::value, T> fma(const T& a, const T& b, const T& c) noexcept { return std::fma(a, b, c); } template - XSIMD_INLINE typename std::enable_if::value, T>::type fms(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t::value, T> fms(const T& a, const T& b, const T& c) noexcept { return a * b - c; } @@ -1014,13 +1008,13 @@ namespace xsimd #endif template - XSIMD_INLINE typename std::enable_if::value, T>::type fnma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t::value, T> fnma(const T& a, const T& b, const T& c) noexcept { return -(a * b) + c; } template - XSIMD_INLINE typename std::enable_if::value, T>::type fnma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t::value, T> fnma(const T& a, const T& b, const T& c) noexcept { return std::fma(-a, b, c); } @@ -1050,13 +1044,13 @@ namespace xsimd #endif template - XSIMD_INLINE typename std::enable_if::value, T>::type fnms(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t::value, T> fnms(const T& a, const T& b, const T& c) noexcept { return -(a * b) - c; } template - XSIMD_INLINE typename std::enable_if::value, T>::type fnms(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t::value, T> fnms(const T& a, const T& b, const T& c) noexcept { return -std::fma(a, b, c); } @@ -1107,21 +1101,21 @@ namespace xsimd struct common_sincosf { template - XSIMD_INLINE typename std::enable_if::type + XSIMD_INLINE std::enable_if_t operator()(float val, T& s, T& c) { sincosf(val, &s, &c); } template - XSIMD_INLINE typename std::enable_if::type + XSIMD_INLINE std::enable_if_t operator()(float val, T& s, T& c) { __sincosf(val, &s, &c); } template - XSIMD_INLINE typename std::enable_if::type + XSIMD_INLINE std::enable_if_t operator()(float val, T& s, T& c) { s = std::sin(val); @@ -1132,21 +1126,21 @@ namespace xsimd struct common_sincos { template - XSIMD_INLINE typename std::enable_if::type + XSIMD_INLINE std::enable_if_t operator()(double val, T& s, T& c) { sincos(val, &s, &c); } template - XSIMD_INLINE typename std::enable_if::type + XSIMD_INLINE std::enable_if_t operator()(double val, T& s, T& c) { __sincos(val, &s, &c); } template - XSIMD_INLINE typename std::enable_if::type + XSIMD_INLINE std::enable_if_t operator()(double val, T& s, T& c) { s = std::sin(val); @@ -1187,7 +1181,7 @@ namespace xsimd } #endif - template ::value>::type> + template ::value>> XSIMD_INLINE T frexp(T const& val, int& exp) noexcept { return std::frexp(val, &exp); diff --git a/include/xsimd/arch/xsimd_sse2.hpp b/include/xsimd/arch/xsimd_sse2.hpp index 009e39c23..7959c494f 100644 --- a/include/xsimd/arch/xsimd_sse2.hpp +++ b/include/xsimd/arch/xsimd_sse2.hpp @@ -81,7 +81,7 @@ namespace xsimd } // add - template ::value>::type> + template ::value>> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -130,7 +130,7 @@ namespace xsimd { return _mm_movemask_pd(self) == 0x03; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool all(batch_bool const& self, requires_arch) noexcept { return _mm_movemask_epi8(self) == 0xFFFF; @@ -147,14 +147,14 @@ namespace xsimd { return _mm_movemask_pd(self) != 0; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool any(batch_bool const& self, requires_arch) noexcept { return _mm_movemask_epi8(self) != 0; } // avgr - template ::value>::type> + template ::value>> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -172,7 +172,7 @@ namespace xsimd } // avg - template ::value>::type> + template ::value>> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -209,12 +209,12 @@ namespace xsimd { return _mm_and_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return _mm_and_si128(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_and(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_and_si128(self, other); @@ -244,12 +244,12 @@ namespace xsimd { return _mm_andnot_ps(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return _mm_andnot_si128(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_andnot(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_andnot_si128(other, self); @@ -268,7 +268,7 @@ namespace xsimd } // bitwise_lshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -293,7 +293,7 @@ namespace xsimd return {}; } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -337,12 +337,12 @@ namespace xsimd { return _mm_xor_ps(self, _mm_castsi128_ps(_mm_set1_epi32(-1))); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return _mm_xor_si128(self, _mm_set1_epi32(-1)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_not(batch_bool const& self, requires_arch) noexcept { return _mm_xor_si128(self, _mm_set1_epi32(-1)); @@ -369,12 +369,12 @@ namespace xsimd { return _mm_or_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return _mm_or_si128(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_or(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_or_si128(self, other); @@ -393,7 +393,7 @@ namespace xsimd } // bitwise_rshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { if (std::is_signed::value) @@ -453,7 +453,7 @@ namespace xsimd } } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -524,7 +524,7 @@ namespace xsimd { return _mm_xor_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return _mm_xor_si128(self, other); @@ -539,29 +539,29 @@ namespace xsimd { return _mm_xor_pd(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_xor_si128(self, other); } // bitwise_cast - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castsi128_ps(self); } - template ::type>::value>::type> + template >::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return batch(self.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castps_si128(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castsi128_pd(self); @@ -576,7 +576,7 @@ namespace xsimd { return _mm_castpd_ps(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castpd_si128(self); @@ -588,7 +588,7 @@ namespace xsimd { return _mm_set1_ps(val); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -648,7 +648,7 @@ namespace xsimd } // decr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self + batch(mask.data); @@ -720,7 +720,7 @@ namespace xsimd { return _mm_castsi128_ps(_mm_cmpeq_epi32(_mm_castps_si128(self), _mm_castps_si128(other))); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -749,7 +749,7 @@ namespace xsimd return {}; } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return ~(self != other); @@ -778,7 +778,7 @@ namespace xsimd return _mm_cvtsd_f64(self); } - template ::value>::type> + template ::value>> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -849,7 +849,7 @@ namespace xsimd assert(!(mask & ~0x3ul) && "inbound mask"); return _mm_castsi128_pd(_mm_load_si128((const __m128i*)lut[mask])); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool from_mask(batch_bool const&, uint64_t mask, requires_arch) noexcept { alignas(A::alignment()) static const uint64_t lut64[] = { @@ -926,7 +926,7 @@ namespace xsimd { return _mm_cmpgt_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -982,14 +982,14 @@ namespace xsimd } // incr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self - batch(mask.data); } // insert - template ::value>::type> + template ::value>> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 2) @@ -1020,7 +1020,7 @@ namespace xsimd { return _mm_load_ps(mem); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return _mm_load_si128((__m128i const*)mem); @@ -1037,7 +1037,7 @@ namespace xsimd { return _mm_loadu_ps(mem); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return _mm_loadu_si128((__m128i const*)mem); @@ -1068,7 +1068,7 @@ namespace xsimd } // load_masked - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, Mode, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(mask.mask() == 0x1) @@ -1209,7 +1209,7 @@ namespace xsimd { return _mm_cmplt_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1314,7 +1314,7 @@ namespace xsimd } // mask - template ::value>::type> + template ::value>> XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1358,7 +1358,7 @@ namespace xsimd { return _mm_max_ps(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { return select(self > other, self, other); @@ -1375,7 +1375,7 @@ namespace xsimd { return _mm_min_ps(other, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { return select(self <= other, self, other); @@ -1414,7 +1414,7 @@ namespace xsimd } // neg - template ::value>::type> + template ::value>> XSIMD_INLINE batch neg(batch const& self, requires_arch) noexcept { return 0 - self; @@ -1438,7 +1438,7 @@ namespace xsimd { return _mm_cmpneq_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~(self == other); @@ -1448,7 +1448,7 @@ namespace xsimd { return _mm_xor_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_castps_si128(_mm_xor_ps(_mm_castsi128_ps(self.data), _mm_castsi128_ps(other.data))); @@ -1482,7 +1482,7 @@ namespace xsimd return _mm_cvtss_f32(tmp1); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -1520,7 +1520,7 @@ namespace xsimd } // reduce_max - template ::type> + template > XSIMD_INLINE T reduce_max(batch const& self, requires_arch) noexcept { constexpr auto mask0 = detail::shuffle(2, 3, 0, 0); @@ -1542,7 +1542,7 @@ namespace xsimd } // reduce_min - template ::type> + template > XSIMD_INLINE T reduce_min(batch const& self, requires_arch) noexcept { constexpr auto mask0 = detail::shuffle(2, 3, 0, 0); @@ -1578,7 +1578,7 @@ namespace xsimd return _mm_cvtsd_f64(_mm_mul_sd(self, _mm_unpackhi_pd(self, self))); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -1628,12 +1628,12 @@ namespace xsimd return _mm_or_ps(_mm_and_ps(cond, true_br), _mm_andnot_ps(cond, false_br)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { return _mm_or_si128(_mm_and_si128(cond, true_br), _mm_andnot_si128(cond, false_br)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool_constant const&, batch const& true_br, batch const& false_br, requires_arch) noexcept { return select(batch_bool { Values... }, true_br, false_br, sse2 {}); @@ -1701,7 +1701,7 @@ namespace xsimd // sadd - template ::value>::type> + template ::value>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1744,22 +1744,22 @@ namespace xsimd return _mm_setr_ps(values...); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1) noexcept { return _mm_set_epi64x(v1, v0); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3) noexcept { return _mm_setr_epi32(v0, v1, v2, v3); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7) noexcept { return _mm_setr_epi16(v0, v1, v2, v3, v4, v5, v6, v7); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15) noexcept { return _mm_setr_epi8(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); @@ -1772,7 +1772,7 @@ namespace xsimd return _mm_setr_pd(values...); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool set(batch_bool const&, requires_arch, Values... values) noexcept { return set(batch(), A {}, static_cast(values ? -1LL : 0LL)...).data; @@ -1794,7 +1794,7 @@ namespace xsimd // ssub - template ::value>::type> + template ::value>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1889,12 +1889,12 @@ namespace xsimd { return _mm_store_ps(mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return _mm_store_si128((__m128i*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm_store_si128((__m128i*)mem, self); @@ -1911,12 +1911,12 @@ namespace xsimd { return _mm_storeu_ps(mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return _mm_storeu_si128((__m128i*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm_storeu_si128((__m128i*)mem, self); @@ -1933,7 +1933,7 @@ namespace xsimd { return _mm_sub_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -2136,7 +2136,7 @@ namespace xsimd { return _mm_unpackhi_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -2173,7 +2173,7 @@ namespace xsimd { return _mm_unpacklo_ps(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) diff --git a/include/xsimd/arch/xsimd_sse3.hpp b/include/xsimd/arch/xsimd_sse3.hpp index 3e7cf9619..3ece0ae3b 100644 --- a/include/xsimd/arch/xsimd_sse3.hpp +++ b/include/xsimd/arch/xsimd_sse3.hpp @@ -36,7 +36,7 @@ namespace xsimd } // load_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return _mm_lddqu_si128((__m128i const*)mem); diff --git a/include/xsimd/arch/xsimd_sse4_1.hpp b/include/xsimd/arch/xsimd_sse4_1.hpp index 1a64fc878..030fb29db 100644 --- a/include/xsimd/arch/xsimd_sse4_1.hpp +++ b/include/xsimd/arch/xsimd_sse4_1.hpp @@ -24,7 +24,7 @@ namespace xsimd { using namespace types; // any - template ::value>::type> + template ::value>> XSIMD_INLINE bool any(batch const& self, requires_arch) noexcept { return !_mm_testz_si128(self, self); @@ -69,7 +69,7 @@ namespace xsimd } // eq - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 8) @@ -95,7 +95,7 @@ namespace xsimd } // insert - template ::value>::type> + template ::value>> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -125,7 +125,7 @@ namespace xsimd // load_unaligned - template ::value && sizeof(T) > 1)>::type> + template ::value && sizeof(T) > 1)>> XSIMD_INLINE batch_bool load_unaligned(bool const* mem, batch_bool, requires_arch) noexcept { // GCC <12 have missing or buggy unaligned load intrinsics; use memcpy to work around this. @@ -174,7 +174,7 @@ namespace xsimd } // max - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -218,7 +218,7 @@ namespace xsimd } // min - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -262,7 +262,7 @@ namespace xsimd } // mul - template ::value>::type> + template ::value>> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -318,7 +318,7 @@ namespace xsimd } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { return _mm_blendv_epi8(false_br, true_br, cond); @@ -334,7 +334,7 @@ namespace xsimd return _mm_blendv_pd(false_br, true_br, cond); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool_constant const&, batch const& true_br, batch const& false_br, requires_arch) noexcept { constexpr int mask = batch_bool_constant::mask(); diff --git a/include/xsimd/arch/xsimd_ssse3.hpp b/include/xsimd/arch/xsimd_ssse3.hpp index b86f08a2c..85e03288d 100644 --- a/include/xsimd/arch/xsimd_ssse3.hpp +++ b/include/xsimd/arch/xsimd_ssse3.hpp @@ -26,7 +26,7 @@ namespace xsimd using namespace types; // abs - template ::value && std::is_signed::value>::type> + template ::value && std::is_signed::value>> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -57,33 +57,33 @@ namespace xsimd { template - XSIMD_INLINE batch extract_pair(batch const&, batch const& other, std::size_t, ::xsimd::detail::index_sequence<>) noexcept + XSIMD_INLINE batch extract_pair(batch const&, batch const& other, std::size_t, std::index_sequence<>) noexcept { return other; } template - XSIMD_INLINE batch extract_pair(batch const& self, batch const& other, std::size_t i, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch extract_pair(batch const& self, batch const& other, std::size_t i, std::index_sequence) noexcept { if (i == I) { return _mm_alignr_epi8(self, other, sizeof(T) * I); } else - return extract_pair(self, other, i, ::xsimd::detail::index_sequence()); + return extract_pair(self, other, i, std::index_sequence()); } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch extract_pair(batch const& self, batch const& other, std::size_t i, requires_arch) noexcept { constexpr std::size_t size = batch::size; assert(i < size && "index in bounds"); - return detail::extract_pair(self, other, i, ::xsimd::detail::make_index_sequence()); + return detail::extract_pair(self, other, i, std::make_index_sequence()); } // reduce_add - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 2) @@ -141,7 +141,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value, batch>::type + XSIMD_INLINE std::enable_if_t::value, batch> swizzle(batch const& self, batch mask, requires_arch) noexcept { constexpr auto pikes = static_cast>(0x0706050403020100ul); diff --git a/include/xsimd/arch/xsimd_sve.hpp b/include/xsimd/arch/xsimd_sve.hpp index 4d81311f0..4a45e09aa 100644 --- a/include/xsimd/arch/xsimd_sve.hpp +++ b/include/xsimd/arch/xsimd_sve.hpp @@ -61,23 +61,23 @@ namespace xsimd // enable for signed integers template - using sve_enable_signed_int_t = typename std::enable_if::value && std::is_signed::value, int>::type; + using sve_enable_signed_int_t = std::enable_if_t::value && std::is_signed::value, int>; // enable for unsigned integers template - using sve_enable_unsigned_int_t = typename std::enable_if::value && !std::is_signed::value, int>::type; + using sve_enable_unsigned_int_t = std::enable_if_t::value && !std::is_signed::value, int>; // enable for floating points template - using sve_enable_floating_point_t = typename std::enable_if::value, int>::type; + using sve_enable_floating_point_t = std::enable_if_t::value, int>; // enable for signed integers or floating points template - using sve_enable_signed_int_or_floating_point_t = typename std::enable_if::value, int>::type; + using sve_enable_signed_int_or_floating_point_t = std::enable_if_t::value, int>; // enable for all SVE supported types template - using sve_enable_all_t = typename std::enable_if::value, int>::type; + using sve_enable_all_t = std::enable_if_t::value, int>; } // namespace detail /********* @@ -87,11 +87,11 @@ namespace xsimd namespace detail { // "char" is not allowed in SVE load/store operations - using sve_fix_char_t_impl = typename std::conditional::value, int8_t, uint8_t>::type; + using sve_fix_char_t_impl = std::conditional_t::value, int8_t, uint8_t>; template - using sve_fix_char_t = typename std::conditional::type>::value, - sve_fix_char_t_impl, T>::type; + using sve_fix_char_t = std::conditional_t>::value, + sve_fix_char_t_impl, T>; } template = 0> @@ -150,7 +150,7 @@ namespace xsimd template = 0> XSIMD_INLINE void store_complex_aligned(std::complex* dst, batch, A> const& src, requires_arch) noexcept { - using v2type = typename std::conditional<(sizeof(T) == 4), svfloat32x2_t, svfloat64x2_t>::type; + using v2type = std::conditional_t<(sizeof(T) == 4), svfloat32x2_t, svfloat64x2_t>; v2type tmp {}; tmp = svset2(tmp, 0, src.real()); tmp = svset2(tmp, 1, src.imag()); @@ -171,7 +171,7 @@ namespace xsimd namespace detail { template - using sve_enable_sg_t = typename std::enable_if<(sizeof(T) == sizeof(U) && (sizeof(T) == 4 || sizeof(T) == 8)), int>::type; + using sve_enable_sg_t = std::enable_if_t<(sizeof(T) == sizeof(U) && (sizeof(T) == 4 || sizeof(T) == 8)), int>; } // scatter @@ -299,7 +299,7 @@ namespace xsimd } // div - template = 4, int>::type = 0> + template = 4, int> = 0> XSIMD_INLINE batch div(batch const& lhs, batch const& rhs, requires_arch) noexcept { return svdiv_x(detail::sve_ptrue(), lhs, rhs); @@ -780,14 +780,14 @@ namespace xsimd namespace detail { template - XSIMD_INLINE batch sve_extract_pair(batch const&, batch const& /*rhs*/, std::size_t, ::xsimd::detail::index_sequence<>) noexcept + XSIMD_INLINE batch sve_extract_pair(batch const&, batch const& /*rhs*/, std::size_t, std::index_sequence<>) noexcept { assert(false && "extract_pair out of bounds"); return batch {}; } template - XSIMD_INLINE batch sve_extract_pair(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence) noexcept + XSIMD_INLINE batch sve_extract_pair(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence) noexcept { if (n == I) { @@ -795,12 +795,12 @@ namespace xsimd } else { - return sve_extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return sve_extract_pair(lhs, rhs, n, std::index_sequence()); } } template - XSIMD_INLINE batch sve_extract_pair_impl(batch const& lhs, batch const& rhs, std::size_t n, ::xsimd::detail::index_sequence<0, Is...>) noexcept + XSIMD_INLINE batch sve_extract_pair_impl(batch const& lhs, batch const& rhs, std::size_t n, std::index_sequence<0, Is...>) noexcept { if (n == 0) { @@ -808,7 +808,7 @@ namespace xsimd } else { - return sve_extract_pair(lhs, rhs, n, ::xsimd::detail::index_sequence()); + return sve_extract_pair(lhs, rhs, n, std::index_sequence()); } } } @@ -818,7 +818,7 @@ namespace xsimd { constexpr std::size_t size = batch::size; assert(n < size && "index in bounds"); - return detail::sve_extract_pair_impl(lhs, rhs, n, ::xsimd::detail::make_index_sequence()); + return detail::sve_extract_pair_impl(lhs, rhs, n, std::make_index_sequence()); } // select diff --git a/include/xsimd/arch/xsimd_vsx.hpp b/include/xsimd/arch/xsimd_vsx.hpp index 1ed91e0df..c07d3eab7 100644 --- a/include/xsimd/arch/xsimd_vsx.hpp +++ b/include/xsimd/arch/xsimd_vsx.hpp @@ -53,28 +53,28 @@ namespace xsimd } // add - template ::value>::type> + template ::value>> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { return vec_add(self.data, other.data); } // all - template ::value>::type> + template ::value>> XSIMD_INLINE bool all(batch_bool const& self, requires_arch) noexcept { return vec_all_ne(self.data, vec_xor(self.data, self.data)); } // any - template ::value>::type> + template ::value>> XSIMD_INLINE bool any(batch_bool const& self, requires_arch) noexcept { return vec_any_ne(self.data, vec_xor(self.data, self.data)); } // avgr - template ::value && sizeof(T) < 8>::type> + template ::value && sizeof(T) < 8>> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { return vec_avg(self.data, other.data); @@ -91,7 +91,7 @@ namespace xsimd } // avg - template ::value>::type> + template ::value>> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) < 8) @@ -124,31 +124,31 @@ namespace xsimd } // bitwise_and - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return vec_and(self.data, other.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_and(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return vec_and(self.data, other.data); } // bitwise_andnot - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return vec_and(self.data, vec_nor(other.data, other.data)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_andnot(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return self.data & ~other.data; } // bitwise_lshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { using shift_type = as_unsigned_integer_t; @@ -157,31 +157,31 @@ namespace xsimd } // bitwise_not - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return vec_nor(self.data, self.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_not(batch_bool const& self, requires_arch) noexcept { return vec_nor(self.data, self.data); } // bitwise_or - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return vec_or(self.data, other.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_or(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return vec_or(self.data, other.data); } // bitwise_rshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { using shift_type = as_unsigned_integer_t; @@ -197,12 +197,12 @@ namespace xsimd } // bitwise_xor - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return vec_xor(self.data, other.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool bitwise_xor(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return vec_xor(self.data, other.data); @@ -216,14 +216,14 @@ namespace xsimd } // broadcast - template ::value>::type> + template ::value>> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { return vec_splats(val); } // ceil - template ::value>::type> + template ::value>> XSIMD_INLINE batch ceil(batch const& self, requires_arch) noexcept { return vec_ceil(self.data); @@ -257,7 +257,7 @@ namespace xsimd } // decr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self + batch((typename batch::register_type)mask.data); @@ -329,13 +329,13 @@ namespace xsimd } // eq - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { auto res = vec_cmpeq(self.data, other.data); return *reinterpret_cast::register_type*>(&res); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { auto res = vec_cmpeq(self.data, other.data); @@ -343,28 +343,28 @@ namespace xsimd } // first - template ::value>::type> + template ::value>> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { return vec_extract(self.data, 0); } // floor - template ::value>::type> + template ::value>> XSIMD_INLINE batch floor(batch const& self, requires_arch) noexcept { return vec_floor(self.data); } // ge - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return vec_cmpge(self.data, other.data); } // gt - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { return vec_cmpgt(self.data, other.data); @@ -397,14 +397,14 @@ namespace xsimd } // incr_if - template ::value>::type> + template ::value>> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self - batch((typename batch::register_type)mask.data); } // insert - template ::value>::type> + template ::value>> XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept { return vec_insert(val, self.data, I); @@ -423,14 +423,14 @@ namespace xsimd } // load_aligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return vec_ld(0, reinterpret_cast::register_type*>(mem)); } // load_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return vec_vsx_ld(0, (typename batch::register_type const*)mem); @@ -454,54 +454,54 @@ namespace xsimd } // le - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return vec_cmple(self.data, other.data); } // lt - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return vec_cmplt(self.data, other.data); } // max - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { return vec_max(self.data, other.data); } // min - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { return vec_min(self.data, other.data); } // mul - template ::value>::type> + template ::value>> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { return self.data * other.data; } // neg - template ::value>::type> + template ::value>> XSIMD_INLINE batch neg(batch const& self, requires_arch) noexcept { return -(self.data); } // neq - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~vec_cmpeq(self.data, other.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return ~vec_cmpeq(self.data, other.data); @@ -557,7 +557,7 @@ namespace xsimd auto tmp1 = vec_add(self.data, tmp0); // v0 + v1, v1 + v0 return vec_extract(tmp1, 0); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { return reduce_add(self, common {}); @@ -599,14 +599,14 @@ namespace xsimd auto tmp1 = vec_mul(self.data, tmp0); // v0 * v1, v1 * v0 return vec_extract(tmp1, 0); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { return reduce_mul(self, common {}); } // round - template ::value>::type> + template ::value>> XSIMD_INLINE batch round(batch const& self, requires_arch) noexcept { return vec_round(self.data); @@ -625,12 +625,12 @@ namespace xsimd } // select - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { return vec_sel(false_br.data, true_br.data, cond.data); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool_constant const&, batch const& true_br, batch const& false_br, requires_arch) noexcept { return select(batch_bool { Values... }, true_br, false_br, vsx {}); @@ -716,7 +716,7 @@ namespace xsimd } // sadd - template ::value && sizeof(T) != 8>::type> + template ::value && sizeof(T) != 8>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { return vec_adds(self.data, other.data); @@ -730,7 +730,7 @@ namespace xsimd return typename batch::register_type { values... }; } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool set(batch_bool const&, requires_arch, Values... values) noexcept { static_assert(sizeof...(Values) == batch_bool::size, "consistent init"); @@ -739,28 +739,28 @@ namespace xsimd // ssub - template ::value && sizeof(T) == 1>::type> + template ::value && sizeof(T) == 1>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { return vec_subs(self.data, other.data); } // store_aligned - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return vec_st(self.data, 0, reinterpret_cast::register_type*>(mem)); } // store_unaligned - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return vec_vsx_st(self.data, 0, reinterpret_cast::register_type*>(mem)); } // sub - template ::value>::type> + template ::value>> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { return vec_sub(self.data, other.data); @@ -868,7 +868,7 @@ namespace xsimd } // trunc - template ::value>::type> + template ::value>> XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept { return vec_trunc(self.data); @@ -880,7 +880,7 @@ namespace xsimd { return { batch(vec_doublel(x.data)), batch(vec_doubleh(x.data)) }; } - template ::value>::type> + template ::value>> XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept { auto even = vec_mule(x.data, vec_splats(T(1))); // x0, x2, x4, x6 @@ -889,14 +889,14 @@ namespace xsimd } // zip_hi - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { return vec_mergel(self.data, other.data); } // zip_lo - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { return vec_mergeh(self.data, other.data); diff --git a/include/xsimd/arch/xsimd_wasm.hpp b/include/xsimd/arch/xsimd_wasm.hpp index 1d415f448..9e437dfb1 100644 --- a/include/xsimd/arch/xsimd_wasm.hpp +++ b/include/xsimd/arch/xsimd_wasm.hpp @@ -44,7 +44,7 @@ namespace xsimd XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; // abs - template ::value && std::is_signed::value>::type> + template ::value && std::is_signed::value>> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -83,7 +83,7 @@ namespace xsimd } // add - template ::value>::type> + template ::value>> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -122,7 +122,7 @@ namespace xsimd } // avgr - template ::value>::type> + template ::value>> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -140,7 +140,7 @@ namespace xsimd } // avg - template ::value>::type> + template ::value>> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -170,7 +170,7 @@ namespace xsimd { return wasm_i64x2_bitmask(self) == 0x03; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool all(batch_bool const& self, requires_arch) noexcept { return wasm_i8x16_bitmask(self) == 0xFFFF; @@ -187,7 +187,7 @@ namespace xsimd { return wasm_i64x2_bitmask(self) != 0; } - template ::value>::type> + template ::value>> XSIMD_INLINE bool any(batch_bool const& self, requires_arch) noexcept { return wasm_i8x16_bitmask(self) != 0; @@ -247,7 +247,7 @@ namespace xsimd } // bitwise_lshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -274,7 +274,7 @@ namespace xsimd } // bitwise_rshift - template ::value>::type> + template ::value>> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { if (std::is_signed::value) @@ -359,7 +359,7 @@ namespace xsimd { return wasm_f32x4_splat(val); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -425,7 +425,7 @@ namespace xsimd { return wasm_i32x4_eq(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -450,7 +450,7 @@ namespace xsimd return {}; } } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool eq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -538,7 +538,7 @@ namespace xsimd { return wasm_f32x4_extract_lane(self, 0); } - template ::value>::type> + template ::value>> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -619,7 +619,7 @@ namespace xsimd assert(!(mask & ~0x3ul) && "inbound mask"); return wasm_v128_load((const v128_t*)lut[mask]); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool from_mask(batch_bool const&, uint64_t mask, requires_arch) noexcept { alignas(A::alignment()) static const uint64_t lut64[] = { @@ -722,7 +722,7 @@ namespace xsimd { return wasm_f32x4_gt(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -803,7 +803,7 @@ namespace xsimd { return wasm_f32x4_replace_lane(self, pos, val); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { if (std::is_signed::value) @@ -892,7 +892,7 @@ namespace xsimd { return wasm_v128_load(mem); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return wasm_v128_load((v128_t const*)mem); @@ -924,7 +924,7 @@ namespace xsimd { return wasm_v128_load(mem); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return wasm_v128_load((v128_t const*)mem); @@ -941,7 +941,7 @@ namespace xsimd { return wasm_f32x4_lt(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1009,7 +1009,7 @@ namespace xsimd } // mask - template ::value>::type> + template ::value>> XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1052,7 +1052,7 @@ namespace xsimd { return wasm_f32x4_pmax(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { return select(self > other, self, other); @@ -1069,7 +1069,7 @@ namespace xsimd { return wasm_f32x4_pmin(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { return select(self <= other, self, other); @@ -1093,7 +1093,7 @@ namespace xsimd } // neg - template ::value>::type> + template ::value>> XSIMD_INLINE batch neg(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1137,7 +1137,7 @@ namespace xsimd { return wasm_f32x4_ne(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~(self == other); @@ -1147,7 +1147,7 @@ namespace xsimd { return wasm_v128_xor(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool neq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return ~(self == other); @@ -1188,7 +1188,7 @@ namespace xsimd v128_t tmp3 = wasm_i32x4_shuffle(tmp0, tmp2, 4, 1, 2, 3); return wasm_f32x4_extract_lane(tmp3, 0); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -1229,7 +1229,7 @@ namespace xsimd v128_t tmp3 = wasm_i32x4_shuffle(tmp0, tmp2, 4, 1, 2, 3); return wasm_f32x4_extract_lane(tmp3, 0); } - template ::value>::type> + template ::value>> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 4) @@ -1307,7 +1307,7 @@ namespace xsimd } // sadd - template ::value>::type> + template ::value>> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1349,12 +1349,12 @@ namespace xsimd return wasm_v128_or(wasm_v128_and(cond, true_br), wasm_v128_andnot(false_br, cond)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { return wasm_v128_or(wasm_v128_and(cond, true_br), wasm_v128_andnot(false_br, cond)); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch select(batch_bool_constant const&, batch const& true_br, batch const& false_br, requires_arch) noexcept { return select(batch_bool { Values... }, true_br, false_br, wasm {}); @@ -1386,25 +1386,25 @@ namespace xsimd return wasm_f32x4_make(values...); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1) noexcept { return wasm_i64x2_make(v0, v1); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3) noexcept { return wasm_i32x4_make(v0, v1, v2, v3); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7) noexcept { return wasm_i16x8_make(v0, v1, v2, v3, v4, v5, v6, v7); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, T v8, T v9, T v10, T v11, T v12, T v13, T v14, T v15) noexcept { return wasm_i8x16_make(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); @@ -1417,7 +1417,7 @@ namespace xsimd return wasm_f64x2_make(values...); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch_bool set(batch_bool const&, requires_arch, Values... values) noexcept { return set(batch(), A {}, static_cast(values ? -1LL : 0LL)...).data; @@ -1438,7 +1438,7 @@ namespace xsimd } // ssub - template ::value>::type> + template ::value>> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) @@ -1479,12 +1479,12 @@ namespace xsimd { return wasm_v128_store(mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return wasm_v128_store((v128_t*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_aligned(T* mem, batch_bool const& self, requires_arch) noexcept { return wasm_v128_store((v128_t*)mem, self); @@ -1528,12 +1528,12 @@ namespace xsimd { return wasm_v128_store(mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return wasm_v128_store((v128_t*)mem, self); } - template ::value>::type> + template ::value>> XSIMD_INLINE void store_unaligned(T* mem, batch_bool const& self, requires_arch) noexcept { return wasm_v128_store((v128_t*)mem, self); @@ -1550,7 +1550,7 @@ namespace xsimd { return wasm_f32x4_sub(self, other); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1746,7 +1746,7 @@ namespace xsimd { return wasm_i32x4_shuffle(self, other, 2, 6, 3, 7); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) @@ -1783,7 +1783,7 @@ namespace xsimd { return wasm_i32x4_shuffle(self, other, 0, 4, 1, 5); } - template ::value>::type> + template ::value>> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { XSIMD_IF_CONSTEXPR(sizeof(T) == 1) diff --git a/include/xsimd/config/xsimd_arch.hpp b/include/xsimd/config/xsimd_arch.hpp index ddd78e13d..d69ff7560 100644 --- a/include/xsimd/config/xsimd_arch.hpp +++ b/include/xsimd/config/xsimd_arch.hpp @@ -133,8 +133,8 @@ namespace xsimd template struct supported_helper> : supported_helper< - typename std::conditional, L>::type, + std::conditional_t, L>, arch_list> { }; @@ -198,14 +198,14 @@ namespace xsimd F functor; template - XSIMD_INLINE auto walk_archs(arch_list, Tys&&... args) noexcept -> decltype(functor(Arch {}, std::forward(args)...)) + XSIMD_INLINE auto walk_archs(arch_list, Tys&&... args) noexcept { assert(Arch::available() && "At least one arch must be supported during dispatch"); return functor(Arch {}, std::forward(args)...); } template - XSIMD_INLINE auto walk_archs(arch_list, Tys&&... args) noexcept -> decltype(functor(Arch {}, std::forward(args)...)) + XSIMD_INLINE auto walk_archs(arch_list, Tys&&... args) noexcept { if (availables_archs.has(Arch {})) return functor(Arch {}, std::forward(args)...); @@ -221,7 +221,7 @@ namespace xsimd } template - XSIMD_INLINE auto operator()(Tys&&... args) noexcept -> decltype(functor(default_arch {}, std::forward(args)...)) + XSIMD_INLINE auto operator()(Tys&&... args) noexcept { return walk_archs(ArchList {}, std::forward(args)...); } diff --git a/include/xsimd/memory/xsimd_aligned_allocator.hpp b/include/xsimd/memory/xsimd_aligned_allocator.hpp index 6d4431f13..f6f446ac6 100644 --- a/include/xsimd/memory/xsimd_aligned_allocator.hpp +++ b/include/xsimd/memory/xsimd_aligned_allocator.hpp @@ -341,9 +341,9 @@ namespace xsimd } template - using default_allocator = typename std::conditional, - std::allocator>::type; + using default_allocator = std::conditional_t, + std::allocator>; } #endif diff --git a/include/xsimd/types/xsimd_api.hpp b/include/xsimd/types/xsimd_api.hpp index 960350331..aa64df4da 100644 --- a/include/xsimd/types/xsimd_api.hpp +++ b/include/xsimd/types/xsimd_api.hpp @@ -83,7 +83,7 @@ namespace xsimd * @return the sum of \c x and \c y */ template - XSIMD_INLINE auto add(batch const& x, batch const& y) noexcept -> decltype(x + y) + XSIMD_INLINE batch add(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x + y; @@ -287,7 +287,7 @@ namespace xsimd * @return the result of the bitwise and. */ template - XSIMD_INLINE auto bitwise_and(batch const& x, batch const& y) noexcept -> decltype(x & y) + XSIMD_INLINE batch bitwise_and(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x & y; @@ -302,7 +302,7 @@ namespace xsimd * @return the result of the bitwise and. */ template - XSIMD_INLINE auto bitwise_and(batch_bool const& x, batch_bool const& y) noexcept -> decltype(x & y) + XSIMD_INLINE batch_bool bitwise_and(batch_bool const& x, batch_bool const& y) noexcept { detail::static_check_supported_config(); return x & y; @@ -417,7 +417,7 @@ namespace xsimd * @return the result of the bitwise or. */ template - XSIMD_INLINE auto bitwise_or(batch const& x, batch const& y) noexcept -> decltype(x | y) + XSIMD_INLINE batch bitwise_or(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x | y; @@ -432,7 +432,7 @@ namespace xsimd * @return the result of the bitwise or. */ template - XSIMD_INLINE auto bitwise_or(batch_bool const& x, batch_bool const& y) noexcept -> decltype(x | y) + XSIMD_INLINE batch_bool bitwise_or(batch_bool const& x, batch_bool const& y) noexcept { detail::static_check_supported_config(); return x | y; @@ -474,7 +474,7 @@ namespace xsimd * @return the result of the bitwise xor. */ template - XSIMD_INLINE auto bitwise_xor(batch const& x, batch const& y) noexcept -> decltype(x ^ y) + XSIMD_INLINE batch bitwise_xor(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x ^ y; @@ -489,7 +489,7 @@ namespace xsimd * @return the result of the bitwise xor. */ template - XSIMD_INLINE auto bitwise_xor(batch_bool const& x, batch_bool const& y) noexcept -> decltype(x ^ y) + XSIMD_INLINE batch_bool bitwise_xor(batch_bool const& x, batch_bool const& y) noexcept { detail::static_check_supported_config(); return x ^ y; @@ -524,9 +524,9 @@ namespace xsimd { detail::static_check_supported_config(); using batch_value_type = typename simd_return_type::value_type; - using value_type = typename std::conditional::value, - bool, - batch_value_type>::type; + using value_type = std::conditional_t::value, + bool, + batch_value_type>; return simd_return_type(value_type(v)); } @@ -699,7 +699,7 @@ namespace xsimd * @return the result of the division. */ template - XSIMD_INLINE auto div(batch const& x, batch const& y) noexcept -> decltype(x / y) + XSIMD_INLINE batch div(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x / y; @@ -714,7 +714,7 @@ namespace xsimd * @return a boolean batch. */ template - XSIMD_INLINE auto eq(batch const& x, batch const& y) noexcept -> decltype(x == y) + XSIMD_INLINE auto eq(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x == y; @@ -729,7 +729,7 @@ namespace xsimd * @return a boolean batch. */ template - XSIMD_INLINE auto eq(batch_bool const& x, batch_bool const& y) noexcept -> decltype(x == y) + XSIMD_INLINE batch_bool eq(batch_bool const& x, batch_bool const& y) noexcept { detail::static_check_supported_config(); return x == y; @@ -1607,7 +1607,7 @@ namespace xsimd * @return the result of the modulo. */ template - XSIMD_INLINE auto mod(batch const& x, batch const& y) noexcept -> decltype(x % y) + XSIMD_INLINE batch mod(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x % y; @@ -1623,7 +1623,7 @@ namespace xsimd * @return the result of the product. */ template - XSIMD_INLINE auto mul(batch const& x, batch const& y) noexcept -> decltype(x * y) + XSIMD_INLINE batch mul(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x * y; @@ -1671,7 +1671,7 @@ namespace xsimd * @return a boolean batch. */ template - XSIMD_INLINE auto neq(batch const& x, batch const& y) noexcept -> decltype(x != y) + XSIMD_INLINE auto neq(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x != y; @@ -1686,7 +1686,7 @@ namespace xsimd * @return a boolean batch. */ template - XSIMD_INLINE auto neq(batch_bool const& x, batch_bool const& y) noexcept -> decltype(x != y) + XSIMD_INLINE batch_bool neq(batch_bool const& x, batch_bool const& y) noexcept { detail::static_check_supported_config(); return x != y; @@ -1822,7 +1822,7 @@ namespace xsimd * @param y batch of integral values. * @return \c x raised to the power \c y. */ - template ::value>::type> + template ::value>> XSIMD_INLINE batch pow(batch const& x, ITy y) noexcept { detail::static_check_supported_config(); @@ -1866,7 +1866,7 @@ namespace xsimd * @param x batch of floating point numbers. * @return the reciprocal. */ - template ::value>::type> + template ::value>> XSIMD_INLINE batch reciprocal(batch const& x) noexcept { detail::static_check_supported_config(); @@ -2239,7 +2239,7 @@ namespace xsimd * @return combined batch */ template - XSIMD_INLINE typename std::enable_if::value, batch>::type + XSIMD_INLINE std::enable_if_t::value, batch> shuffle(batch const& x, batch const& y, batch_constant mask) noexcept { static_assert(sizeof(T) == sizeof(Vt), "consistent mask"); @@ -2572,7 +2572,7 @@ namespace xsimd * @return the difference between \c x and \c y */ template - XSIMD_INLINE auto sub(batch const& x, batch const& y) noexcept -> decltype(x - y) + XSIMD_INLINE batch sub(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); return x - y; @@ -2588,7 +2588,7 @@ namespace xsimd * @return swizzled batch */ template - XSIMD_INLINE typename std::enable_if::value, batch>::type + XSIMD_INLINE std::enable_if_t::value, batch> swizzle(batch const& x, batch_constant mask) noexcept { static_assert(sizeof(T) == sizeof(Vt), "consistent mask"); @@ -2614,7 +2614,7 @@ namespace xsimd * @return swizzled batch */ template - XSIMD_INLINE typename std::enable_if::value, batch>::type + XSIMD_INLINE std::enable_if_t::value, batch> swizzle(batch const& x, batch mask) noexcept { static_assert(sizeof(T) == sizeof(Vt), "consistent mask"); @@ -2776,7 +2776,7 @@ namespace xsimd * @param self batch_bool of \c T * @return \c self cast to a \c batch of \c T */ - template ::value, int>::type = 3> + template ::value, int> = 3> XSIMD_INLINE batch bitwise_cast(batch_bool const& self) noexcept { T z(0); @@ -2784,7 +2784,7 @@ namespace xsimd return select(self, batch(T(~z)), batch(z)); } - template ::value, int>::type = 3> + template ::value, int> = 3> XSIMD_INLINE batch bitwise_cast(batch_bool const& self) noexcept { T z0(0), z1(0); diff --git a/include/xsimd/types/xsimd_avx512f_register.hpp b/include/xsimd/types/xsimd_avx512f_register.hpp index c7af6d9f7..279ae4caa 100644 --- a/include/xsimd/types/xsimd_avx512f_register.hpp +++ b/include/xsimd/types/xsimd_avx512f_register.hpp @@ -42,9 +42,9 @@ namespace xsimd template struct simd_avx512_bool_register { - using register_type = typename std::conditional< - (sizeof(T) < 4), std::conditional<(sizeof(T) == 1), __mmask64, __mmask32>, - std::conditional<(sizeof(T) == 4), __mmask16, __mmask8>>::type::type; + using register_type = std::conditional_t< + (sizeof(T) < 4), std::conditional_t<(sizeof(T) == 1), __mmask64, __mmask32>, + std::conditional_t<(sizeof(T) == 4), __mmask16, __mmask8>>; register_type data; simd_avx512_bool_register() = default; simd_avx512_bool_register(register_type r) { data = r; } diff --git a/include/xsimd/types/xsimd_batch.hpp b/include/xsimd/types/xsimd_batch.hpp index 7ee1572d6..5ff525a11 100644 --- a/include/xsimd/types/xsimd_batch.hpp +++ b/include/xsimd/types/xsimd_batch.hpp @@ -354,10 +354,10 @@ namespace xsimd private: template - static XSIMD_INLINE register_type make_register(detail::index_sequence, U u, V... v) noexcept; + static XSIMD_INLINE register_type make_register(std::index_sequence, U u, V... v) noexcept; template - static XSIMD_INLINE register_type make_register(detail::index_sequence<>, V... v) noexcept; + static XSIMD_INLINE register_type make_register(std::index_sequence<>, V... v) noexcept; }; #if __cplusplus < 201703L @@ -1166,20 +1166,20 @@ namespace xsimd template XSIMD_INLINE batch_bool::batch_bool(bool val) noexcept - : base_type { make_register(detail::make_index_sequence(), val) } + : base_type { make_register(std::make_index_sequence(), val) } { } template template - XSIMD_INLINE auto batch_bool::make_register(detail::index_sequence, U u, V... v) noexcept -> register_type + XSIMD_INLINE auto batch_bool::make_register(std::index_sequence, U u, V... v) noexcept -> register_type { - return make_register(detail::index_sequence(), u, u, v...); + return make_register(std::index_sequence(), u, u, v...); } template template - XSIMD_INLINE auto batch_bool::make_register(detail::index_sequence<>, V... v) noexcept -> register_type + XSIMD_INLINE auto batch_bool::make_register(std::index_sequence<>, V... v) noexcept -> register_type { return kernel::set(batch_bool(), A {}, v...).data; } @@ -1576,10 +1576,10 @@ namespace xsimd template struct sized_batch> { - using type = typename std::conditional< + using type = std::conditional_t< batch_trait::size == N, typename batch_trait::type, - typename sized_batch>::type>::type; + typename sized_batch>::type>; }; } diff --git a/include/xsimd/types/xsimd_batch_constant.hpp b/include/xsimd/types/xsimd_batch_constant.hpp index dca229cf9..10fff0df0 100644 --- a/include/xsimd/types/xsimd_batch_constant.hpp +++ b/include/xsimd/types/xsimd_batch_constant.hpp @@ -13,6 +13,7 @@ #define XSIMD_BATCH_CONSTANT_HPP #include +#include #include #include "./xsimd_batch.hpp" @@ -121,24 +122,22 @@ namespace xsimd template static constexpr batch_bool_constant::type::value, std::tuple_element::type::value)...> - apply(detail::index_sequence) + apply(std::index_sequence) { return {}; } template static constexpr auto apply(batch_bool_constant, batch_bool_constant) - -> decltype(apply...>, std::tuple...>>(detail::make_index_sequence())) { static_assert(sizeof...(Values) == sizeof...(OtherValues), "compatible constant batches"); - return {}; + return apply...>, std::tuple...>>(std::make_index_sequence()); } public: #define MAKE_BINARY_OP(OP, NAME) \ template \ constexpr auto operator OP(batch_bool_constant other) const \ - -> decltype(apply(*this, other)) \ { \ return apply(*this, other); \ } @@ -212,11 +211,11 @@ namespace xsimd namespace detail { template - XSIMD_INLINE constexpr auto splice_impl(index_sequence) noexcept - -> batch_bool_constant< - T, A2, - std::tuple_element...>>::type::value...> + XSIMD_INLINE constexpr batch_bool_constant< + T, A2, + std::tuple_element...>>::type::value...> + splice_impl(std::index_sequence) noexcept { return {}; } @@ -225,32 +224,29 @@ namespace xsimd typename T, class A, bool... Values, std::size_t N = (End >= Begin ? (End - Begin) : 0)> XSIMD_INLINE constexpr auto splice(batch_bool_constant) noexcept - -> decltype(splice_impl(make_index_sequence())) { static_assert(Begin <= End, "splice: Begin must be <= End"); static_assert(End <= sizeof...(Values), "splice: End must be <= size"); static_assert(N == batch_bool::size, "splice: target arch size must match submask length"); - return {}; + return splice_impl(std::make_index_sequence()); } template XSIMD_INLINE constexpr auto lower_half(batch_bool_constant) noexcept - -> decltype(splice_impl(make_index_sequence())) { static_assert(sizeof...(Values) % 2 == 0, "lower_half requires even size"); static_assert(batch_bool::size == sizeof...(Values) / 2, "lower_half: target arch size must match submask length"); - return {}; + return splice_impl(std::make_index_sequence()); } template XSIMD_INLINE constexpr auto upper_half(batch_bool_constant) noexcept - -> decltype(splice_impl(make_index_sequence())) { static_assert(sizeof...(Values) % 2 == 0, "upper_half requires even size"); static_assert(batch_bool::size == sizeof...(Values) / 2, "upper_half: target arch size must match submask length"); - return {}; + return splice_impl(std::make_index_sequence()); } } // namespace detail @@ -294,42 +290,12 @@ namespace xsimd return values[i]; } - struct arithmetic_add - { - constexpr T operator()(T x, T y) const { return x + y; } - }; - struct arithmetic_sub - { - constexpr T operator()(T x, T y) const { return x - y; } - }; - struct arithmetic_mul - { - constexpr T operator()(T x, T y) const { return x * y; } - }; - struct arithmetic_div - { - constexpr T operator()(T x, T y) const { return x / y; } - }; - struct arithmetic_mod - { - constexpr T operator()(T x, T y) const { return x % y; } - }; - struct binary_and - { - constexpr T operator()(T x, T y) const { return x & y; } - }; - struct binary_or - { - constexpr T operator()(T x, T y) const { return x | y; } - }; - struct binary_xor - { - constexpr T operator()(T x, T y) const { return x ^ y; } - }; + template struct binary_rshift { constexpr T operator()(T x, T y) const { return x >> y; } }; + template struct binary_lshift { constexpr T operator()(T x, T y) const { return x << y; } @@ -337,95 +303,66 @@ namespace xsimd template static constexpr batch_constant::type::value, std::tuple_element::type::value)...> - apply(detail::index_sequence) + apply(std::index_sequence) { return {}; } template static constexpr auto apply(batch_constant, batch_constant) - -> decltype(apply...>, std::tuple...>>(detail::make_index_sequence())) { static_assert(sizeof...(Values) == sizeof...(OtherValues), "compatible constant batches"); - return {}; + return apply...>, std::tuple...>>(std::make_index_sequence()); } public: #define MAKE_BINARY_OP(OP, NAME) \ template \ constexpr auto operator OP(batch_constant other) const \ - -> decltype(apply(*this, other)) \ { \ - return apply(*this, other); \ + return apply>(*this, other); \ } - MAKE_BINARY_OP(+, arithmetic_add) - MAKE_BINARY_OP(-, arithmetic_sub) - MAKE_BINARY_OP(*, arithmetic_mul) - MAKE_BINARY_OP(/, arithmetic_div) - MAKE_BINARY_OP(%, arithmetic_mod) - MAKE_BINARY_OP(&, binary_and) - MAKE_BINARY_OP(|, binary_or) - MAKE_BINARY_OP(^, binary_xor) + MAKE_BINARY_OP(+, std::plus) + MAKE_BINARY_OP(-, std::minus) + MAKE_BINARY_OP(*, std::multiplies) + MAKE_BINARY_OP(/, std::divides) + MAKE_BINARY_OP(%, std::modulus) + MAKE_BINARY_OP(&, std::bit_and) + MAKE_BINARY_OP(|, std::bit_or) + MAKE_BINARY_OP(^, std::bit_xor) MAKE_BINARY_OP(<<, binary_lshift) MAKE_BINARY_OP(>>, binary_rshift) #undef MAKE_BINARY_OP - struct boolean_eq - { - constexpr bool operator()(T x, T y) const { return x == y; } - }; - struct boolean_ne - { - constexpr bool operator()(T x, T y) const { return x != y; } - }; - struct boolean_gt - { - constexpr bool operator()(T x, T y) const { return x > y; } - }; - struct boolean_ge - { - constexpr bool operator()(T x, T y) const { return x >= y; } - }; - struct boolean_lt - { - constexpr bool operator()(T x, T y) const { return x < y; } - }; - struct boolean_le - { - constexpr bool operator()(T x, T y) const { return x <= y; } - }; - template static constexpr batch_bool_constant::type::value, std::tuple_element::type::value)...> - apply_bool(detail::index_sequence) + apply_bool(std::index_sequence) { return {}; } template static constexpr auto apply_bool(batch_constant, batch_constant) - -> decltype(apply_bool...>, std::tuple...>>(detail::make_index_sequence())) { static_assert(sizeof...(Values) == sizeof...(OtherValues), "compatible constant batches"); - return {}; + return apply_bool...>, std::tuple...>>(std::make_index_sequence()); } #define MAKE_BINARY_BOOL_OP(OP, NAME) \ template \ constexpr auto operator OP(batch_constant other) const \ - -> decltype(apply_bool(*this, other)) \ { \ - return {}; \ + return apply_bool>(*this, other); \ } - MAKE_BINARY_BOOL_OP(==, boolean_eq) - MAKE_BINARY_BOOL_OP(!=, boolean_ne) - MAKE_BINARY_BOOL_OP(<, boolean_lt) - MAKE_BINARY_BOOL_OP(<=, boolean_le) - MAKE_BINARY_BOOL_OP(>, boolean_gt) - MAKE_BINARY_BOOL_OP(>=, boolean_ge) + MAKE_BINARY_BOOL_OP(==, std::equal_to) + MAKE_BINARY_BOOL_OP(!=, std::not_equal_to) + MAKE_BINARY_BOOL_OP(<, std::less) + MAKE_BINARY_BOOL_OP(<=, std::less_equal) + MAKE_BINARY_BOOL_OP(>, std::greater) + MAKE_BINARY_BOOL_OP(>=, std::greater_equal) #undef MAKE_BINARY_BOOL_OP @@ -449,28 +386,28 @@ namespace xsimd { template XSIMD_INLINE constexpr batch_constant - make_batch_constant(detail::index_sequence) noexcept + make_batch_constant(std::index_sequence) noexcept { return {}; } template XSIMD_INLINE constexpr batch_constant(0 * Is) + Val)...> - make_batch_constant(detail::index_sequence) noexcept + make_batch_constant(std::index_sequence) noexcept { return {}; } template XSIMD_INLINE constexpr batch_bool_constant - make_batch_bool_constant(detail::index_sequence) noexcept + make_batch_bool_constant(std::index_sequence) noexcept { return {}; } template XSIMD_INLINE constexpr batch_bool_constant(Is) | true) & Val)...> - make_batch_bool_constant(detail::index_sequence) noexcept + make_batch_bool_constant(std::index_sequence) noexcept { return {}; } @@ -498,7 +435,7 @@ namespace xsimd * @endcode */ template - XSIMD_INLINE constexpr decltype(detail::make_batch_constant(detail::make_index_sequence::size>())) + XSIMD_INLINE constexpr decltype(detail::make_batch_constant(std::make_index_sequence::size>())) make_batch_constant() noexcept { return {}; @@ -510,7 +447,7 @@ namespace xsimd * Similar to @c make_batch_constant for @c batch_bool_constant */ template - XSIMD_INLINE constexpr decltype(detail::make_batch_bool_constant(detail::make_index_sequence::size>())) + XSIMD_INLINE constexpr decltype(detail::make_batch_bool_constant(std::make_index_sequence::size>())) make_batch_bool_constant() noexcept { return {}; @@ -526,7 +463,7 @@ namespace xsimd * @tparam A Architecture that will be used when converting to a regular batch. */ template - XSIMD_INLINE constexpr decltype(detail::make_batch_constant(detail::make_index_sequence::size>())) + XSIMD_INLINE constexpr decltype(detail::make_batch_constant(std::make_index_sequence::size>())) make_batch_constant() noexcept { return {}; @@ -538,7 +475,7 @@ namespace xsimd * Similar to @c make_batch_constant for @c batch_bool_constant */ template - XSIMD_INLINE constexpr decltype(detail::make_batch_bool_constant(detail::make_index_sequence::size>())) + XSIMD_INLINE constexpr decltype(detail::make_batch_bool_constant(std::make_index_sequence::size>())) make_batch_bool_constant() noexcept { return {}; diff --git a/include/xsimd/types/xsimd_neon_register.hpp b/include/xsimd/types/xsimd_neon_register.hpp index 4f40a4287..ef9973828 100644 --- a/include/xsimd/types/xsimd_neon_register.hpp +++ b/include/xsimd/types/xsimd_neon_register.hpp @@ -78,13 +78,13 @@ namespace xsimd using unsigned_neon_vector_type = typename neon_vector_type_impl<8 * sizeof(T)>::unsigned_type; template - using neon_vector_type = typename std::conditional::value, - signed_neon_vector_type, - unsigned_neon_vector_type>::type; + using neon_vector_type = std::conditional_t::value, + signed_neon_vector_type, + unsigned_neon_vector_type>; - using char_neon_vector_type = typename std::conditional::value, - signed_neon_vector_type, - unsigned_neon_vector_type>::type; + using char_neon_vector_type = std::conditional_t::value, + signed_neon_vector_type, + unsigned_neon_vector_type>; } XSIMD_DECLARE_SIMD_REGISTER(signed char, neon, detail::neon_vector_type); diff --git a/include/xsimd/types/xsimd_register.hpp b/include/xsimd/types/xsimd_register.hpp index a838f8786..018418af6 100644 --- a/include/xsimd/types/xsimd_register.hpp +++ b/include/xsimd/types/xsimd_register.hpp @@ -83,7 +83,7 @@ namespace xsimd { template // makes requires_arch equal to A const&, using type_traits functions - using requires_arch = typename std::add_lvalue_reference::type>::type; + using requires_arch = std::add_lvalue_reference_t>; template struct convert { diff --git a/include/xsimd/types/xsimd_rvv_register.hpp b/include/xsimd/types/xsimd_rvv_register.hpp index 268e27e82..e56cb5261 100644 --- a/include/xsimd/types/xsimd_rvv_register.hpp +++ b/include/xsimd/types/xsimd_rvv_register.hpp @@ -298,11 +298,11 @@ namespace xsimd // It's difficult dealing with both char and whichever *int8_t type // is compatible with char, so just avoid it altogether. // - using rvv_char_t = typename std::conditional::value, int8_t, uint8_t>::type; + using rvv_char_t = std::conditional_t::value, int8_t, uint8_t>; template - using rvv_fix_char_t = typename std::conditional< - std::is_same::type>::value, - rvv_char_t, T>::type; + using rvv_fix_char_t = std::conditional_t< + std::is_same>::value, + rvv_char_t, T>; // An explicit constructor isn't really explicit enough to allow // implicit bit-casting operations between incompatible types, so @@ -342,7 +342,7 @@ namespace xsimd operator register_type() const noexcept { return value.get(); } }; template - using rvv_reg_t = typename std::conditional::value, rvv_reg, Width>, void>::type; + using rvv_reg_t = std::conditional_t::value, rvv_reg, Width>, void>; // And some more of the same stuff for bool types, which have // similar problems and similar workarounds. @@ -385,7 +385,7 @@ namespace xsimd : value(__riscv_vreinterpret_u8m1(v)) { } - template ::type = 0> + template = 0> rvv_bool(rvv_bool v) : value(v.value) { @@ -402,8 +402,8 @@ namespace xsimd }; template - using rvv_bool_t = typename std::enable_if < !std::is_void::value, - rvv_bool, Width>::type; + using rvv_bool_t = std::enable_if_t < !std::is_void::value, + rvv_bool, Width>; template struct rvv_vector_type_impl; @@ -450,14 +450,14 @@ namespace xsimd using floating_point_rvv_vector_type = typename rvv_vector_type_impl<8 * sizeof(T)>::floating_point_type; template - using signed_int_or_floating_point_rvv_vector_type = typename std::conditional::value, - floating_point_rvv_vector_type, - signed_int_rvv_vector_type>::type; + using signed_int_or_floating_point_rvv_vector_type = std::conditional_t::value, + floating_point_rvv_vector_type, + signed_int_rvv_vector_type>; template - using rvv_vector_type = typename std::conditional::value, - signed_int_or_floating_point_rvv_vector_type, - unsigned_int_rvv_vector_type>::type; + using rvv_vector_type = std::conditional_t::value, + signed_int_or_floating_point_rvv_vector_type, + unsigned_int_rvv_vector_type>; } // namespace detail XSIMD_DECLARE_SIMD_REGISTER(bool, rvv, detail::rvv_vector_type); diff --git a/include/xsimd/types/xsimd_sve_register.hpp b/include/xsimd/types/xsimd_sve_register.hpp index 9d33fc484..7ac748f8d 100644 --- a/include/xsimd/types/xsimd_sve_register.hpp +++ b/include/xsimd/types/xsimd_sve_register.hpp @@ -108,14 +108,14 @@ namespace xsimd using floating_point_sve_vector_type = typename sve_vector_type_impl<8 * sizeof(T)>::floating_point_type; template - using signed_int_or_floating_point_sve_vector_type = typename std::conditional::value, - floating_point_sve_vector_type, - signed_int_sve_vector_type>::type; + using signed_int_or_floating_point_sve_vector_type = std::conditional_t::value, + floating_point_sve_vector_type, + signed_int_sve_vector_type>; template - using sve_vector_type = typename std::conditional::value, - signed_int_or_floating_point_sve_vector_type, - unsigned_int_sve_vector_type>::type; + using sve_vector_type = std::conditional_t::value, + signed_int_or_floating_point_sve_vector_type, + unsigned_int_sve_vector_type>; } // namespace detail XSIMD_DECLARE_SIMD_REGISTER(signed char, sve, detail::sve_vector_type); diff --git a/include/xsimd/types/xsimd_traits.hpp b/include/xsimd/types/xsimd_traits.hpp index f11fb39e1..ace06dcfc 100644 --- a/include/xsimd/types/xsimd_traits.hpp +++ b/include/xsimd/types/xsimd_traits.hpp @@ -402,7 +402,7 @@ namespace xsimd template struct widen { - using type = typename std::make_signed::type>::type>::type; + using type = std::make_signed_t>::type>; }; template <> diff --git a/include/xsimd/types/xsimd_utils.hpp b/include/xsimd/types/xsimd_utils.hpp index 0aec70c1d..aa6b90607 100644 --- a/include/xsimd/types/xsimd_utils.hpp +++ b/include/xsimd/types/xsimd_utils.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef XSIMD_ENABLE_XTL_COMPLEX #include "xtl/xcomplex.hpp" @@ -211,35 +212,35 @@ namespace xsimd **************************************/ template - using enable_integral_t = typename std::enable_if::value, int>::type; + using enable_integral_t = std::enable_if_t::value, int>; template - using enable_sized_signed_t = typename std::enable_if::value && std::is_signed::value && sizeof(T) == S, int>::type; + using enable_sized_signed_t = std::enable_if_t::value && std::is_signed::value && sizeof(T) == S, int>; template - using enable_sized_unsigned_t = typename std::enable_if::value && !std::is_signed::value && sizeof(T) == S, int>::type; + using enable_sized_unsigned_t = std::enable_if_t::value && !std::is_signed::value && sizeof(T) == S, int>; template - using enable_sized_integral_t = typename std::enable_if::value && sizeof(T) == S, int>::type; + using enable_sized_integral_t = std::enable_if_t::value && sizeof(T) == S, int>; template - using enable_sized_t = typename std::enable_if::type; + using enable_sized_t = std::enable_if_t; template - using enable_max_sized_integral_t = typename std::enable_if::value && sizeof(T) <= S, int>::type; + using enable_max_sized_integral_t = std::enable_if_t::value && sizeof(T) <= S, int>; /******************************** * Matching & mismatching sizes * ********************************/ template - using sizes_match_t = typename std::enable_if::type; + using sizes_match_t = std::enable_if_t; template - using sizes_mismatch_t = typename std::enable_if::type; + using sizes_mismatch_t = std::enable_if_t; template - using stride_match_t = typename std::enable_if::value && sizeof(T) == sizeof(U), B>::type; + using stride_match_t = std::enable_if_t::value && sizeof(T) == sizeof(U), B>; } // namespace detail } // namespace kernel @@ -256,77 +257,18 @@ namespace xsimd using type = T; }; -#ifdef __cpp_lib_integer_sequence - using std::index_sequence; - using std::integer_sequence; - using std::make_index_sequence; - using std::make_integer_sequence; - - using std::index_sequence_for; -#else - template - struct integer_sequence - { - using value_type = T; - static constexpr std::size_t size() noexcept { return sizeof...(Is); } - }; - - template - struct make_integer_sequence_concat; - - template - struct make_integer_sequence_concat, - integer_sequence> - : identity> - { - }; - - template - struct make_integer_sequence_impl; - - template - struct make_integer_sequence_impl> : identity> - { - }; - - template - struct make_integer_sequence_impl> : identity> - { - }; - - template - struct make_integer_sequence_impl> - : make_integer_sequence_concat>::type, - typename make_integer_sequence_impl>::type> - { - }; - - template - using make_integer_sequence = typename make_integer_sequence_impl>::type; - - template - using index_sequence = integer_sequence; - - template - using make_index_sequence = make_integer_sequence; - - template - using index_sequence_for = make_index_sequence; - -#endif - template - using int_sequence = integer_sequence; + using int_sequence = std::integer_sequence; template - using make_int_sequence = make_integer_sequence; + using make_int_sequence = std::make_integer_sequence; template using int_sequence_for = make_int_sequence<(int)sizeof...(Ts)>; // Type-casted index sequence. template - inline P indexes_from(index_sequence) noexcept + inline P indexes_from(std::index_sequence) noexcept { return { static_cast(Is)... }; } @@ -334,34 +276,7 @@ namespace xsimd template inline P make_sequence_as_batch() noexcept { - return indexes_from

(make_index_sequence()); - } - } - - /*********************************** - * Backport of std::get from C++14 * - ***********************************/ - - namespace detail - { - template - inline const T& get_impl(const std::tuple& t, std::is_same, index_sequence) noexcept - { - return std::get(t); - } - - template - inline const T& get_impl(const std::tuple& t, std::is_same, index_sequence) noexcept - { - using tuple_elem = typename std::tuple_element>::type; - return get_impl(t, std::is_same(), index_sequence()); - } - - template - inline const T& get(const std::tuple& t) noexcept - { - using tuple_elem = typename std::tuple_element<0, std::tuple>::type; - return get_impl(t, std::is_same(), make_index_sequence()); + return indexes_from

(std::make_index_sequence()); } } @@ -406,7 +321,7 @@ namespace xsimd // std::array constructor from scalar value ("broadcast") template inline constexpr std::array - array_from_scalar_impl(const T& scalar, index_sequence) noexcept + array_from_scalar_impl(const T& scalar, std::index_sequence) noexcept { // You can safely ignore this silly ternary, the "scalar" is all // that matters. The rest is just a dirty workaround... @@ -417,13 +332,13 @@ namespace xsimd inline constexpr std::array array_from_scalar(const T& scalar) noexcept { - return array_from_scalar_impl(scalar, make_index_sequence()); + return array_from_scalar_impl(scalar, std::make_index_sequence()); } // std::array constructor from C-style pointer (handled as an array) template inline constexpr std::array - array_from_pointer_impl(const T* c_array, index_sequence) noexcept + array_from_pointer_impl(const T* c_array, std::index_sequence) noexcept { return std::array { c_array[Is]... }; } @@ -432,7 +347,7 @@ namespace xsimd inline constexpr std::array array_from_pointer(const T* c_array) noexcept { - return array_from_pointer_impl(c_array, make_index_sequence()); + return array_from_pointer_impl(c_array, std::make_index_sequence()); } } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3ba805556..ee32f3f5e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -60,11 +60,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") else() - CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_CPP11_FLAG) - if (NOT HAS_CPP11_FLAG) - message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++11 support!") + CHECK_CXX_COMPILER_FLAG("-std=c++14" HAS_CPP14_FLAG) + if (NOT HAS_CPP14_FLAG) + message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++14 support!") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") endif() endif() endif() diff --git a/test/check_inline_specifier.sh b/test/check_inline_specifier.sh index 2169a80ed..1ccdda130 100755 --- a/test/check_inline_specifier.sh +++ b/test/check_inline_specifier.sh @@ -20,7 +20,7 @@ sed -r -n '/^####/,$ p' < $0 > $query_file log_file=`mktemp -t` -clang-query --extra-arg "-std=c++11" --extra-arg="-I$top_srcdir/include" -f $query_file $top_srcdir/include/xsimd/xsimd.hpp -- | tee $log_file +clang-query --extra-arg "-std=c++14" --extra-arg="-I$top_srcdir/include" -f $query_file $top_srcdir/include/xsimd/xsimd.hpp -- | tee $log_file { grep -E '^0 matches.' $log_file && failed=0 ; } || failed=1 diff --git a/test/test_batch.cpp b/test/test_batch.cpp index 744fdc15b..9c81aacab 100644 --- a/test/test_batch.cpp +++ b/test/test_batch.cpp @@ -850,7 +850,7 @@ struct batch_test } template - typename std::enable_if<4 <= N>::type test_common_horizontal_operations(std::integral_constant) const + std::enable_if_t<4 <= N> test_common_horizontal_operations(std::integral_constant) const { // reduce common { diff --git a/test/test_batch_bool.cpp b/test/test_batch_bool.cpp index 03b848c9d..db2fad599 100644 --- a/test/test_batch_bool.cpp +++ b/test/test_batch_bool.cpp @@ -249,7 +249,7 @@ struct batch_bool_test // Small masks: safe to compare numeric masks at compile time template - struct xsimd_ct_mask_checker::type> + struct xsimd_ct_mask_checker> { static constexpr std::size_t sum_indices(uint64_t bits, std::size_t index, std::size_t remaining) { @@ -410,7 +410,7 @@ struct batch_bool_test // Large masks: avoid calling mask() in constant expressions template - struct xsimd_ct_mask_checker 31)>::type> + struct xsimd_ct_mask_checker 31)>> { static void run() { } }; diff --git a/test/test_batch_cast.cpp b/test/test_batch_cast.cpp index d5c0dc376..4efae9a03 100644 --- a/test/test_batch_cast.cpp +++ b/test/test_batch_cast.cpp @@ -18,14 +18,14 @@ namespace detail { template - inline typename std::enable_if::value && std::is_integral::value, bool>::type + inline std::enable_if_t::value && std::is_integral::value, bool> is_convertible(T_in value) { return static_cast(value) <= static_cast(std::numeric_limits::max()); } template - inline typename std::enable_if::value && std::is_signed::value && std::is_integral::value && std::is_signed::value, bool>::type + inline std::enable_if_t::value && std::is_signed::value && std::is_integral::value && std::is_signed::value, bool> is_convertible(T_in value) { int64_t signed_value = static_cast(value); @@ -33,21 +33,21 @@ namespace detail } template - inline typename std::enable_if::value && std::is_signed::value && std::is_unsigned::value, bool>::type + inline std::enable_if_t::value && std::is_signed::value && std::is_unsigned::value, bool> is_convertible(T_in value) { return value >= 0 && is_convertible(static_cast(value)); } template - inline typename std::enable_if::value && std::is_integral::value, bool>::type + inline std::enable_if_t::value && std::is_integral::value, bool> is_convertible(T_in value) { return value < static_cast(std::numeric_limits::max()) && value >= static_cast(std::numeric_limits::lowest()); } template - inline typename std::enable_if::value, bool>::type + inline std::enable_if_t::value, bool> is_convertible(T_in) { return true; @@ -207,7 +207,7 @@ struct batch_cast_test #if 0 && XSIMD_X86_INSTR_SET >= XSIMD_X86_AVX_VERSION template - typename std::enable_if= 32>::type test_cast_sizeshift1() const + std::enable_if_t:type test_cast_sizeshift1() const { for (const auto& test_value : int_test_values) { @@ -264,14 +264,14 @@ struct batch_cast_test } template - typename std::enable_if::type test_cast_sizeshift1() const + std::enable_if_t::type test_cast_sizeshift1() const { } #endif -#if 0 && XSIMD_X86_INSTR_SET >= XSIMD_X86_AVX512_VERSION +#if 0 && XSIMD_X86_INSTR_SET > D_X86_AVX512_VERSION template - typename std::enable_if= 64>::type test_cast_sizeshift2() const + std::enable_if_t:type test_cast_sizeshift2() const { for (const auto& test_value : int_test_values) { @@ -314,7 +314,7 @@ struct batch_cast_test } template - typename std::enable_if::type test_cast_sizeshift2() const + std::enable_if_t::type test_cast_sizeshift2() const { } #endif @@ -382,7 +382,7 @@ TEST_CASE_TEMPLATE("[xsimd cast tests]", B, CONVERSION_TYPES) } } #endif -#if 0 && XSIMD_X86_INSTR_SET >= XSIMD_X86_AVX_VERSION +#if 0 && XSIMD_X86_INSTR_SET > D_X86_AVX_VERSION TYPED_TEST(batch_cast_test, cast_sizeshift1) { this->test_cast_sizeshift1(); diff --git a/test/test_batch_int.cpp b/test/test_batch_int.cpp index 3b58e0548..fec1f27c6 100644 --- a/test/test_batch_int.cpp +++ b/test/test_batch_int.cpp @@ -203,7 +203,7 @@ struct batch_int_test batch_int_test() { - using signed_value_type = typename std::make_signed::type; + using signed_value_type = std::make_signed_t; for (size_t i = 0; i < size; ++i) { bool negative_lhs = std::is_signed::value && (i % 2 == 1); diff --git a/test/test_complex_trigonometric.cpp b/test/test_complex_trigonometric.cpp index a48611054..87c5a7812 100644 --- a/test/test_complex_trigonometric.cpp +++ b/test/test_complex_trigonometric.cpp @@ -176,13 +176,13 @@ struct complex_trigonometric_test CHECK_EQ(diff, 0); } - template ::value, int>::type = 0> + template ::value, int> = 0> void test_conditional_tan() { test_tan_impl(); } - template ::value, int>::type = 0> + template ::value, int> = 0> void test_conditional_tan() { #if (XSIMD_ARM_INSTR_SET >= XSIMD_ARM7_NEON_VERSION) diff --git a/test/test_conversion.cpp b/test/test_conversion.cpp index 0861cd7ea..53423b73b 100644 --- a/test/test_conversion.cpp +++ b/test/test_conversion.cpp @@ -206,7 +206,7 @@ struct sign_conversion_test { using unsigned_type = T; - using signed_type = typename std::make_signed::type; + using signed_type = std::make_signed_t; void test_to_signed() { diff --git a/test/test_utils.hpp b/test/test_utils.hpp index 9d700dd58..0da0c6f12 100644 --- a/test/test_utils.hpp +++ b/test/test_utils.hpp @@ -186,25 +186,25 @@ namespace detail { // define some overloads here as integer versions do not exist for msvc template - inline typename std::enable_if::value, bool>::type isinf(const T& c) + inline std::enable_if_t::value, bool> isinf(const T& c) { return std::isinf(c); } template - inline typename std::enable_if::value, bool>::type isinf(const T&) + inline std::enable_if_t::value, bool> isinf(const T&) { return false; } template - inline typename std::enable_if::value, bool>::type isnan(const T& c) + inline std::enable_if_t::value, bool> isnan(const T& c) { return std::isnan(c); } template - inline typename std::enable_if::value, bool>::type isnan(const T&) + inline std::enable_if_t::value, bool> isnan(const T&) { return false; } @@ -545,15 +545,11 @@ namespace xsimd * Enable metafunctions * ************************/ - // Backport of C++14 std::enable_if - template - using enable_if_t = typename std::enable_if::type; - template - using enable_integral_t = enable_if_t::value, R>; + using enable_integral_t = std::enable_if_t::value, R>; template - using enable_floating_point_t = enable_if_t::value, R>; + using enable_floating_point_t = std::enable_if_t::value, R>; namespace mpl { diff --git a/test/test_xsimd_api.cpp b/test/test_xsimd_api.cpp index 2e62c292c..2c177b009 100644 --- a/test/test_xsimd_api.cpp +++ b/test/test_xsimd_api.cpp @@ -618,7 +618,7 @@ struct xsimd_api_float_types_functions { value_type val(3.3); int res; - typename std::conditional::value, int, xsimd::as_integer_t>::type vres; + std::conditional_t::value, int, xsimd::as_integer_t> vres; CHECK_EQ(extract(xsimd::frexp(T(val), vres)), std::frexp(val, &res)); CHECK_EQ(extract(vres), res); } @@ -647,7 +647,7 @@ struct xsimd_api_float_types_functions { value_type val0(4); xsimd::as_integer_t val1(2); - using exponent_type = typename std::conditional::value, int, xsimd::as_integer_t>::type; + using exponent_type = std::conditional_t::value, int, xsimd::as_integer_t>; CHECK_EQ(extract(xsimd::ldexp(T(val0), exponent_type(val1))), std::ldexp(val0, static_cast(val1))); } void test_lgamma()