diff --git a/.clang-tidy b/.clang-tidy index 2d173401f..2f73927b3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ --- Checks: '-*,modernize-type-traits' -WarningsAsErrors: true +WarningsAsErrors: '*' HeaderFilterRegex: '.*' diff --git a/include/xsimd/arch/common/xsimd_common_arithmetic.hpp b/include/xsimd/arch/common/xsimd_common_arithmetic.hpp index 541503ea3..fcca73a4e 100644 --- a/include/xsimd/arch/common/xsimd_common_arithmetic.hpp +++ b/include/xsimd/arch/common/xsimd_common_arithmetic.hpp @@ -75,7 +75,7 @@ namespace xsimd } // div - template ::value>> + template >> XSIMD_INLINE batch div(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T @@ -185,7 +185,7 @@ namespace xsimd struct mulhi_helper { using wider = std::conditional_t< - std::is_signed::value, + std::is_signed_v, std::conditional_t>, std::conditional_t::value>*/> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { auto self_pos_branch = min(std::numeric_limits::max() - other, self); auto self_neg_branch = max(std::numeric_limits::min() - other, self); @@ -396,7 +396,7 @@ namespace xsimd template ::value>*/> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { return sadd(self, -other); } diff --git a/include/xsimd/arch/common/xsimd_common_bit.hpp b/include/xsimd/arch/common/xsimd_common_bit.hpp index cba28cf95..607bddf1c 100644 --- a/include/xsimd/arch/common/xsimd_common_bit.hpp +++ b/include/xsimd/arch/common/xsimd_common_bit.hpp @@ -51,7 +51,7 @@ namespace xsimd // FIXME: We could do better by dispatching to the appropriate popcount instruction // depending on the arch. - template ::value>> + template >> XSIMD_INLINE int popcount(T x) noexcept { #if XSIMD_HAS_BUILTIN(__builtin_popcountg) @@ -123,7 +123,7 @@ namespace xsimd #endif } - template ::value>> + template >> XSIMD_INLINE int countl_zero(T x) noexcept { #if XSIMD_HAS_BUILTIN(__builtin_clzg) @@ -177,13 +177,13 @@ namespace xsimd #endif } - template ::value>> + template >> XSIMD_INLINE int countl_one(T x) noexcept { return countl_zero(T(~x)); } - template ::value>> + template >> XSIMD_INLINE int countr_zero(T x) noexcept { #if XSIMD_HAS_BUILTIN(__builtin_ctzg) @@ -219,7 +219,7 @@ namespace xsimd #endif } - template ::value>> + template >> XSIMD_INLINE int countr_one(T x) noexcept { return countr_zero(T(~x)); diff --git a/include/xsimd/arch/common/xsimd_common_details.hpp b/include/xsimd/arch/common/xsimd_common_details.hpp index a99f19319..90a806472 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 std::enable_if_t::value, batch> + XSIMD_INLINE std::enable_if_t, 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 6ee5218aa..7fab24de9 100644 --- a/include/xsimd/arch/common/xsimd_common_logical.hpp +++ b/include/xsimd/arch/common/xsimd_common_logical.hpp @@ -110,7 +110,7 @@ namespace xsimd } // isinf - template ::value>> + template >> XSIMD_INLINE batch_bool isinf(batch const&, requires_arch) noexcept { return batch_bool(false); @@ -137,7 +137,7 @@ namespace xsimd } // isfinite - template ::value>> + template >> XSIMD_INLINE batch_bool isfinite(batch const&, requires_arch) noexcept { return batch_bool(true); @@ -154,14 +154,14 @@ namespace xsimd } // isnan - template ::value>> + template >> XSIMD_INLINE batch_bool isnan(batch const&, requires_arch) noexcept { return batch_bool(false); } // le - template ::value>> + template >> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return (self < other) || (self == other); diff --git a/include/xsimd/arch/common/xsimd_common_math.hpp b/include/xsimd/arch/common/xsimd_common_math.hpp index 7dbb0ac05..c7bad2df3 100644 --- a/include/xsimd/arch/common/xsimd_common_math.hpp +++ b/include/xsimd/arch/common/xsimd_common_math.hpp @@ -29,7 +29,7 @@ namespace xsimd template XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { - if (std::is_unsigned::value) + if (std::is_unsigned_v) return self; else { @@ -85,7 +85,7 @@ namespace xsimd XSIMD_INLINE batch avgr(batch const& x, batch const& y, std::true_type) noexcept { constexpr unsigned shift = 8 * sizeof(T) - 1; - auto adj = std::is_signed::value ? ((x ^ y) & 0x1) : (((x ^ y) << shift) >> shift); + auto adj = std::is_signed_v ? ((x ^ y) & 0x1) : (((x ^ y) << shift) >> shift); return ::xsimd::kernel::avg(x, y, A {}) + adj; } @@ -124,7 +124,7 @@ namespace xsimd template XSIMD_INLINE batch batch_cast(batch const& self, batch const&, requires_arch, with_slow_conversion) noexcept { - static_assert(!std::is_same::value, "there should be no conversion for this type combination"); + static_assert(!std::is_same_v, "there should be no conversion for this type combination"); using batch_type_in = batch; using batch_type_out = batch; static_assert(batch_type_in::size == batch_type_out::size, "compatible sizes"); @@ -148,8 +148,8 @@ namespace xsimd template XSIMD_INLINE batch bitofsign(batch const& self, requires_arch) noexcept { - static_assert(std::is_integral::value, "int type implementation"); - if (std::is_unsigned::value) + static_assert(std::is_integral_v, "int type implementation"); + if (std::is_unsigned_v) return batch(0); else return self >> (T)(8 * sizeof(T) - 1); @@ -286,7 +286,7 @@ namespace xsimd } // copysign - template ::value>> + template >> XSIMD_INLINE batch copysign(batch const& self, batch const& other, requires_arch) noexcept { return abs(self) | bitofsign(other); @@ -1899,7 +1899,7 @@ namespace xsimd } // mod - template ::value>> + template >> XSIMD_INLINE batch mod(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T @@ -1908,7 +1908,7 @@ namespace xsimd } // nearbyint - template ::value>> + template >> XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept { return self; @@ -1940,7 +1940,7 @@ namespace xsimd } // nearbyint_as_int - template ::value>> + template >> XSIMD_INLINE batch nearbyint_as_int(batch const& self, requires_arch) noexcept { return self; @@ -1970,7 +1970,7 @@ namespace xsimd // nextafter namespace detail { - template ::value> + template > struct nextafter_kernel { using batch_type = batch; @@ -2102,7 +2102,7 @@ namespace xsimd } // reciprocal - template ::value>> + template >> XSIMD_INLINE batch reciprocal(batch const& self, requires_arch) noexcept { @@ -2217,7 +2217,7 @@ namespace xsimd detail::reassociation_barrier(q, "prevent pulling multiply back through rounded quotient"); return fnma(q, other, self); } - template ::value>> + template >> XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept { auto mod = self % other; @@ -2232,7 +2232,7 @@ namespace xsimd } // sign - template ::value>> + template >> XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept { using batch_type = batch; @@ -2278,7 +2278,7 @@ namespace xsimd } // signnz - template ::value>> + template >> XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept { using batch_type = batch; @@ -2315,8 +2315,8 @@ namespace xsimd XSIMD_INLINE batch, A> sqrt(batch, A> const& z, requires_arch) noexcept { - constexpr T csqrt_scale_factor = std::is_same::value ? 6.7108864e7f : 1.8014398509481984e16; - constexpr T csqrt_scale = std::is_same::value ? 1.220703125e-4f : 7.450580596923828125e-9; + constexpr T csqrt_scale_factor = std::is_same_v ? 6.7108864e7f : 1.8014398509481984e16; + constexpr T csqrt_scale = std::is_same_v ? 1.220703125e-4f : 7.450580596923828125e-9; using batch_type = batch, A>; using real_batch = batch; real_batch x = z.real(); diff --git a/include/xsimd/arch/common/xsimd_common_memory.hpp b/include/xsimd/arch/common/xsimd_common_memory.hpp index df3515688..9f10d54a3 100644 --- a/include/xsimd/arch/common/xsimd_common_memory.hpp +++ b/include/xsimd/arch/common/xsimd_common_memory.hpp @@ -312,7 +312,7 @@ namespace xsimd template XSIMD_INLINE batch load_aligned(T_in const* mem, convert, requires_arch, with_slow_conversion) noexcept { - static_assert(!std::is_same::value, "there should be a direct load for this type combination"); + static_assert(!std::is_same_v, "there should be a direct load for this type combination"); using batch_type_out = batch; alignas(A::alignment()) T_out buffer[batch_type_out::size]; std::copy(mem, mem + batch_type_out::size, std::begin(buffer)); @@ -339,7 +339,7 @@ namespace xsimd template XSIMD_INLINE batch load_unaligned(T_in const* mem, convert cvt, requires_arch, with_slow_conversion) noexcept { - static_assert(!std::is_same::value, "there should be a direct load for this type combination"); + static_assert(!std::is_same_v, "there should be a direct load for this type combination"); return load_aligned(mem, cvt, common {}, with_slow_conversion {}); } } @@ -376,9 +376,9 @@ namespace xsimd // otherwise the scalar-buffer fallback is used. Names no architecture. template using masked_memory_uses_fp_bitcast = std::integral_constant::value - && std::is_integral::value - && !std::is_void>::value + std::is_same_v + && std::is_integral_v + && !std::is_void_v> && types::has_simd_register, A>::value>; // Scalar-buffer fallback: materialize masked-off lanes as zero, then load. @@ -728,7 +728,7 @@ namespace xsimd template XSIMD_INLINE void store_aligned(T_out* mem, batch const& self, requires_arch) noexcept { - static_assert(!std::is_same::value, "there should be a direct store for this type combination"); + static_assert(!std::is_same_v, "there should be a direct store for this type combination"); alignas(A::alignment()) T_in buffer[batch::size]; store_aligned(&buffer[0], self); std::copy(std::begin(buffer), std::end(buffer), mem); @@ -738,7 +738,7 @@ namespace xsimd template XSIMD_INLINE void store_unaligned(T_out* mem, batch const& self, requires_arch) noexcept { - static_assert(!std::is_same::value, "there should be a direct store for this type combination"); + static_assert(!std::is_same_v, "there should be a direct store for this type combination"); return store_aligned(mem, self, common {}); } @@ -792,19 +792,19 @@ namespace xsimd template XSIMD_INLINE batch, A> load_complex(batch const& /*hi*/, batch const& /*lo*/, requires_arch) noexcept { - static_assert(std::is_same::value, "load_complex not implemented for the required architecture"); + static_assert(std::is_same_v, "load_complex not implemented for the required architecture"); } template XSIMD_INLINE batch complex_high(batch, A> const& /*src*/, requires_arch) noexcept { - static_assert(std::is_same::value, "complex_high not implemented for the required architecture"); + static_assert(std::is_same_v, "complex_high not implemented for the required architecture"); } template XSIMD_INLINE batch complex_low(batch, A> const& /*src*/, requires_arch) noexcept { - static_assert(std::is_same::value, "complex_low not implemented for the required architecture"); + static_assert(std::is_same_v, "complex_low not implemented for the required architecture"); } } diff --git a/include/xsimd/arch/common/xsimd_common_rounding.hpp b/include/xsimd/arch/common/xsimd_common_rounding.hpp index af2a5c2a7..6bf6ce67c 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>> + template >> 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 326340f92..3db5b6412 100644 --- a/include/xsimd/arch/common/xsimd_common_swizzle.hpp +++ b/include/xsimd/arch/common/xsimd_common_swizzle.hpp @@ -184,7 +184,7 @@ namespace xsimd template XSIMD_INLINE constexpr bool is_cross_lane_with_lane_size() noexcept { - static_assert(std::is_integral::value, "swizzle mask values must be integral"); + static_assert(std::is_integral_v, "swizzle mask values must be integral"); static_assert(sizeof...(Vs) >= 1, "need at least one value"); static_assert(LaneSizeBytes > 0, "lane size must be positive"); diff --git a/include/xsimd/arch/common/xsimd_common_trigo.hpp b/include/xsimd/arch/common/xsimd_common_trigo.hpp index 1a545d78b..00ad75076 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>> + template >> 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 240c2a9f4..ce6093605 100644 --- a/include/xsimd/arch/xsimd_avx.hpp +++ b/include/xsimd/arch/xsimd_avx.hpp @@ -116,7 +116,7 @@ namespace xsimd } // add - template ::value>> + template >> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -145,7 +145,7 @@ namespace xsimd { return _mm256_testc_pd(self, batch_bool(true)) != 0; } - template ::value>> + template >> XSIMD_INLINE bool all(batch_bool const& self, requires_arch) noexcept { return _mm256_testc_si256(self, batch_bool(true)) != 0; @@ -162,7 +162,7 @@ namespace xsimd { return !_mm256_testz_pd(self, self); } - template ::value>> + template >> XSIMD_INLINE bool any(batch_bool const& self, requires_arch) noexcept { return !_mm256_testz_si256(self, self); @@ -198,14 +198,14 @@ namespace xsimd return _mm256_and_pd(self, other); } - template ::value>> + template >> 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>> + template >> 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 @@ -236,14 +236,14 @@ namespace xsimd return _mm256_andnot_pd(other, self); } - template ::value>> + template >> 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>> + template >> 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 @@ -252,7 +252,7 @@ namespace xsimd } // bitwise_lshift - template ::value>> + template >> 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 @@ -261,14 +261,14 @@ namespace xsimd } // bitwise_not - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch_bool bitwise_not(batch_bool const& self, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s) noexcept @@ -297,14 +297,14 @@ namespace xsimd { return _mm256_or_pd(self, other); } - template ::value>> + template >> 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>> + template >> 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 @@ -313,7 +313,7 @@ namespace xsimd } // bitwise_rshift - template ::value>> + template >> 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 @@ -342,14 +342,14 @@ namespace xsimd { return _mm256_xor_pd(self, other); } - template ::value>> + template >> 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>> + template >> 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 @@ -358,17 +358,17 @@ namespace xsimd } // bitwise_cast - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castsi256_ps(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castsi256_pd(self); } - template >::value>> + template >>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return batch(self.data); @@ -378,7 +378,7 @@ namespace xsimd { return _mm256_castps_pd(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castps_si256(self); @@ -388,7 +388,7 @@ namespace xsimd { return _mm256_castpd_ps(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm256_castpd_si256(self); @@ -417,7 +417,7 @@ namespace xsimd } // broadcast - template ::value>> + template >> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -536,7 +536,7 @@ namespace xsimd } // decr_if - template ::value>> + template >> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self + batch(mask.data); @@ -575,7 +575,7 @@ namespace xsimd { return ~(self != other); } - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -583,7 +583,7 @@ namespace xsimd self, other); } - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return ~(self != other); @@ -638,7 +638,7 @@ namespace xsimd assert(!(mask & ~0xFul) && "inbound mask"); return _mm256_castsi256_pd(_mm256_load_si256((const __m256i*)lut64[mask])); } - template ::value>> + template >> XSIMD_INLINE batch_bool from_mask(batch_bool const&, uint64_t mask, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -743,7 +743,7 @@ namespace xsimd } // incr_if - template ::value>> + template >> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self - batch(mask.data); @@ -762,7 +762,7 @@ namespace xsimd return _mm256_cvtsd_f64(self); } - template ::value>> + template >> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -818,7 +818,7 @@ namespace xsimd return kernel::get(batch(half), ::xsimd::index {}, sse4_1 {}); } - template ::value>> + template >> XSIMD_INLINE T get(batch const& self, ::xsimd::index, requires_arch) noexcept { if constexpr (I == 0) @@ -833,7 +833,7 @@ namespace xsimd } // insert - template ::value>> + template >> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { #if !defined(_MSC_VER) || _MSC_VER > 1900 @@ -882,7 +882,7 @@ namespace xsimd } // load_aligned - template ::value>> + template >> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return _mm256_load_si256((__m256i const*)mem); @@ -940,7 +940,7 @@ namespace xsimd } // load_unaligned - template ::value>> + template >> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return _mm256_loadu_si256((__m256i const*)mem); @@ -1027,7 +1027,7 @@ namespace xsimd // 4/8-byte ints: bitcast to same-width float, reuse the vmaskmov path. template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), batch> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), batch> load_masked(T const* mem, batch_bool mask, convert, Mode, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -1041,7 +1041,7 @@ namespace xsimd } // load_masked (single overload for float/double) - template ::value>> + template >> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { constexpr size_t half_size = batch::size / 2; @@ -1117,7 +1117,7 @@ namespace xsimd } template ::value && detail::uses_vector_mask::value>> + typename = std::enable_if_t && detail::uses_vector_mask::value>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept { constexpr size_t half_size = batch::size / 2; @@ -1188,7 +1188,7 @@ namespace xsimd // 4/8-byte ints: bitcast to same-width float, reuse the vmaskmov path. template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), void> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), void> store_masked(T* mem, batch const& src, batch_bool mask, Mode, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -1217,7 +1217,7 @@ namespace xsimd static_assert(sizeof...(V) == batch::size, "mask pack width must match the batch"); // the plain-move path emits aligned moves in aligned/stream mode, which fault // on a misaligned pointer (the old vmaskmov tolerated it) - assert((std::is_same::value || ::xsimd::is_aligned(mem)) && "aligned/stream masked load needs an aligned pointer"); + assert((std::is_same_v || ::xsimd::is_aligned(mem)) && "aligned/stream masked load needs an aligned pointer"); // qualify: an unqualified call resolves to detail::load_masked (a different // helper) under MSVC's two-phase lookup; we want the kernel-level overload return bitwise_cast(batch(::xsimd::kernel::load_masked(reinterpret_cast(mem), batch_bool_constant {}, convert {}, Mode {}, DstArch {}))); @@ -1232,7 +1232,7 @@ namespace xsimd using F = std::conditional_t; static_assert(batch::size == batch::size, "same-width float must preserve lane count"); static_assert(sizeof...(V) == batch::size, "mask pack width must match the batch"); - assert((std::is_same::value || ::xsimd::is_aligned(mem)) && "aligned/stream masked store needs an aligned pointer"); + assert((std::is_same_v || ::xsimd::is_aligned(mem)) && "aligned/stream masked store needs an aligned pointer"); const auto fsrc = bitwise_cast(src); // qualify: an unqualified call resolves to detail::store_masked (a different // helper) under MSVC's two-phase lookup; we want the kernel-level overload @@ -1252,7 +1252,7 @@ namespace xsimd return _mm256_cmp_pd(self, other, _CMP_LT_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -1261,7 +1261,7 @@ namespace xsimd } // mask - template ::value>> + template >> XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 1 || sizeof(T) == 2) @@ -1306,7 +1306,7 @@ namespace xsimd { return _mm256_max_pd(other, self); } - template ::value>> + template >> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { return select(self > other, self, other); @@ -1323,7 +1323,7 @@ namespace xsimd { return _mm256_min_pd(other, self); } - template ::value>> + template >> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { return select(self <= other, self, other); @@ -1362,7 +1362,7 @@ namespace xsimd } // neg - template ::value>> + template >> XSIMD_INLINE batch neg(batch const& self, requires_arch) noexcept { return 0 - self; @@ -1389,7 +1389,7 @@ namespace xsimd { return _mm256_cmp_pd(self, other, _CMP_NEQ_UQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~(self == other); @@ -1405,7 +1405,7 @@ namespace xsimd { return _mm256_xor_pd(self, other); } - template ::value>> + template >> 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))); @@ -1420,7 +1420,7 @@ namespace xsimd } // reduce_add - template ::value>> + template >> 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); @@ -1451,7 +1451,7 @@ namespace xsimd } // reduce_mul - template ::value>> + template >> 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); @@ -1472,10 +1472,10 @@ namespace xsimd } // sadd - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { auto mask = (other >> (8 * sizeof(T) - 1)); auto self_pos_branch = min(std::numeric_limits::max() - other, self); @@ -1501,7 +1501,7 @@ namespace xsimd { return _mm256_blendv_pd(false_br, true_br, cond); } - template ::value>> + template >> 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); @@ -1514,7 +1514,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>> + template >> 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 {}); @@ -1548,29 +1548,29 @@ namespace xsimd static_assert(sizeof...(Values) == batch::size, "consistent init"); return _mm256_setr_pd(values...); } - template ::value>> + template >> 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>> + template >> 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>> + template >> 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>> + template >> 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>> + template >> XSIMD_INLINE batch_bool set(batch_bool const&, requires_arch, Values... values) noexcept { return set(batch(), A {}, static_cast(values ? -1LL : 0LL)...).data; @@ -1715,10 +1715,10 @@ namespace xsimd } // ssub - template ::value>> + template >> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { return sadd(self, -other); } @@ -1730,12 +1730,12 @@ namespace xsimd } // store_aligned - template ::value>> + template >> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return _mm256_store_si256((__m256i*)mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_aligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm256_store_si256((__m256i*)mem, self); @@ -1752,12 +1752,12 @@ namespace xsimd } // store_unaligned - template ::value>> + template >> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return _mm256_storeu_si256((__m256i*)mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_unaligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm256_storeu_si256((__m256i*)mem, self); @@ -1784,14 +1784,14 @@ namespace xsimd { _mm256_stream_pd(mem, self); } - template ::value, void>> + template , void>> XSIMD_INLINE void store_stream(T* mem, batch const& self, requires_arch) noexcept { _mm256_stream_si256((__m256i*)mem, self); } // sub - template ::value>> + template >> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { return detail::fwd_to_sse([](__m128i s, __m128i o) noexcept @@ -2147,7 +2147,7 @@ namespace xsimd } // zip_hi - template ::value>> + template >> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1 || sizeof(T) == 2) @@ -2210,7 +2210,7 @@ namespace xsimd } // zip_lo - template ::value>> + template >> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1 || sizeof(T) == 2) diff --git a/include/xsimd/arch/xsimd_avx2.hpp b/include/xsimd/arch/xsimd_avx2.hpp index 5a44290ea..ba6825cb8 100644 --- a/include/xsimd/arch/xsimd_avx2.hpp +++ b/include/xsimd/arch/xsimd_avx2.hpp @@ -28,10 +28,10 @@ namespace xsimd using namespace types; // abs - template ::value>> + template >> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -54,7 +54,7 @@ namespace xsimd } // add - template ::value>> + template >> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -80,7 +80,7 @@ namespace xsimd } // avgr - template ::value>> + template >> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -98,7 +98,7 @@ namespace xsimd } // avg - template ::value>> + template >> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -154,35 +154,35 @@ namespace xsimd // Constant masks: prefix/suffix shapes lower to plain moves. template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), batch> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), batch> load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { return detail::plain_move_load(mem, mask, convert {}, Mode {}); } template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), batch> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), batch> load_masked(T const* mem, batch_bool mask, convert, Mode, requires_arch) noexcept { return detail::maskload(mem, __m256i(mask)); } template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept { detail::plain_move_store(mem, src, mask, Mode {}); } template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), void> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), void> store_masked(T* mem, batch const& src, batch_bool mask, Mode, requires_arch) noexcept { detail::maskstore(mem, __m256i(mask), __m256i(src)); } // load_stream - template ::value, void>> + template , void>> XSIMD_INLINE batch load_stream(T const* mem, convert, requires_arch) noexcept { return _mm256_stream_load_si256((__m256i const*)mem); @@ -199,43 +199,43 @@ namespace xsimd } // bitwise_and - template ::value>> + template >> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_and_si256(self, other); } - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_andnot_si256(other, self); } - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return _mm256_xor_si256(self, _mm256_set1_epi32(-1)); } - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { if constexpr (sizeof(T) == 2) @@ -256,7 +256,7 @@ namespace xsimd } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -284,7 +284,7 @@ namespace xsimd } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -306,7 +306,7 @@ namespace xsimd // The 1 byte constant implementation calls the 2 bytes constant version, the 2 bytes // constant version calls into the 4 bytes version which resolves to the dynamic one above. template ::value && (sizeof(T) <= 2), int> = 0> + std::enable_if_t && (sizeof(T) <= 2), int> = 0> XSIMD_INLINE batch bitwise_lshift( batch const& self, batch_constant shifts, requires_arch req) noexcept { @@ -325,22 +325,22 @@ namespace xsimd } // bitwise_or - template ::value>> + template >> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_or_si256(self, other); } - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -387,12 +387,12 @@ namespace xsimd } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; static_assert(shift < bits, "Shift amount must be less than the number of bits in T"); - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -444,10 +444,10 @@ namespace xsimd } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 4) { @@ -476,12 +476,12 @@ namespace xsimd } // bitwise_xor - template ::value>> + template >> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return _mm256_xor_si256(self, other); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_xor(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm256_xor_si256(self, other); @@ -542,7 +542,7 @@ namespace xsimd } // eq - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -625,10 +625,10 @@ namespace xsimd } // lt - template ::value>> + template >> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -683,7 +683,7 @@ namespace xsimd // load_unaligned - template ::value>> + template >> XSIMD_INLINE batch_bool load_unaligned(bool const* mem, batch_bool, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -735,7 +735,7 @@ namespace xsimd } // mask - template ::value>> + template >> XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -754,10 +754,10 @@ namespace xsimd } // max - template ::value>> + template >> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -798,10 +798,10 @@ namespace xsimd } // min - template ::value>> + template >> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -842,7 +842,7 @@ namespace xsimd } // mul - template ::value>> + template >> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -963,7 +963,7 @@ namespace xsimd } // reduce_add - template ::value>> + template >> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -1035,10 +1035,10 @@ namespace xsimd } // sadd - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -1071,7 +1071,7 @@ namespace xsimd } // select - template ::value>> + template >> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -1095,7 +1095,7 @@ namespace xsimd return select(cond, true_br, false_br, avx {}); } } - template ::value>> + template >> 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, @@ -1237,10 +1237,10 @@ namespace xsimd } // ssub - template ::value>> + template >> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -1273,7 +1273,7 @@ namespace xsimd } // sub - template ::value>> + template >> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -1501,7 +1501,7 @@ namespace xsimd } // zip_hi - template ::value>> + template >> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -1536,7 +1536,7 @@ namespace xsimd } // zip_lo - template ::value>> + template >> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -1571,7 +1571,7 @@ namespace xsimd } // widen - template ::value>> + template >> XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept { __m128i x_lo = detail::lower_half(x); @@ -1579,7 +1579,7 @@ namespace xsimd __m256i lo, hi; if constexpr (sizeof(T) == 4) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm256_cvtepi32_epi64(x_lo); hi = _mm256_cvtepi32_epi64(x_hi); @@ -1592,7 +1592,7 @@ namespace xsimd } else if constexpr (sizeof(T) == 2) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm256_cvtepi16_epi32(x_lo); hi = _mm256_cvtepi16_epi32(x_hi); @@ -1605,7 +1605,7 @@ namespace xsimd } else if constexpr (sizeof(T) == 1) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm256_cvtepi8_epi16(x_lo); hi = _mm256_cvtepi8_epi16(x_hi); diff --git a/include/xsimd/arch/xsimd_avx2_128.hpp b/include/xsimd/arch/xsimd_avx2_128.hpp index 167fbc9c5..4d90b125b 100644 --- a/include/xsimd/arch/xsimd_avx2_128.hpp +++ b/include/xsimd/arch/xsimd_avx2_128.hpp @@ -31,20 +31,20 @@ namespace xsimd // ordinary lookup here, so the avx512vl_128 overloads must be visible at // this point; declarations only, never instantiated unless AVX512VL is on. template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept; template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool mask, convert, Mode, requires_arch) noexcept; template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept; template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool mask, Mode, requires_arch) noexcept; // select - template ::value>> + template >> 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(); @@ -59,7 +59,7 @@ namespace xsimd } // bitwise_lshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -77,10 +77,10 @@ namespace xsimd } // bitwise_rshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 4) { @@ -144,7 +144,7 @@ namespace xsimd // Masks that lower to plain moves go to the sse2 float/double kernels // (int bitcast to same-width float); the rest keep the native vpmaskmov. template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { if constexpr (detail::lowers_to_plain_moves(mask)) @@ -158,7 +158,7 @@ namespace xsimd } template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept { if constexpr (detail::lowers_to_plain_moves(mask)) @@ -172,14 +172,14 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), batch> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), batch> load_masked(T const* mem, batch_bool mask, convert, Mode, requires_arch) noexcept { return detail::maskload_avx2_128(mem, __m128i(mask)); } template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), void> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), void> store_masked(T* mem, batch const& src, batch_bool mask, Mode, requires_arch) noexcept { detail::maskstore_avx2_128(mem, __m128i(mask), __m128i(src)); diff --git a/include/xsimd/arch/xsimd_avx512bw.hpp b/include/xsimd/arch/xsimd_avx512bw.hpp index eba2a2012..2d32002b9 100644 --- a/include/xsimd/arch/xsimd_avx512bw.hpp +++ b/include/xsimd/arch/xsimd_avx512bw.hpp @@ -30,7 +30,7 @@ namespace xsimd XSIMD_INLINE batch_bool compare_int_avx512bw(batch const& self, batch const& other) noexcept { using register_type = typename batch_bool::register_type; - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -72,10 +72,10 @@ namespace xsimd } // abs - template ::value>> + template >> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { - if (std::is_unsigned::value) + if (std::is_unsigned_v) { return self; } @@ -95,7 +95,7 @@ namespace xsimd } // add - template ::value>> + template >> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -113,7 +113,7 @@ namespace xsimd } // avgr - template ::value>> + template >> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -131,7 +131,7 @@ namespace xsimd } // avg - template ::value>> + template >> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -151,7 +151,7 @@ namespace xsimd } // bitwise_lshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { #if defined(XSIMD_AVX512_SHIFT_INTRINSICS_IMM_ONLY) @@ -171,10 +171,10 @@ namespace xsimd } // bitwise_rshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -225,7 +225,7 @@ namespace xsimd } // decr_if - template ::value>> + template >> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -244,28 +244,28 @@ namespace xsimd } // eq - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // ge - template ::value>> + template >> XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // gt - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -284,7 +284,7 @@ namespace xsimd } // insert - template ::value>> + template >> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -302,21 +302,21 @@ namespace xsimd } // le - template ::value>> + template >> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // lt - template ::value>> + template >> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // load - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch_bool load_aligned(bool const* mem, batch_bool, requires_arch) noexcept { using mask_type = typename batch_bool::register_type; @@ -382,7 +382,7 @@ namespace xsimd // 8/16-bit, replacing the common scalar fallback. No aligned masked 8/16 // intrinsic exists and masked moves never fault, so loadu fits both modes. template ::value && (sizeof(T) == 1 || sizeof(T) == 2)>> + class = std::enable_if_t && (sizeof(T) == 1 || sizeof(T) == 2)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool mask, convert, Mode, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -396,7 +396,7 @@ namespace xsimd } template ::value && (sizeof(T) == 1 || sizeof(T) == 2)>> + class = std::enable_if_t && (sizeof(T) == 1 || sizeof(T) == 2)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool mask, Mode, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -412,24 +412,24 @@ namespace xsimd // Constant masks reuse the runtime overloads; as_batch_bool() also avoids // batch_bool_constant::mask() truncating a 64-lane int8 mask to int. template ::value && (sizeof(T) == 1 || sizeof(T) == 2)>> + class = std::enable_if_t && (sizeof(T) == 1 || sizeof(T) == 2)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { return load_masked(mem, mask.as_batch_bool(), convert {}, Mode {}, avx512bw {}); } template ::value && (sizeof(T) == 1 || sizeof(T) == 2)>> + class = std::enable_if_t && (sizeof(T) == 1 || sizeof(T) == 2)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept { store_masked(mem, src, mask.as_batch_bool(), Mode {}, avx512bw {}); } // max - template ::value>> + template >> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -462,10 +462,10 @@ namespace xsimd } // min - template ::value>> + template >> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -498,7 +498,7 @@ namespace xsimd } // mul - template ::value>> + template >> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -555,17 +555,17 @@ namespace xsimd } // neq - template ::value>> + template >> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512bw(self, other); } // sadd - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -598,7 +598,7 @@ namespace xsimd } // select - template ::value>> + template >> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -638,10 +638,10 @@ namespace xsimd } // ssub - template ::value>> + template >> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -684,7 +684,7 @@ namespace xsimd } // sub - template ::value>> + template >> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -748,7 +748,7 @@ namespace xsimd } // zip_hi - template ::value>> + template >> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { __m512i lo, hi; @@ -776,7 +776,7 @@ namespace xsimd } // zip_lo - template ::value>> + template >> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { __m512i lo, hi; diff --git a/include/xsimd/arch/xsimd_avx512f.hpp b/include/xsimd/arch/xsimd_avx512f.hpp index e76b653c3..97e1a4049 100644 --- a/include/xsimd/arch/xsimd_avx512f.hpp +++ b/include/xsimd/arch/xsimd_avx512f.hpp @@ -154,7 +154,7 @@ namespace xsimd XSIMD_INLINE batch_bool compare_int_avx512f(batch const& self, batch const& other) noexcept { using register_type = typename batch_bool::register_type; - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -390,10 +390,10 @@ namespace xsimd self_asi); return *reinterpret_cast<__m512d*>(&res_asi); } - template ::value>> + template >> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { - if (std::is_unsigned::value) + if (std::is_unsigned_v) { return self; } @@ -426,7 +426,7 @@ namespace xsimd } // add - template ::value>> + template >> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -505,7 +505,7 @@ namespace xsimd return _mm512_castsi512_pd(_mm512_and_si512(_mm512_castpd_si512(self), _mm512_castpd_si512(other))); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_and_si512(self, other); @@ -530,7 +530,7 @@ namespace xsimd return _mm512_castsi512_pd(_mm512_andnot_si512(_mm512_castpd_si512(other), _mm512_castpd_si512(self))); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_andnot_si512(other, self); @@ -544,7 +544,7 @@ namespace xsimd } // bitwise_lshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -589,7 +589,7 @@ namespace xsimd } // bitwise_not - template ::value>> + template >> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return _mm512_xor_si512(self, _mm512_set1_epi32(-1)); @@ -631,17 +631,17 @@ namespace xsimd return register_type(self.data | other.data); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_or_si512(self, other); } // bitwise_rshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { #if defined(XSIMD_AVX512_SHIFT_INTRINSICS_IMM_ONLY) if constexpr (sizeof(T) == 4) @@ -708,7 +708,7 @@ namespace xsimd } // rotl - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -723,12 +723,12 @@ namespace xsimd { return rotl(batch(s), batch(o), avx2 {}); }, self, other); } - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, int32_t other, requires_arch) noexcept { return rotl(self, batch(other), A {}); } - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -748,7 +748,7 @@ namespace xsimd } // rotr - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) < 4) @@ -757,7 +757,7 @@ namespace xsimd { return rotr(batch(s), batch(o), avx2 {}); }, self, other); } - if constexpr (std::is_unsigned::value) + if constexpr (std::is_unsigned_v) { if constexpr (sizeof(T) == 4) { @@ -770,13 +770,13 @@ namespace xsimd } return rotr(self, other, common {}); } - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, int32_t other, requires_arch) noexcept { return rotr(self, batch(other), A {}); } - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -787,7 +787,7 @@ namespace xsimd { return rotr(batch(s), avx2 {}); }, self); } - if constexpr (std::is_unsigned::value) + if constexpr (std::is_unsigned_v) { if constexpr (sizeof(T) == 4) { @@ -820,24 +820,24 @@ namespace xsimd return register_type(self.data ^ other.data); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return _mm512_xor_si512(self, other); } // bitwise_cast - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castsi512_ps(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castsi512_pd(self); } - template >::value>> + template >>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return batch(self.data); @@ -847,7 +847,7 @@ namespace xsimd { return _mm512_castps_pd(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castps_si512(self); @@ -857,14 +857,14 @@ namespace xsimd { return _mm512_castpd_ps(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm512_castpd_si512(self); } // broadcast - template ::value>> + template >> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -1003,7 +1003,7 @@ namespace xsimd } } // incr_if - template ::value>> + template >> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -1045,7 +1045,7 @@ namespace xsimd return _mm512_cmp_pd_mask(self, other, _CMP_EQ_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1229,7 +1229,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_GE_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1246,7 +1246,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_GT_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1349,7 +1349,7 @@ namespace xsimd } // incr_if - template ::value>> + template >> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { @@ -1380,7 +1380,7 @@ namespace xsimd return _mm512_cvtsd_f64(self); } - template ::value>> + template >> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -1430,7 +1430,7 @@ namespace xsimd return _mm_cvtsd_f64(_mm512_castpd512_pd128(_mm512_castsi512_pd(rotated))); } - template ::value>> + template >> XSIMD_INLINE T get(batch const& self, ::xsimd::index, requires_arch) noexcept { if constexpr (I == 0) @@ -1473,7 +1473,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>> + template >> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -1529,7 +1529,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_LE_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1594,7 +1594,7 @@ namespace xsimd } // load_aligned - template ::value>> + template >> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return _mm512_load_si512((__m512i const*)mem); @@ -1634,7 +1634,7 @@ namespace xsimd } // load_unaligned - template ::value>> + template >> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return _mm512_loadu_si512((__m512i const*)mem); @@ -1651,7 +1651,7 @@ namespace xsimd } // load_stream - template ::value, void>> + template , void>> XSIMD_INLINE batch load_stream(T const* mem, convert, requires_arch) noexcept { return _mm512_stream_load_si512((__m512i*)mem); @@ -1679,7 +1679,7 @@ namespace xsimd return _mm512_cmp_pd_mask(self, other, _CMP_LT_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512f(self, other); @@ -1703,10 +1703,10 @@ namespace xsimd { return _mm512_max_pd(other, self); } - template ::value>> + template >> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 4) { @@ -1753,10 +1753,10 @@ namespace xsimd { return _mm512_min_pd(other, self); } - template ::value>> + template >> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 4) { @@ -1803,7 +1803,7 @@ namespace xsimd { return _mm512_mul_pd(self, other); } - template ::value>> + template >> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -1901,7 +1901,7 @@ namespace xsimd { return _mm512_cmp_pd_mask(self, other, _CMP_NEQ_UQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~(self == other); @@ -1942,7 +1942,7 @@ namespace xsimd { return _mm512_reduce_add_pd(rhs); } - template ::value>> + template >> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { __m256i low = detail::lower_half(self), high = detail::upper_half(self); @@ -1983,7 +1983,7 @@ namespace xsimd { return _mm512_reduce_mul_pd(rhs); } - template ::value>> + template >> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -2015,10 +2015,10 @@ namespace xsimd } // sadd - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { auto mask = other < 0; auto self_pos_branch = min(std::numeric_limits::max() - other, self); @@ -2035,7 +2035,7 @@ namespace xsimd // scatter template ::value || std::is_same::value>> + class = std::enable_if_t || std::is_same_v>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -2044,7 +2044,7 @@ namespace xsimd } template ::value || std::is_same::value>> + class = std::enable_if_t || std::is_same_v>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -2080,7 +2080,7 @@ namespace xsimd return _mm512_mask_blend_pd(cond, false_br, true_br); } - template ::value>> + template >> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -2126,7 +2126,7 @@ namespace xsimd } } - template ::value>> + template >> 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 {}); @@ -2135,11 +2135,11 @@ namespace xsimd namespace detail { template - using enable_signed_integer_t = std::enable_if_t::value && std::is_signed::value, + using enable_signed_integer_t = std::enable_if_t && std::is_signed_v, int>; template - using enable_unsigned_integer_t = std::enable_if_t::value && std::is_unsigned::value, + using enable_unsigned_integer_t = std::enable_if_t && std::is_unsigned_v, int>; } @@ -2155,12 +2155,12 @@ namespace xsimd { return _mm512_setr_pd(v0, v1, v2, v3, v4, v5, v6, v7); } - template ::value>> + template >> 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>> + template >> 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 { @@ -2416,10 +2416,10 @@ namespace xsimd } // ssub - template ::value>> + template >> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { return sadd(self, -other); } @@ -2441,12 +2441,12 @@ namespace xsimd } // store_aligned - template ::value>> + template >> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return _mm512_store_si512((__m512i*)mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_aligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm512_store_si512((__m512i*)mem, self); @@ -2463,12 +2463,12 @@ namespace xsimd } // store_unaligned - template ::value>> + template >> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return _mm512_storeu_si512((__m512i*)mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_unaligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm512_storeu_si512((__m512i*)mem, self); @@ -2485,7 +2485,7 @@ namespace xsimd } // store_stream - template ::value, void>> + template , void>> XSIMD_INLINE void store_stream(T* mem, batch const& self, requires_arch) noexcept { _mm512_stream_si512((__m512i*)mem, self); @@ -2502,7 +2502,7 @@ namespace xsimd } // sub - template ::value>> + template >> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -2897,7 +2897,7 @@ namespace xsimd } // zip_hi - template ::value>> + template >> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { @@ -2946,7 +2946,7 @@ namespace xsimd // zip_lo // See zip_hi: one vpermt2{d,q,ps,pd} in place of the unpack+insert128 pile. - template ::value>> + template >> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { @@ -3002,7 +3002,7 @@ namespace xsimd __m512i lo, hi; if constexpr (sizeof(T) == 4) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm512_cvtepi32_epi64(x_lo); hi = _mm512_cvtepi32_epi64(x_hi); @@ -3015,7 +3015,7 @@ namespace xsimd } else if constexpr (sizeof(T) == 2) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm512_cvtepi16_epi32(x_lo); hi = _mm512_cvtepi16_epi32(x_hi); diff --git a/include/xsimd/arch/xsimd_avx512vbmi2.hpp b/include/xsimd/arch/xsimd_avx512vbmi2.hpp index c3f7165ae..84284d215 100644 --- a/include/xsimd/arch/xsimd_avx512vbmi2.hpp +++ b/include/xsimd/arch/xsimd_avx512vbmi2.hpp @@ -68,7 +68,7 @@ namespace xsimd } // rotl - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, int32_t other, requires_arch) noexcept { if constexpr (sizeof(T) == 2) @@ -81,7 +81,7 @@ namespace xsimd } } - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -97,7 +97,7 @@ namespace xsimd } // rotr - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, int32_t other, requires_arch) noexcept { if constexpr (sizeof(T) == 2) @@ -110,7 +110,7 @@ namespace xsimd } } - template ::value>> + template >> 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_avx512vl_128.hpp b/include/xsimd/arch/xsimd_avx512vl_128.hpp index e6eb00356..9922182fc 100644 --- a/include/xsimd/arch/xsimd_avx512vl_128.hpp +++ b/include/xsimd/arch/xsimd_avx512vl_128.hpp @@ -38,7 +38,7 @@ namespace xsimd XSIMD_INLINE batch_bool compare_int_avx512vl_128(batch const& self, batch const& other) noexcept { using register_type = typename batch_bool::register_type; - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -211,7 +211,7 @@ namespace xsimd template = 0> XSIMD_INLINE __m128i maskload128(T const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm_maskz_load_epi32((__mmask8)m, mem); } @@ -223,7 +223,7 @@ namespace xsimd template = 0> XSIMD_INLINE __m128i maskload128(T const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm_maskz_load_epi64((__mmask8)m, mem); } @@ -235,7 +235,7 @@ namespace xsimd template XSIMD_INLINE __m128 maskload128(float const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm_maskz_load_ps((__mmask8)m, mem); } @@ -247,7 +247,7 @@ namespace xsimd template XSIMD_INLINE __m128d maskload128(double const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm_maskz_load_pd((__mmask8)m, mem); } @@ -260,7 +260,7 @@ namespace xsimd template = 0> XSIMD_INLINE void maskstore128(T* mem, __m128i src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm_mask_store_epi32(mem, (__mmask8)m, src); } @@ -272,7 +272,7 @@ namespace xsimd template = 0> XSIMD_INLINE void maskstore128(T* mem, __m128i src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm_mask_store_epi64(mem, (__mmask8)m, src); } @@ -284,7 +284,7 @@ namespace xsimd template XSIMD_INLINE void maskstore128(float* mem, __m128 src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm_mask_store_ps(mem, (__mmask8)m, src); } @@ -296,7 +296,7 @@ namespace xsimd template XSIMD_INLINE void maskstore128(double* mem, __m128d src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm_mask_store_pd(mem, (__mmask8)m, src); } @@ -384,7 +384,7 @@ namespace xsimd // scatter template ::value || std::is_same::value>> + class = std::enable_if_t || std::is_same_v>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -393,7 +393,7 @@ namespace xsimd } template ::value || std::is_same::value>> + class = std::enable_if_t || std::is_same_v>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -457,7 +457,7 @@ namespace xsimd return _mm_castsi128_pd(_mm_mask_set1_epi64(_mm_castpd_si128(self), __mmask8(1 << (I & 3)), tmp)); } - template ::value>> + template >> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -489,10 +489,10 @@ namespace xsimd // bitwise_rshift — signed int64 uses the native EVEX arithmetic shift // (VPSRAQ / VPSRAVQ, lat 1 / CPI 0.5). Every other width/sign keeps the // inherited avx2_128 codegen (srai/srav for 32-bit, srli for unsigned 64). - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { - if constexpr (std::is_signed::value && sizeof(T) == 8) + if constexpr (std::is_signed_v && sizeof(T) == 8) { return _mm_srai_epi64(self, other); } @@ -501,12 +501,12 @@ namespace xsimd return bitwise_rshift(self, other, avx2_128 {}); } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; static_assert(shift < bits, "Shift amount must be less than the number of bits in T"); - if constexpr (std::is_signed::value && sizeof(T) == 8) + if constexpr (std::is_signed_v && sizeof(T) == 8) { return _mm_srai_epi64(self, shift); } @@ -515,10 +515,10 @@ namespace xsimd return bitwise_rshift(self, avx2_128 {}); } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept { - if constexpr (std::is_signed::value && sizeof(T) == 8) + if constexpr (std::is_signed_v && sizeof(T) == 8) { return _mm_srav_epi64(self, other); } @@ -529,7 +529,7 @@ namespace xsimd } // rotl - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -545,12 +545,12 @@ namespace xsimd return rotl(self, other, avx2_128 {}); } } - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, int32_t other, requires_arch) noexcept { return rotl(self, batch(other), A {}); } - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -570,7 +570,7 @@ namespace xsimd } // rotr - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -586,13 +586,13 @@ namespace xsimd return rotr(self, other, avx2_128 {}); } } - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, int32_t other, requires_arch) noexcept { return rotr(self, batch(other), A {}); } - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -706,7 +706,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm_cmp_pd_mask(self, other, _CMP_EQ_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_128(self, other); @@ -730,7 +730,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm_cmp_pd_mask(self, other, _CMP_NEQ_UQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return (~(self == other)); @@ -753,7 +753,7 @@ namespace xsimd { return (typename batch_bool::register_type)_mm_cmp_pd_mask(self, other, _CMP_GT_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_128(self, other); @@ -771,7 +771,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm_cmp_pd_mask(self, other, _CMP_GE_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_128(self, other); @@ -789,7 +789,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm_cmp_pd_mask(self, other, _CMP_LT_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_128(self, other); @@ -807,7 +807,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm_cmp_pd_mask(self, other, _CMP_LE_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_128(self, other); @@ -824,7 +824,7 @@ namespace xsimd { return _mm_mask_blend_pd(cond, false_br, true_br); } - template ::value>> + template >> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -857,12 +857,12 @@ namespace xsimd // true lanes are all-ones. Here batch_bool::data is a k-mask bitfield, // so that broadcast yields garbage. Delegate to the select-based common // implementation instead. - template ::value>> + template >> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return decr_if(self, mask, common {}); } - template ::value>> + template >> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return incr_if(self, mask, common {}); @@ -926,10 +926,10 @@ namespace xsimd } // sadd - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { auto mask = other < 0; auto self_pos_branch = min(std::numeric_limits::max() - other, self); diff --git a/include/xsimd/arch/xsimd_avx512vl_256.hpp b/include/xsimd/arch/xsimd_avx512vl_256.hpp index da4e9d9c7..3d58a67f5 100644 --- a/include/xsimd/arch/xsimd_avx512vl_256.hpp +++ b/include/xsimd/arch/xsimd_avx512vl_256.hpp @@ -38,7 +38,7 @@ namespace xsimd XSIMD_INLINE batch_bool compare_int_avx512vl_256(batch const& self, batch const& other) noexcept { using register_type = typename batch_bool::register_type; - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -210,7 +210,7 @@ namespace xsimd template = 0> XSIMD_INLINE __m256i maskload256(T const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm256_maskz_load_epi32((__mmask8)m, mem); } @@ -222,7 +222,7 @@ namespace xsimd template = 0> XSIMD_INLINE __m256i maskload256(T const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm256_maskz_load_epi64((__mmask8)m, mem); } @@ -234,7 +234,7 @@ namespace xsimd template XSIMD_INLINE __m256 maskload256(float const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm256_maskz_load_ps((__mmask8)m, mem); } @@ -246,7 +246,7 @@ namespace xsimd template XSIMD_INLINE __m256d maskload256(double const* mem, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { return _mm256_maskz_load_pd((__mmask8)m, mem); } @@ -259,7 +259,7 @@ namespace xsimd template = 0> XSIMD_INLINE void maskstore256(T* mem, __m256i src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm256_mask_store_epi32(mem, (__mmask8)m, src); } @@ -271,7 +271,7 @@ namespace xsimd template = 0> XSIMD_INLINE void maskstore256(T* mem, __m256i src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm256_mask_store_epi64(mem, (__mmask8)m, src); } @@ -283,7 +283,7 @@ namespace xsimd template XSIMD_INLINE void maskstore256(float* mem, __m256 src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm256_mask_store_ps(mem, (__mmask8)m, src); } @@ -295,7 +295,7 @@ namespace xsimd template XSIMD_INLINE void maskstore256(double* mem, __m256d src, uint64_t m, Mode) noexcept { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { _mm256_mask_store_pd(mem, (__mmask8)m, src); } @@ -309,7 +309,7 @@ namespace xsimd // Constant masks: prefix/suffix shapes lower to plain moves; interior // masks keep the EVEX path. template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { // all() reaches here only via the avx512f half-split cascade. @@ -328,14 +328,14 @@ namespace xsimd } template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE batch load_masked(T const* mem, batch_bool mask, convert, Mode, requires_arch) noexcept { return detail::maskload256(mem, mask.mask(), Mode {}); } template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept { if constexpr (mask.all()) @@ -353,7 +353,7 @@ namespace xsimd } template ::value && (sizeof(T) == 4 || sizeof(T) == 8)>> + typename = std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8)>> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool mask, Mode, requires_arch) noexcept { detail::maskstore256(mem, src, mask.mask(), Mode {}); @@ -392,7 +392,7 @@ namespace xsimd // scatter template ::value || std::is_same::value>> + class = std::enable_if_t || std::is_same_v>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -401,7 +401,7 @@ namespace xsimd } template ::value || std::is_same::value>> + class = std::enable_if_t || std::is_same_v>> XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, kernel::requires_arch) noexcept @@ -556,7 +556,7 @@ namespace xsimd return _mm256_castsi256_pd(_mm256_mask_set1_epi64(_mm256_castpd_si256(self), __mmask8(1 << (I & 3)), tmp)); } - template ::value>> + template >> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -588,10 +588,10 @@ namespace xsimd // bitwise_rshift — signed int64 uses the native EVEX arithmetic shift // (VPSRAQ / VPSRAVQ, lat 1 / CPI 0.5). Every other width/sign keeps the // inherited avx2 codegen (srai/srav for 32-bit, srli for unsigned 64). - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { - if constexpr (std::is_signed::value && sizeof(T) == 8) + if constexpr (std::is_signed_v && sizeof(T) == 8) { return _mm256_srai_epi64(self, other); } @@ -600,12 +600,12 @@ namespace xsimd return bitwise_rshift(self, other, avx2 {}); } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; static_assert(shift < bits, "Shift amount must be less than the number of bits in T"); - if constexpr (std::is_signed::value && sizeof(T) == 8) + if constexpr (std::is_signed_v && sizeof(T) == 8) { return _mm256_srai_epi64(self, shift); } @@ -614,10 +614,10 @@ namespace xsimd return bitwise_rshift(self, avx2 {}); } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept { - if constexpr (std::is_signed::value && sizeof(T) == 8) + if constexpr (std::is_signed_v && sizeof(T) == 8) { return _mm256_srav_epi64(self, other); } @@ -628,7 +628,7 @@ namespace xsimd } // rotl - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -644,12 +644,12 @@ namespace xsimd return rotl(self, other, avx2 {}); } } - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, int32_t other, requires_arch) noexcept { return rotl(self, batch(other), A {}); } - template ::value>> + template >> XSIMD_INLINE batch rotl(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -669,7 +669,7 @@ namespace xsimd } // rotr - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -685,13 +685,13 @@ namespace xsimd return rotr(self, other, avx2 {}); } } - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, int32_t other, requires_arch) noexcept { return rotr(self, batch(other), A {}); } - template ::value>> + template >> XSIMD_INLINE batch rotr(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -805,7 +805,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm256_cmp_pd_mask(self, other, _CMP_EQ_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_256(self, other); @@ -829,7 +829,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm256_cmp_pd_mask(self, other, _CMP_NEQ_UQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return (~(self == other)); @@ -852,7 +852,7 @@ namespace xsimd { return (typename batch_bool::register_type)_mm256_cmp_pd_mask(self, other, _CMP_GT_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_256(self, other); @@ -870,7 +870,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm256_cmp_pd_mask(self, other, _CMP_GE_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_256(self, other); @@ -888,7 +888,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm256_cmp_pd_mask(self, other, _CMP_LT_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_256(self, other); @@ -906,7 +906,7 @@ namespace xsimd return (typename batch_bool::register_type)_mm256_cmp_pd_mask(self, other, _CMP_LE_OQ); } - template ::value>> + template >> XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return detail::compare_int_avx512vl_256(self, other); @@ -923,7 +923,7 @@ namespace xsimd { return _mm256_mask_blend_pd(cond, false_br, true_br); } - template ::value>> + template >> XSIMD_INLINE batch select(batch_bool const& cond, batch const& true_br, batch const& false_br, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -956,12 +956,12 @@ namespace xsimd // true lanes are all-ones. Here batch_bool::data is a k-mask bitfield, // so that broadcast yields garbage. Delegate to the select-based common // implementation instead. - template ::value>> + template >> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return decr_if(self, mask, common {}); } - template ::value>> + template >> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return incr_if(self, mask, common {}); @@ -1025,10 +1025,10 @@ namespace xsimd } // sadd - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { auto mask = other < 0; auto self_pos_branch = min(std::numeric_limits::max() - other, self); diff --git a/include/xsimd/arch/xsimd_avx_128.hpp b/include/xsimd/arch/xsimd_avx_128.hpp index b9430cab4..346f7259b 100644 --- a/include/xsimd/arch/xsimd_avx_128.hpp +++ b/include/xsimd/arch/xsimd_avx_128.hpp @@ -25,7 +25,7 @@ namespace xsimd using namespace types; // broadcast - template ::value>> + template >> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { return _mm_broadcast_ss(&val); @@ -105,7 +105,7 @@ namespace xsimd // Masks that lower to plain moves go to sse2; the rest gain nothing on a // single register, so take the runtime path. - template ::value>> + template >> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { if constexpr (detail::lowers_to_plain_moves(mask)) @@ -134,7 +134,7 @@ namespace xsimd // 4/8-byte ints: bitcast to same-width float, reuse the vmaskmov path. template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), batch> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), batch> load_masked(T const* mem, batch_bool mask, convert, Mode, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -147,7 +147,7 @@ namespace xsimd } } - template ::value>> + template >> XSIMD_INLINE void store_masked(T* mem, batch const& src, batch_bool_constant mask, Mode, requires_arch) noexcept { if constexpr (detail::lowers_to_plain_moves(mask)) @@ -176,7 +176,7 @@ namespace xsimd // 4/8-byte ints: bitcast to same-width float, reuse the vmaskmov path. template - XSIMD_INLINE std::enable_if_t::value && (sizeof(T) == 4 || sizeof(T) == 8), void> + XSIMD_INLINE std::enable_if_t && (sizeof(T) == 4 || sizeof(T) == 8), void> store_masked(T* mem, batch const& src, batch_bool mask, Mode, requires_arch) noexcept { if constexpr (sizeof(T) == 4) diff --git a/include/xsimd/arch/xsimd_common_fwd.hpp b/include/xsimd/arch/xsimd_common_fwd.hpp index 2e4035d94..795319f1e 100644 --- a/include/xsimd/arch/xsimd_common_fwd.hpp +++ b/include/xsimd/arch/xsimd_common_fwd.hpp @@ -47,32 +47,32 @@ namespace xsimd namespace kernel { // forward declaration - template ::value>> + template >> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE batch mul_hi(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE std::pair, batch> mul_hilo(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept; - template ::value>> + template >> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept; template XSIMD_INLINE batch rotl(batch const& self, STy other, requires_arch) noexcept; diff --git a/include/xsimd/arch/xsimd_constants.hpp b/include/xsimd/arch/xsimd_constants.hpp index 00b719fc9..a5843f09f 100644 --- a/include/xsimd/arch/xsimd_constants.hpp +++ b/include/xsimd/arch/xsimd_constants.hpp @@ -150,7 +150,7 @@ namespace xsimd namespace detail { - template ::value> + template > struct allbits_impl { static constexpr T get_value() noexcept diff --git a/include/xsimd/arch/xsimd_scalar.hpp b/include/xsimd/arch/xsimd_scalar.hpp index 28d0ba21e..e3c18bb0d 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 std::enable_if_t::value && std::is_signed::value, T> + XSIMD_INLINE constexpr std::enable_if_t && std::is_signed_v, T> abs(T v) noexcept { return v < 0 ? -v : v; } template - XSIMD_INLINE constexpr std::enable_if_t::value && std::is_unsigned::value, T> + XSIMD_INLINE constexpr std::enable_if_t && std::is_unsigned_v, T> abs(T v) noexcept { return v; @@ -157,9 +157,9 @@ namespace xsimd XSIMD_INLINE std::common_type_t avg(T const& x, Tp const& y) noexcept { using common_type = std::common_type_t; - if (std::is_floating_point::value) + if (std::is_floating_point_v) return (x + y) / 2; - else if (std::is_unsigned::value) + else if (std::is_unsigned_v) { return (x & y) + ((x ^ y) >> 1); } @@ -178,7 +178,7 @@ namespace xsimd XSIMD_INLINE std::common_type_t avgr(T const& x, Tp const& y) noexcept { using common_type = std::common_type_t; - if (std::is_floating_point::value) + if (std::is_floating_point_v) return avg(x, y); else { @@ -214,7 +214,7 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, T> bitwise_and(T x, T y) noexcept { return x & y; @@ -252,14 +252,14 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value && std::is_integral::value, T0> + XSIMD_INLINE std::enable_if_t && std::is_integral_v, T0> bitwise_lshift(T0 x, T1 shift) noexcept { return x << shift; } template - XSIMD_INLINE std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, 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 std::enable_if_t::value && std::is_integral::value, T0> + XSIMD_INLINE std::enable_if_t && std::is_integral_v, T0> bitwise_rshift(T0 x, T1 shift) noexcept { return x >> shift; } template - XSIMD_INLINE std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, 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 std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, T> bitwise_not(T x) noexcept { return ~x; @@ -315,13 +315,13 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value, T> bitwise_andnot(T x, T y) noexcept + XSIMD_INLINE std::enable_if_t, T> bitwise_andnot(T x, T y) noexcept { return bitwise_and(x, bitwise_not(y)); } template - XSIMD_INLINE std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, T> bitwise_or(T x, T y) noexcept { return x | y; @@ -350,7 +350,7 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, T> bitwise_xor(T x, T y) noexcept { return x ^ y; @@ -419,14 +419,14 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value && std::is_integral::value, T0> + XSIMD_INLINE std::enable_if_t && std::is_integral_v, 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 std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, 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 std::enable_if_t::value && std::is_integral::value, T0> + XSIMD_INLINE std::enable_if_t && std::is_integral_v, 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 std::enable_if_t::value, T> + XSIMD_INLINE std::enable_if_t, 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>> + template >> 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>> + template >> XSIMD_INLINE bool is_flint(const T& x) noexcept { #ifdef __FAST_MATH__ @@ -508,13 +508,13 @@ namespace xsimd #endif } - template ::value>> + template >> XSIMD_INLINE bool is_even(const T& x) noexcept { return is_flint(x * T(0.5)); } - template ::value>> + template >> 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>> + template >> 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>> + template >> XSIMD_INLINE bool ge(const T& x0, const T& x1) noexcept { return x0 >= x1; } - template ::value>> + template >> XSIMD_INLINE bool gt(const T& x0, const T& x1) noexcept { return x0 > x1; } - template ::value>> + template >> XSIMD_INLINE bool le(const T& x0, const T& x1) noexcept { return x0 <= x1; } - template ::value>> + template >> XSIMD_INLINE bool lt(const T& x0, const T& x1) noexcept { return x0 < x1; } - template ::value>> + template >> XSIMD_INLINE bool neq(const T& x0, const T& x1) noexcept { return x0 != x1; @@ -626,7 +626,7 @@ namespace xsimd } #endif - template ::value>> + template >> XSIMD_INLINE auto rsqrt(const T& x) noexcept { using float_type = decltype(std::sqrt(x)); @@ -684,7 +684,7 @@ namespace xsimd return log(val) / std::log(T(2)); } - template ::value>> + template >> 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>> + template >> XSIMD_INLINE T ssub(const T& lhs, const T& rhs) noexcept { if (std::numeric_limits::is_signed) @@ -738,10 +738,10 @@ namespace xsimd namespace detail { template - XSIMD_INLINE std::enable_if_t::value, T0> + XSIMD_INLINE std::enable_if_t, T0> ipow(const T0& x, const T1& n) noexcept { - static_assert(std::is_integral::value, "second argument must be an integer"); + static_assert(std::is_integral_v, "second argument must be an integer"); T0 a = x; T1 b = n; bool const recip = b < 0; @@ -764,13 +764,13 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value, T0> + XSIMD_INLINE std::enable_if_t, T0> pow(const T0& x, const T1& n) noexcept { return detail::ipow(x, n); } - template ::value && std::is_floating_point::value>> + template && std::is_floating_point_v>> XSIMD_INLINE auto pow(const T0& t0, const T1& t1) noexcept { @@ -778,27 +778,27 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value, std::complex> + XSIMD_INLINE std::enable_if_t, std::complex> pow(const std::complex& t0, const T1& t1) noexcept { return detail::ipow(t0, t1); } template - XSIMD_INLINE std::enable_if_t::value, std::complex> + XSIMD_INLINE std::enable_if_t, std::complex> pow(const std::complex& t0, const T1& t1) noexcept { return std::pow(t0, t1); } - template ::value>> + template >> XSIMD_INLINE auto pow(const T0& t0, const std::complex& t1) noexcept { return std::pow(t0, t1); } - template ::value>> + template >> XSIMD_INLINE T bitofsign(T const& x) noexcept { return T(x < T(0)); @@ -819,7 +819,7 @@ namespace xsimd return static_cast(std::signbit(x)); } - template ::value>> + template >> XSIMD_INLINE auto signbit(T const& v) noexcept { return bitofsign(v); @@ -830,7 +830,7 @@ namespace xsimd return v; } - template ::value>> + template >> XSIMD_INLINE T sign(const T& v) noexcept { return v < T(0) ? T(-1.) : v == T(0) ? T(0.) @@ -873,7 +873,7 @@ namespace xsimd return 1; } - template ::value>> + template >> XSIMD_INLINE T signnz(const T& v) noexcept { return v < T(0) ? T(-1.) : T(1.); @@ -913,7 +913,7 @@ namespace xsimd } #endif - template ::value && std::is_scalar::value>> + template && std::is_scalar_v>> XSIMD_INLINE auto min(T0 const& self, T1 const& other) noexcept { return self > other ? other : self; @@ -927,7 +927,7 @@ namespace xsimd return (self.real() < other.real()) ? (self) : (self.real() == other.real() ? (self.imag() < other.imag() ? self : other) : other); } - template ::value && std::is_scalar::value>> + template && std::is_scalar_v>> XSIMD_INLINE auto max(T0 const& self, T1 const& other) noexcept { return self < other ? other : self; @@ -942,19 +942,19 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value, T> fma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t, T> fma(const T& a, const T& b, const T& c) noexcept { return a * b + c; } template - XSIMD_INLINE std::enable_if_t::value, T> fma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t, T> fma(const T& a, const T& b, const T& c) noexcept { return std::fma(a, b, c); } template - XSIMD_INLINE std::enable_if_t::value, T> fms(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t, T> fms(const T& a, const T& b, const T& c) noexcept { return a * b - c; } @@ -1008,13 +1008,13 @@ namespace xsimd #endif template - XSIMD_INLINE std::enable_if_t::value, T> fnma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t, T> fnma(const T& a, const T& b, const T& c) noexcept { return -(a * b) + c; } template - XSIMD_INLINE std::enable_if_t::value, T> fnma(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t, T> fnma(const T& a, const T& b, const T& c) noexcept { return std::fma(-a, b, c); } @@ -1044,13 +1044,13 @@ namespace xsimd #endif template - XSIMD_INLINE std::enable_if_t::value, T> fnms(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t, T> fnms(const T& a, const T& b, const T& c) noexcept { return -(a * b) - c; } template - XSIMD_INLINE std::enable_if_t::value, T> fnms(const T& a, const T& b, const T& c) noexcept + XSIMD_INLINE std::enable_if_t, T> fnms(const T& a, const T& b, const T& c) noexcept { return -std::fma(a, b, c); } @@ -1181,7 +1181,7 @@ namespace xsimd } #endif - template ::value>> + template >> XSIMD_INLINE T frexp(T const& val, int& exp) noexcept { return std::frexp(val, &exp); @@ -1202,7 +1202,7 @@ namespace xsimd template XSIMD_INLINE constexpr T_out batch_cast(T_in const& val) noexcept { - static_assert(!std::is_same::value, "cannot convert to bool, use !x or x != 0"); + static_assert(!std::is_same_v, "cannot convert to bool, use !x or x != 0"); return static_cast(val); } } diff --git a/include/xsimd/arch/xsimd_sse2.hpp b/include/xsimd/arch/xsimd_sse2.hpp index 9d7a2a77f..eccba3b36 100644 --- a/include/xsimd/arch/xsimd_sse2.hpp +++ b/include/xsimd/arch/xsimd_sse2.hpp @@ -82,7 +82,7 @@ namespace xsimd } // add - template ::value>> + template >> XSIMD_INLINE batch add(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -131,7 +131,7 @@ namespace xsimd { return _mm_movemask_pd(self) == 0x03; } - template ::value>> + template >> XSIMD_INLINE bool all(batch_bool const& self, requires_arch) noexcept { return _mm_movemask_epi8(self) == 0xFFFF; @@ -148,14 +148,14 @@ namespace xsimd { return _mm_movemask_pd(self) != 0; } - template ::value>> + template >> XSIMD_INLINE bool any(batch_bool const& self, requires_arch) noexcept { return _mm_movemask_epi8(self) != 0; } // avgr - template ::value>> + template >> XSIMD_INLINE batch avgr(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -173,7 +173,7 @@ namespace xsimd } // avg - template ::value>> + template >> XSIMD_INLINE batch avg(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -210,12 +210,12 @@ namespace xsimd { return _mm_and_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_and(batch const& self, batch const& other, requires_arch) noexcept { return _mm_and_si128(self, other); } - template ::value>> + template >> XSIMD_INLINE batch_bool bitwise_and(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_and_si128(self, other); @@ -245,12 +245,12 @@ namespace xsimd { return _mm_andnot_ps(other, self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_andnot(batch const& self, batch const& other, requires_arch) noexcept { return _mm_andnot_si128(other, self); } - template ::value>> + template >> XSIMD_INLINE batch_bool bitwise_andnot(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_andnot_si128(other, self); @@ -269,7 +269,7 @@ namespace xsimd } // bitwise_lshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -294,7 +294,7 @@ namespace xsimd return {}; } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_lshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -368,12 +368,12 @@ namespace xsimd { return _mm_xor_ps(self, _mm_castsi128_ps(_mm_set1_epi32(-1))); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_not(batch const& self, requires_arch) noexcept { return _mm_xor_si128(self, _mm_set1_epi32(-1)); } - template ::value>> + template >> XSIMD_INLINE batch_bool bitwise_not(batch_bool const& self, requires_arch) noexcept { return _mm_xor_si128(self, _mm_set1_epi32(-1)); @@ -400,12 +400,12 @@ namespace xsimd { return _mm_or_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_or(batch const& self, batch const& other, requires_arch) noexcept { return _mm_or_si128(self, other); } - template ::value>> + template >> XSIMD_INLINE batch_bool bitwise_or(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return _mm_or_si128(self, other); @@ -424,10 +424,10 @@ namespace xsimd } // bitwise_rshift - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, int32_t other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -484,7 +484,7 @@ namespace xsimd } } } - template ::value>> + template >> XSIMD_INLINE batch bitwise_rshift(batch const& self, requires_arch) noexcept { constexpr auto bits = std::numeric_limits::digits + std::numeric_limits::is_signed; @@ -496,7 +496,7 @@ namespace xsimd return self; } - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -555,7 +555,7 @@ namespace xsimd { return _mm_xor_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept { return _mm_xor_si128(self, other); @@ -570,29 +570,29 @@ namespace xsimd { return _mm_xor_pd(self, other); } - template ::value>> + template >> 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>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castsi128_ps(self); } - template >::value>> + template >>> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return batch(self.data); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castps_si128(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castsi128_pd(self); @@ -607,7 +607,7 @@ namespace xsimd { return _mm_castpd_ps(self); } - template ::value>> + template >> XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return _mm_castpd_si128(self); @@ -619,7 +619,7 @@ namespace xsimd { return _mm_set1_ps(val); } - template ::value>> + template >> XSIMD_INLINE batch broadcast(T val, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -679,7 +679,7 @@ namespace xsimd } // decr_if - template ::value>> + template >> XSIMD_INLINE batch decr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self + batch(mask.data); @@ -753,7 +753,7 @@ namespace xsimd { return _mm_castsi128_ps(_mm_cmpeq_epi32(_mm_castps_si128(self), _mm_castps_si128(other))); } - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -782,7 +782,7 @@ namespace xsimd return {}; } } - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch_bool const& self, batch_bool const& other, requires_arch) noexcept { return ~(self != other); @@ -811,7 +811,7 @@ namespace xsimd return _mm_cvtsd_f64(self); } - template ::value>> + template >> XSIMD_INLINE T first(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -882,7 +882,7 @@ namespace xsimd assert(!(mask & ~0x3ul) && "inbound mask"); return _mm_castsi128_pd(_mm_load_si128((const __m128i*)lut[mask])); } - template ::value>> + template >> XSIMD_INLINE batch_bool from_mask(batch_bool const&, uint64_t mask, requires_arch) noexcept { alignas(A::alignment()) static const uint64_t lut64[] = { @@ -959,10 +959,10 @@ namespace xsimd { return _mm_cmpgt_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -1015,14 +1015,14 @@ namespace xsimd } // incr_if - template ::value>> + template >> XSIMD_INLINE batch incr_if(batch const& self, batch_bool const& mask, requires_arch) noexcept { return self - batch(mask.data); } // insert - template ::value>> + template >> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { if constexpr (sizeof(T) == 2) @@ -1053,7 +1053,7 @@ namespace xsimd { return _mm_load_ps(mem); } - template ::value>> + template >> XSIMD_INLINE batch load_aligned(T const* mem, convert, requires_arch) noexcept { return _mm_load_si128((__m128i const*)mem); @@ -1070,7 +1070,7 @@ namespace xsimd { return _mm_loadu_ps(mem); } - template ::value>> + template >> XSIMD_INLINE batch load_unaligned(T const* mem, convert, requires_arch) noexcept { return _mm_loadu_si128((__m128i const*)mem); @@ -1114,7 +1114,7 @@ namespace xsimd } // load_masked - template ::value>> + template >> XSIMD_INLINE batch load_masked(T const* mem, batch_bool_constant mask, convert, Mode, requires_arch) noexcept { if constexpr (sizeof(T) == 2 && mask.prefix() == 1) @@ -1262,10 +1262,10 @@ namespace xsimd { return _mm_cmplt_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch_bool lt(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -1367,7 +1367,7 @@ namespace xsimd } // mask - template ::value>> + template >> XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -1411,7 +1411,7 @@ namespace xsimd { return _mm_max_ps(other, self); } - template ::value>> + template >> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { return select(self > other, self, other); @@ -1428,7 +1428,7 @@ namespace xsimd { return _mm_min_ps(other, self); } - template ::value>> + template >> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { return select(self <= other, self, other); @@ -1526,7 +1526,7 @@ namespace xsimd } // neg - template ::value>> + template >> XSIMD_INLINE batch neg(batch const& self, requires_arch) noexcept { return 0 - self; @@ -1550,7 +1550,7 @@ namespace xsimd { return _mm_cmpneq_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return ~(self == other); @@ -1560,7 +1560,7 @@ namespace xsimd { return _mm_xor_ps(self, other); } - template ::value>> + template >> 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))); @@ -1594,7 +1594,7 @@ namespace xsimd return _mm_cvtss_f32(tmp1); } - template ::value>> + template >> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -1690,7 +1690,7 @@ namespace xsimd return _mm_cvtsd_f64(_mm_mul_sd(self, _mm_unpackhi_pd(self, self))); } - template ::value>> + template >> XSIMD_INLINE T reduce_mul(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 4) @@ -1740,12 +1740,12 @@ namespace xsimd return _mm_or_ps(_mm_and_ps(cond, true_br), _mm_andnot_ps(cond, false_br)); } - template ::value>> + template >> 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>> + template >> 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 {}); @@ -1813,10 +1813,10 @@ namespace xsimd // sadd - template ::value>> + template >> XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -1856,22 +1856,22 @@ namespace xsimd return _mm_setr_ps(values...); } - template ::value>> + template >> XSIMD_INLINE batch set(batch const&, requires_arch, T v0, T v1) noexcept { return _mm_set_epi64x(v1, v0); } - template ::value>> + template >> 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>> + template >> 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>> + template >> 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); @@ -1884,7 +1884,7 @@ namespace xsimd return _mm_setr_pd(values...); } - template ::value>> + template >> XSIMD_INLINE batch_bool set(batch_bool const&, requires_arch, Values... values) noexcept { return set(batch(), A {}, static_cast(values ? -1LL : 0LL)...).data; @@ -1906,10 +1906,10 @@ namespace xsimd // ssub - template ::value>> + template >> XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -2001,12 +2001,12 @@ namespace xsimd { return _mm_store_ps(mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_aligned(T* mem, batch const& self, requires_arch) noexcept { return _mm_store_si128((__m128i*)mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_aligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm_store_si128((__m128i*)mem, self); @@ -2023,12 +2023,12 @@ namespace xsimd { return _mm_storeu_ps(mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_unaligned(T* mem, batch const& self, requires_arch) noexcept { return _mm_storeu_si128((__m128i*)mem, self); } - template ::value>> + template >> XSIMD_INLINE void store_unaligned(T* mem, batch_bool const& self, requires_arch) noexcept { return _mm_storeu_si128((__m128i*)mem, self); @@ -2045,7 +2045,7 @@ namespace xsimd { _mm_stream_ps(mem, self); } - template ::value, void>> + template , void>> XSIMD_INLINE void store_stream(T* mem, batch const& self, requires_arch) noexcept { _mm_stream_si128((__m128i*)mem, self); @@ -2062,7 +2062,7 @@ namespace xsimd { return _mm_sub_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch sub(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -2265,7 +2265,7 @@ namespace xsimd { return _mm_unpackhi_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -2302,7 +2302,7 @@ namespace xsimd { return _mm_unpacklo_ps(self, other); } - template ::value>> + template >> XSIMD_INLINE batch zip_lo(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -2375,7 +2375,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if::value && sizeof(T) <= 2, T>::type + XSIMD_INLINE std::enable_if_t && sizeof(T) <= 2, T> get(batch const& self, ::xsimd::index, requires_arch) noexcept { if constexpr (I == 0) @@ -2394,7 +2394,7 @@ namespace xsimd } template - XSIMD_INLINE typename std::enable_if<(std::is_integral::value && sizeof(T) >= 4) || std::is_floating_point::value, T>::type + XSIMD_INLINE std::enable_if_t<(std::is_integral_v && sizeof(T) >= 4) || std::is_floating_point_v, T> get(batch const& self, ::xsimd::index, requires_arch) noexcept { if constexpr (I == 0) diff --git a/include/xsimd/arch/xsimd_sse3.hpp b/include/xsimd/arch/xsimd_sse3.hpp index a860e4d61..196ed078c 100644 --- a/include/xsimd/arch/xsimd_sse3.hpp +++ b/include/xsimd/arch/xsimd_sse3.hpp @@ -37,7 +37,7 @@ namespace xsimd } // load_unaligned - template ::value>> + template >> 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 c436e3545..73af32cd6 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>> + template >> XSIMD_INLINE bool any(batch const& self, requires_arch) noexcept { return !_mm_testz_si128(self, self); @@ -80,7 +80,7 @@ namespace xsimd } // eq - template ::value>> + template >> XSIMD_INLINE batch_bool eq(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 8) @@ -106,7 +106,7 @@ namespace xsimd } // get - template ::value>> + template >> XSIMD_INLINE T get(batch const& self, ::xsimd::index, requires_arch) noexcept { if constexpr (I == 0) @@ -141,7 +141,7 @@ namespace xsimd } // insert - template ::value>> + template >> XSIMD_INLINE batch insert(batch const& self, T val, index pos, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -171,7 +171,7 @@ namespace xsimd // load_unaligned - template ::value && sizeof(T) > 1)>> + template && 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. @@ -220,10 +220,10 @@ namespace xsimd } // max - template ::value>> + template >> XSIMD_INLINE batch max(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -264,7 +264,7 @@ namespace xsimd } // load_stream - template ::value, void>> + template , void>> XSIMD_INLINE batch load_stream(T const* mem, convert, requires_arch) noexcept { return _mm_stream_load_si128((__m128i*)mem); @@ -281,10 +281,10 @@ namespace xsimd } // min - template ::value>> + template >> XSIMD_INLINE batch min(batch const& self, batch const& other, requires_arch) noexcept { - if (std::is_signed::value) + if (std::is_signed_v) { if constexpr (sizeof(T) == 1) { @@ -325,7 +325,7 @@ namespace xsimd } // mul - template ::value>> + template >> XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -426,7 +426,7 @@ namespace xsimd } } - template ::value>> + template >> 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); @@ -442,7 +442,7 @@ namespace xsimd return _mm_blendv_pd(false_br, true_br, cond); } - template ::value>> + template >> 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(); @@ -500,7 +500,7 @@ namespace xsimd __m128i lo, hi; if constexpr (sizeof(T) == 4) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm_cvtepi32_epi64(x_lo); hi = _mm_cvtepi32_epi64(x_hi); @@ -513,7 +513,7 @@ namespace xsimd } else if constexpr (sizeof(T) == 2) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm_cvtepi16_epi32(x_lo); hi = _mm_cvtepi16_epi32(x_hi); @@ -526,7 +526,7 @@ namespace xsimd } else if constexpr (sizeof(T) == 1) { - if constexpr (std::is_signed::value) + if constexpr (std::is_signed_v) { lo = _mm_cvtepi8_epi16(x_lo); hi = _mm_cvtepi8_epi16(x_hi); diff --git a/include/xsimd/arch/xsimd_ssse3.hpp b/include/xsimd/arch/xsimd_ssse3.hpp index 8e8570f98..4451d5bac 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>> + template && std::is_signed_v>> XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 1) @@ -74,7 +74,7 @@ namespace xsimd } } - template ::value>> + template >> 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; @@ -83,7 +83,7 @@ namespace xsimd } // reduce_add - template ::value>> + template >> XSIMD_INLINE T reduce_add(batch const& self, requires_arch) noexcept { if constexpr (sizeof(T) == 2) @@ -141,7 +141,7 @@ namespace xsimd } template - XSIMD_INLINE std::enable_if_t::value, batch> + XSIMD_INLINE std::enable_if_t, batch> swizzle(batch const& self, batch mask, requires_arch) noexcept { constexpr auto pikes = static_cast>(0x0706050403020100ul); diff --git a/include/xsimd/config/xsimd_arch.hpp b/include/xsimd/config/xsimd_arch.hpp index 63e5566a4..329421833 100644 --- a/include/xsimd/config/xsimd_arch.hpp +++ b/include/xsimd/config/xsimd_arch.hpp @@ -51,7 +51,7 @@ namespace xsimd template struct contains - : std::conditional_t::value, std::true_type, + : std::conditional_t, std::true_type, contains> { }; diff --git a/include/xsimd/config/xsimd_cpu_features_x86.hpp b/include/xsimd/config/xsimd_cpu_features_x86.hpp index 0de055e8f..000760eaa 100644 --- a/include/xsimd/config/xsimd_cpu_features_x86.hpp +++ b/include/xsimd/config/xsimd_cpu_features_x86.hpp @@ -138,55 +138,55 @@ namespace xsimd enum class type {}; }; - using eax_or_empty = std::conditional_t::value, typename m_empty_reg<0>::type, eax>; - using ebx_or_empty = std::conditional_t::value, typename m_empty_reg<1>::type, ebx>; - using ecx_or_empty = std::conditional_t::value, typename m_empty_reg<2>::type, ecx>; - using edx_or_empty = std::conditional_t::value, typename m_empty_reg<3>::type, edx>; + using eax_or_empty = std::conditional_t, typename m_empty_reg<0>::type, eax>; + using ebx_or_empty = std::conditional_t, typename m_empty_reg<1>::type, ebx>; + using ecx_or_empty = std::conditional_t, typename m_empty_reg<2>::type, ecx>; + using edx_or_empty = std::conditional_t, typename m_empty_reg<3>::type, edx>; public: - template ::value, int> = 0> + template , int> = 0> constexpr bool all_bits_set() const noexcept { return x86_reg32_bitset::template all_bits_set(); } - template ::value, int> = 0> + template , int> = 0> constexpr x86_reg32_t get_range() const noexcept { return x86_reg32_bitset::template get_range(); } - template ::value, int> = 0> + template , int> = 0> constexpr bool all_bits_set() const noexcept { return x86_reg32_bitset::template all_bits_set(); } - template ::value, int> = 0> + template , int> = 0> constexpr x86_reg32_t get_range() const noexcept { return x86_reg32_bitset::template get_range(); } - template ::value, int> = 0> + template , int> = 0> constexpr bool all_bits_set() const noexcept { return x86_reg32_bitset::template all_bits_set(); } - template ::value, int> = 0> + template , int> = 0> constexpr x86_reg32_t get_range() const noexcept { return x86_reg32_bitset::template get_range(); } - template ::value, int> = 0> + template , int> = 0> constexpr bool all_bits_set() const noexcept { return x86_reg32_bitset::template all_bits_set(); } - template ::value, int> = 0> + template , int> = 0> constexpr x86_reg32_t get_range() const noexcept { return x86_reg32_bitset::template get_range(); diff --git a/include/xsimd/memory/xsimd_aligned_allocator.hpp b/include/xsimd/memory/xsimd_aligned_allocator.hpp index ee13e1dda..89ddf84a8 100644 --- a/include/xsimd/memory/xsimd_aligned_allocator.hpp +++ b/include/xsimd/memory/xsimd_aligned_allocator.hpp @@ -39,7 +39,7 @@ namespace xsimd * @tparam T type of objects to allocate. * @tparam Align alignment in bytes. */ - template ::value, common, default_arch>::type::alignment()> + template , common, default_arch>::alignment()> class aligned_allocator { public: diff --git a/include/xsimd/types/xsimd_api.hpp b/include/xsimd/types/xsimd_api.hpp index b1ec3e58f..236a4e4a5 100644 --- a/include/xsimd/types/xsimd_api.hpp +++ b/include/xsimd/types/xsimd_api.hpp @@ -570,7 +570,7 @@ namespace xsimd { detail::static_check_supported_config(); using batch_value_type = typename simd_return_type::value_type; - using value_type = std::conditional_t::value, + using value_type = std::conditional_t, bool, batch_value_type>; return simd_return_type(value_type(v)); @@ -1785,7 +1785,7 @@ namespace xsimd * @param y batch involved in the product. * @return the low N bits of the product, lane-wise. */ - template ::value>> + template >> XSIMD_INLINE batch mul_lo(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); @@ -1801,7 +1801,7 @@ namespace xsimd * @param y batch involved in the product. * @return the high N bits of the product, lane-wise. */ - template ::value>> + template >> XSIMD_INLINE batch mul_hi(batch const& x, batch const& y) noexcept { detail::static_check_supported_config(); @@ -1816,7 +1816,7 @@ namespace xsimd * @param y batch involved in the product. * @return pair of batches ``{hi, lo}``. */ - template ::value>> + template >> XSIMD_INLINE std::pair, batch> mul_hilo(batch const& x, batch const& y) noexcept { @@ -2017,7 +2017,7 @@ namespace xsimd * @param y batch of integral values. * @return \c x raised to the power \c y. */ - template ::value>> + template >> XSIMD_INLINE batch pow(batch const& x, ITy y) noexcept { detail::static_check_supported_config(); @@ -2061,7 +2061,7 @@ namespace xsimd * @param x batch of floating point numbers. * @return the reciprocal. */ - template ::value>> + template >> XSIMD_INLINE batch reciprocal(batch const& x) noexcept { detail::static_check_supported_config(); @@ -2434,11 +2434,11 @@ namespace xsimd * @return combined batch */ template - XSIMD_INLINE std::enable_if_t::value, batch> + XSIMD_INLINE std::enable_if_t, batch> shuffle(batch const& x, batch const& y, batch_constant mask) noexcept { static_assert(sizeof(T) == sizeof(Vt), "consistent mask"); - static_assert(std::is_unsigned::value, "mask must hold unsigned indices"); + static_assert(std::is_unsigned_v, "mask must hold unsigned indices"); detail::static_check_supported_config(); return kernel::shuffle(x, y, mask, A {}); } @@ -2530,7 +2530,7 @@ namespace xsimd template XSIMD_INLINE batch slide_left(batch const& x) noexcept { - static_assert(std::is_integral::value, "can only slide batch of integers"); + static_assert(std::is_integral_v, "can only slide batch of integers"); detail::static_check_supported_config(); return kernel::slide_left(x, A {}); } @@ -2551,7 +2551,7 @@ namespace xsimd template XSIMD_INLINE batch slide_right(batch const& x) noexcept { - static_assert(std::is_integral::value, "can only slide batch of integers"); + static_assert(std::is_integral_v, "can only slide batch of integers"); detail::static_check_supported_config(); return kernel::slide_right(x, A {}); } @@ -2850,7 +2850,7 @@ namespace xsimd * @return swizzled batch */ template - XSIMD_INLINE std::enable_if_t::value, batch> + XSIMD_INLINE std::enable_if_t, batch> swizzle(batch const& x, batch_constant mask) noexcept { static_assert(sizeof(T) == sizeof(Vt), "consistent mask"); @@ -2861,7 +2861,7 @@ namespace xsimd XSIMD_INLINE batch, A> swizzle(batch, A> const& x, batch_constant mask) noexcept { static_assert(sizeof(T) == sizeof(Vt), "consistent mask"); - static_assert(std::is_unsigned::value, "mask must hold unsigned indices"); + static_assert(std::is_unsigned_v, "mask must hold unsigned indices"); detail::static_check_supported_config(); return kernel::swizzle(x, mask, A {}); } @@ -2876,7 +2876,7 @@ namespace xsimd * @return swizzled batch */ template - XSIMD_INLINE std::enable_if_t::value, batch> + XSIMD_INLINE std::enable_if_t, batch> swizzle(batch const& x, batch mask) noexcept { static_assert(sizeof(T) == sizeof(Vt), "consistent mask"); @@ -3038,7 +3038,7 @@ namespace xsimd * @param self batch_bool of \c T * @return \c self cast to a \c batch of \c T */ - template ::value, int> = 3> + template , int> = 3> XSIMD_INLINE batch bitwise_cast(batch_bool const& self) noexcept { T z(0); @@ -3046,7 +3046,7 @@ namespace xsimd return select(self, batch(T(~z)), batch(z)); } - template ::value, int> = 3> + template , int> = 3> XSIMD_INLINE batch bitwise_cast(batch_bool const& self) noexcept { T z0(0), z1(0); diff --git a/include/xsimd/types/xsimd_batch.hpp b/include/xsimd/types/xsimd_batch.hpp index b45a8ee4b..f12348418 100644 --- a/include/xsimd/types/xsimd_batch.hpp +++ b/include/xsimd/types/xsimd_batch.hpp @@ -44,16 +44,16 @@ namespace xsimd template constexpr bool has_mask_store_v = has_mask_store::value; -#define XSIMD_DECLARE_MASK_MEMORY(ARCH, SIZE_PREDICATE) \ - template \ - struct has_mask_load> \ - : std::integral_constant::value && (SIZE_PREDICATE)> \ - { \ - }; \ - template \ - struct has_mask_store> \ - : std::integral_constant::value && (SIZE_PREDICATE)> \ - { \ +#define XSIMD_DECLARE_MASK_MEMORY(ARCH, SIZE_PREDICATE) \ + template \ + struct has_mask_load> \ + : std::integral_constant && (SIZE_PREDICATE)> \ + { \ + }; \ + template \ + struct has_mask_store> \ + : std::integral_constant && (SIZE_PREDICATE)> \ + { \ } #define XSIMD_DECLARE_MASK_MEMORY_ALIAS(ARCH, BASE) \ @@ -75,19 +75,19 @@ namespace xsimd // sve / rvv: width-templated, predicate-native at every lane size template - struct has_mask_load>> : std::integral_constant::value> + struct has_mask_load>> : std::integral_constant> { }; template - struct has_mask_store>> : std::integral_constant::value> + struct has_mask_store>> : std::integral_constant> { }; template - struct has_mask_load>> : std::integral_constant::value> + struct has_mask_load>> : std::integral_constant> { }; template - struct has_mask_store>> : std::integral_constant::value> + struct has_mask_store>> : std::integral_constant> { }; @@ -214,7 +214,7 @@ namespace xsimd template class batch : public types::simd_register, public types::integral_only_operators { - static_assert(!std::is_same::value, "use xsimd::batch_bool instead of xsimd::batch"); + static_assert(!std::is_same_v, "use xsimd::batch_bool instead of xsimd::batch"); public: static constexpr std::size_t size = sizeof(types::simd_register) / sizeof(T); ///< Number of scalar elements in this batch. @@ -848,7 +848,7 @@ namespace xsimd Mode mode) noexcept { detail::static_check_supported_config(); - static_assert(std::is_same::value || std::is_same::value, + static_assert(std::is_same_v || std::is_same_v, "supported load mode"); if constexpr (mask.all()) { @@ -879,7 +879,7 @@ namespace xsimd Mode mode) const noexcept { detail::static_check_supported_config(); - static_assert(std::is_same::value || std::is_same::value, + static_assert(std::is_same_v || std::is_same_v, "supported store mode"); if constexpr (mask.none()) { @@ -926,7 +926,7 @@ namespace xsimd XSIMD_INLINE batch batch::gather(U const* src, batch const& index) noexcept { detail::static_check_supported_config(); - static_assert(std::is_convertible::value, "Can't convert from src to this batch's type!"); + static_assert(std::is_convertible_v, "Can't convert from src to this batch's type!"); return kernel::gather(batch {}, src, index, A {}); } @@ -941,7 +941,7 @@ namespace xsimd XSIMD_INLINE void batch::scatter(U* dst, batch const& index) const noexcept { detail::static_check_supported_config(); - static_assert(std::is_convertible::value, "Can't convert from this batch's type to dst!"); + static_assert(std::is_convertible_v, "Can't convert from this batch's type to dst!"); kernel::scatter(*this, dst, index, A {}); } diff --git a/include/xsimd/types/xsimd_batch_constant.hpp b/include/xsimd/types/xsimd_batch_constant.hpp index 54cdade1a..c6f045f85 100644 --- a/include/xsimd/types/xsimd_batch_constant.hpp +++ b/include/xsimd/types/xsimd_batch_constant.hpp @@ -150,7 +150,7 @@ namespace xsimd }; template - static constexpr batch_bool_constant::type::value, std::tuple_element::type::value)...> + static constexpr batch_bool_constant::value, std::tuple_element_t::value)...> apply(std::index_sequence) { return {}; @@ -242,8 +242,8 @@ namespace xsimd template XSIMD_INLINE constexpr batch_bool_constant< T, A2, - std::tuple_element...>>::type::value...> + std::tuple_element_t...>>::value...> splice_impl(std::index_sequence) noexcept { return {}; @@ -331,7 +331,7 @@ namespace xsimd }; template - static constexpr batch_constant::type::value, std::tuple_element::type::value)...> + static constexpr batch_constant::value, std::tuple_element_t::value)...> apply(std::index_sequence) { return {}; @@ -371,7 +371,7 @@ namespace xsimd #undef MAKE_BINARY_OP template - static constexpr batch_bool_constant::type::value, std::tuple_element::type::value)...> + static constexpr batch_bool_constant::value, std::tuple_element_t::value)...> apply_bool(std::index_sequence) { return {}; diff --git a/include/xsimd/types/xsimd_traits.hpp b/include/xsimd/types/xsimd_traits.hpp index 0f7485ae4..c794416ee 100644 --- a/include/xsimd/types/xsimd_traits.hpp +++ b/include/xsimd/types/xsimd_traits.hpp @@ -175,7 +175,7 @@ namespace xsimd template struct simd_condition { - static constexpr bool value = (std::is_same::value && !std::is_same::value) || (std::is_same::value && !std::is_same::value) || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || detail::is_complex::value; + static constexpr bool value = (std::is_same_v && !std::is_same_v) || (std::is_same_v && !std::is_same_v) || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || detail::is_complex::value; }; template diff --git a/include/xsimd/types/xsimd_utils.hpp b/include/xsimd/types/xsimd_utils.hpp index 5dbab8551..26ce5bb09 100644 --- a/include/xsimd/types/xsimd_utils.hpp +++ b/include/xsimd/types/xsimd_utils.hpp @@ -131,7 +131,7 @@ namespace xsimd template struct flipped_sign_type - : detail::flipped_sign_type_impl::value> + : detail::flipped_sign_type_impl> { }; @@ -207,38 +207,38 @@ namespace xsimd **************************************/ template - using enable_arithmetic_t = std::enable_if_t::value, int>; + using enable_arithmetic_t = std::enable_if_t, int>; /// Enable signed integral or floating point template - using enable_signed_numeral_t = std::enable_if_t::value, int>; + using enable_signed_numeral_t = std::enable_if_t, int>; template - using enable_floating_point_t = std::enable_if_t::value, int>; + using enable_floating_point_t = std::enable_if_t, int>; template - using enable_integral_t = std::enable_if_t::value, int>; + using enable_integral_t = std::enable_if_t, int>; template - using enable_signed_integral_t = std::enable_if_t::value && std::is_signed::value, int>; + using enable_signed_integral_t = std::enable_if_t && std::is_signed_v, int>; template - using enable_unsigned_integral_t = std::enable_if_t::value && std::is_unsigned::value, int>; + using enable_unsigned_integral_t = std::enable_if_t && std::is_unsigned_v, int>; template - using enable_sized_signed_t = std::enable_if_t::value && std::is_signed::value && sizeof(T) == S, int>; + using enable_sized_signed_t = std::enable_if_t && std::is_signed_v && sizeof(T) == S, int>; template - using enable_sized_unsigned_t = std::enable_if_t::value && !std::is_signed::value && sizeof(T) == S, int>; + using enable_sized_unsigned_t = std::enable_if_t && !std::is_signed_v && sizeof(T) == S, int>; template - using enable_sized_integral_t = std::enable_if_t::value && sizeof(T) == S, int>; + using enable_sized_integral_t = std::enable_if_t && sizeof(T) == S, int>; template using enable_sized_t = std::enable_if_t; template - using enable_max_sized_integral_t = std::enable_if_t::value && sizeof(T) <= S, int>; + using enable_max_sized_integral_t = std::enable_if_t && sizeof(T) <= S, int>; /******************************** * Matching & mismatching sizes * @@ -251,7 +251,7 @@ namespace xsimd using sizes_mismatch_t = std::enable_if_t; template - using stride_match_t = std::enable_if_t::value && sizeof(T) == sizeof(U), B>; + using stride_match_t = std::enable_if_t && sizeof(T) == sizeof(U), B>; } // namespace detail } // namespace kernel @@ -376,7 +376,7 @@ namespace xsimd bool_pack, bool_pack>; template - using is_all_convertible = all_true::value...>; + using is_all_convertible = all_true...>; template using is_array_initializer = std::enable_if< diff --git a/include/xsimd/utils/bits.hpp b/include/xsimd/utils/bits.hpp index a21e4273b..5d2efbc6d 100644 --- a/include/xsimd/utils/bits.hpp +++ b/include/xsimd/utils/bits.hpp @@ -22,7 +22,7 @@ namespace xsimd template constexpr I make_bit_mask(I bit) { - static_assert(std::is_unsigned::value, "Bit operations must be done on unsigned integers"); + static_assert(std::is_unsigned_v, "Bit operations must be done on unsigned integers"); assert(bit < static_cast(8 * sizeof(I))); return static_cast(I { 1 } << bit); } @@ -31,14 +31,14 @@ namespace xsimd constexpr I make_bit_mask(I bit, Args... bits) { // TODO(C++17): Use fold expression - static_assert(std::is_unsigned::value, "Bit operations must be done on unsigned integers"); + static_assert(std::is_unsigned_v, "Bit operations must be done on unsigned integers"); return make_bit_mask(bit) | make_bit_mask(static_cast(bits)...); } template constexpr bool all_bits_set(I value) { - static_assert(std::is_unsigned::value, "Bit operations must be done on unsigned integers"); + static_assert(std::is_unsigned_v, "Bit operations must be done on unsigned integers"); constexpr I mask = make_bit_mask(static_cast(Bits)...); return (value & mask) == mask; } @@ -46,7 +46,7 @@ namespace xsimd template constexpr I set_bit(I value) { - static_assert(std::is_unsigned::value, "Bit operations must be done on unsigned integers"); + static_assert(std::is_unsigned_v, "Bit operations must be done on unsigned integers"); constexpr I mask = make_bit_mask(static_cast(Bit)); return value | mask; } @@ -57,7 +57,7 @@ namespace xsimd template constexpr I make_low_mask(I width) noexcept { - static_assert(std::is_unsigned::value, "Bit operations must be done on unsigned integers"); + static_assert(std::is_unsigned_v, "Bit operations must be done on unsigned integers"); assert(width <= static_cast(8 * sizeof(I))); if (width == static_cast(8 * sizeof(I))) { diff --git a/include/xsimd/utils/xsimd_type_traits.hpp b/include/xsimd/utils/xsimd_type_traits.hpp index f6fea5d55..5c272469b 100644 --- a/include/xsimd/utils/xsimd_type_traits.hpp +++ b/include/xsimd/utils/xsimd_type_traits.hpp @@ -96,19 +96,19 @@ namespace xsimd }; template - struct remap_num::value>> + struct remap_num>> { using type = xsimd::sized_fp_t; }; template - struct remap_num::value && std::is_signed::value>> + struct remap_num && std::is_signed_v>> { using type = xsimd::sized_int_t; }; template - struct remap_num::value && std::is_unsigned::value>> + struct remap_num && std::is_unsigned_v>> { using type = xsimd::sized_uint_t; }; diff --git a/test/test_arch.cpp b/test/test_arch.cpp index 5d479bbaf..3f460bf27 100644 --- a/test/test_arch.cpp +++ b/test/test_arch.cpp @@ -20,19 +20,19 @@ #ifndef XSIMD_DEFAULT_ARCH static_assert(xsimd::default_arch::supported(), "default arch must be supported"); -static_assert(std::is_same::value, "default arch is the best available"); +static_assert(std::is_same_v, "default arch is the best available"); static_assert(xsimd::supported_architectures::contains(), "default arch is supported"); static_assert(xsimd::all_architectures::contains(), "default arch is a valid arch"); #else namespace xsimd { - static_assert(std::is_same::value, + static_assert(std::is_same_v, "default_arch does not match XSIMD_DEFAULT_ARCH"); } #endif #if !XSIMD_WITH_SVE -static_assert((std::is_base_of::value || !xsimd::neon64::supported()), "on arm, without sve, the best we can do is neon64"); +static_assert((std::is_base_of_v || !xsimd::neon64::supported()), "on arm, without sve, the best we can do is neon64"); #endif struct check_supported @@ -49,7 +49,7 @@ struct check_cpu_has_intruction_set template void operator()(Arch arch) const { - static_assert(std::is_same::value, + static_assert(std::is_same_v, "cannot test instruction set availability on CPU"); } }; @@ -66,9 +66,9 @@ struct check_available template static bool try_load() { - static_assert(std::is_same, decltype(xsimd::load_aligned(std::declval()))>::value, + static_assert(std::is_same_v, decltype(xsimd::load_aligned(std::declval()))>, "loading the expected type"); - static_assert(std::is_same, decltype(xsimd::load_unaligned(std::declval()))>::value, + static_assert(std::is_same_v, decltype(xsimd::load_unaligned(std::declval()))>, "loading the expected type"); return true; } @@ -166,28 +166,28 @@ TEST_CASE("[multi arch support]") CHECK_EQ(4, size_t(batch4i32::size)); CHECK_EQ(4, size_t(batch4u32::size)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same, batch4c::value_type>::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v, batch4c::value_type>)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); #if XSIMD_WITH_SSE2 || XSIMD_WITH_NEON64 || XSIMD_WITH_SVE || XSIMD_WITH_RVV CHECK_EQ(2, size_t(batch2d::size)); CHECK_EQ(2, size_t(batch2z::size)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same, batch2z::value_type>::value)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v, batch2z::value_type>)); #else - CHECK_UNARY(bool(std::is_same::value)); + CHECK_UNARY(bool(std::is_same_v)); #endif #endif #if !XSIMD_WITH_AVX && !XSIMD_WITH_FMA3 && !(XSIMD_WITH_SVE && XSIMD_SVE_BITS == 256) && !(XSIMD_WITH_RVV && XSIMD_RVV_BITS == 256) - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); #else CHECK_EQ(8, size_t(batch8f::size)); CHECK_EQ(8, size_t(batch8i32::size)); @@ -197,12 +197,12 @@ TEST_CASE("[multi arch support]") CHECK_EQ(8, size_t(batch8c::size)); CHECK_EQ(4, size_t(batch4z::size)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same::value)); - CHECK_UNARY(bool(std::is_same, batch8c::value_type>::value)); - CHECK_UNARY(bool(std::is_same, batch4z::value_type>::value)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v)); + CHECK_UNARY(bool(std::is_same_v, batch8c::value_type>)); + CHECK_UNARY(bool(std::is_same_v, batch4z::value_type>)); #endif } diff --git a/test/test_basic_math.cpp b/test/test_basic_math.cpp index e29fdb055..244104db6 100644 --- a/test/test_basic_math.cpp +++ b/test/test_basic_math.cpp @@ -17,7 +17,7 @@ #ifndef __FAST_MATH__ namespace detail { - template ::value> + template > struct infinity_tester { static void test_isfinite() diff --git a/test/test_batch.cpp b/test/test_batch.cpp index 484a051d3..129f9b272 100644 --- a/test/test_batch.cpp +++ b/test/test_batch.cpp @@ -24,19 +24,19 @@ using namespace std::placeholders; namespace detail_test_mulhilo { template - std::enable_if_t::value && (sizeof(T) <= 4), T> + std::enable_if_t && (sizeof(T) <= 4), T> mulhi_reference(T x, T y) noexcept { - using W = std::conditional_t::value, int64_t, uint64_t>; + using W = std::conditional_t, int64_t, uint64_t>; return static_cast((static_cast(x) * static_cast(y)) >> (8 * sizeof(T))); } #if defined(__SIZEOF_INT128__) template - std::enable_if_t::value && (sizeof(T) == 8), T> + std::enable_if_t && (sizeof(T) == 8), T> mulhi_reference(T x, T y) noexcept { - using W = std::conditional_t::value, __int128, unsigned __int128>; + using W = std::conditional_t, __int128, unsigned __int128>; return static_cast((static_cast(x) * static_cast(y)) >> 64); } #else @@ -107,7 +107,7 @@ struct batch_test auto b_converted = static_cast(b1); auto b_native = b1.to_native(); // Check via decltype as register_type raises warning for ignored attributes - CHECK(std::is_same::value); + CHECK(std::is_same_v); batch_type b2 = b_native; // Converting ctor CHECK_BATCH_EQ(b1, b2); @@ -411,7 +411,7 @@ struct batch_test // edge operands that actually exercise the high half constexpr value_type vmin = std::numeric_limits::min(); constexpr value_type vmax = std::numeric_limits::max(); - constexpr bool is_signed = std::is_signed::value; + constexpr bool is_signed = std::is_signed_v; // Pattern A: extremes paired with extremes (covers vmax*vmax, vmin*vmin, // vmin*vmax, vmin*-1 — the classic signed-overflow corners). @@ -997,7 +997,7 @@ struct batch_test std::transform(lhs.cbegin(), lhs.cend(), rhs.cbegin(), expected.begin(), [](const value_type& l, const value_type& r) -> value_type { - if (std::is_integral::value) + if (std::is_integral_v) { return static_cast(((long long)l + r) / 2); } @@ -1015,7 +1015,7 @@ struct batch_test std::transform(lhs.cbegin(), lhs.cend(), rhs.cbegin(), expected.begin(), [](const value_type& l, const value_type& r) -> value_type { - if (std::is_integral::value) + if (std::is_integral_v) { return static_cast(((long long)l + r) / 2 + ((long long)(l + r) & 1)); } @@ -1135,11 +1135,11 @@ struct batch_test void init_operands() { - if constexpr (std::is_integral::value) + if constexpr (std::is_integral_v) { for (size_t i = 0; i < size; ++i) { - bool negative_lhs = std::is_signed::value && (i % 2 == 1); + bool negative_lhs = std::is_signed_v && (i % 2 == 1); lhs[i] = value_type(i) * (negative_lhs ? -3 : 3); if (lhs[i] == value_type(0)) { diff --git a/test/test_batch_bool.cpp b/test/test_batch_bool.cpp index 9b658b2d1..e35d1cfb3 100644 --- a/test/test_batch_bool.cpp +++ b/test/test_batch_bool.cpp @@ -375,9 +375,9 @@ struct batch_bool_test static_assert((B::size == 0) || (((ends_bits_mask >> (B::size - 1)) & 1u) != 0u), "ends last element set"); static_assert((B::size <= 2) || (((ends_bits_mask >> 1) & 1u) == 0u), "ends interior element cleared"); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "as_batch_bool type"); - static_assert(std::is_same(m_prefix)), typename B::batch_bool_type>::value, + static_assert(std::is_same_v(m_prefix)), typename B::batch_bool_type>, "conversion operator type"); // splice API is validated indirectly via arch-specific masked implementations. diff --git a/test/test_batch_cast.cpp b/test/test_batch_cast.cpp index 4efae9a03..954ae0e66 100644 --- a/test/test_batch_cast.cpp +++ b/test/test_batch_cast.cpp @@ -18,14 +18,14 @@ namespace detail { template - inline std::enable_if_t::value && std::is_integral::value, bool> + inline std::enable_if_t && std::is_integral_v, bool> is_convertible(T_in value) { return static_cast(value) <= static_cast(std::numeric_limits::max()); } template - inline std::enable_if_t::value && std::is_signed::value && std::is_integral::value && std::is_signed::value, bool> + inline std::enable_if_t && std::is_signed_v && std::is_integral_v && std::is_signed_v, bool> is_convertible(T_in value) { int64_t signed_value = static_cast(value); @@ -33,29 +33,29 @@ namespace detail } template - inline std::enable_if_t::value && std::is_signed::value && std::is_unsigned::value, bool> + inline std::enable_if_t && std::is_signed_v && std::is_unsigned_v, bool> is_convertible(T_in value) { return value >= 0 && is_convertible(static_cast(value)); } template - inline std::enable_if_t::value && std::is_integral::value, bool> + inline std::enable_if_t && std::is_integral_v, bool> is_convertible(T_in value) { return value < static_cast(std::numeric_limits::max()) && value >= static_cast(std::numeric_limits::lowest()); } template - inline std::enable_if_t::value, bool> + inline std::enable_if_t, bool> is_convertible(T_in) { return true; } template - using uses_fast_cast = std::is_same, - xsimd::kernel::detail::with_fast_conversion>; + constexpr bool uses_fast_cast_v = std::is_same_v, + xsimd::kernel::detail::with_fast_conversion>; } template @@ -402,9 +402,9 @@ TEST_CASE_TEMPLATE("[xsimd cast tests]", B, CONVERSION_TYPES) SUBCASE("use fastcast") { using A = xsimd::default_arch; - static_assert(detail::uses_fast_cast::value, + static_assert(detail::uses_fast_cast_v, "expected int32 to float conversion to use fast_cast"); - static_assert(detail::uses_fast_cast::value, + static_assert(detail::uses_fast_cast_v, "expected float to int32 conversion to use fast_cast"); } } diff --git a/test/test_batch_constant.cpp b/test/test_batch_constant.cpp index e92cf18e8..1d30cff8b 100644 --- a/test/test_batch_constant.cpp +++ b/test/test_batch_constant.cpp @@ -132,101 +132,101 @@ struct constant_batch_test constexpr auto n12_add_n3 = n12 + n3; constexpr auto n15 = xsimd::make_batch_constant, arch_type>(); - static_assert(std::is_same::value, "n12 + n3 == n15"); + static_assert(std::is_same_v, "n12 + n3 == n15"); constexpr auto n12_add_c3 = n12 + c3; - static_assert(std::is_same::value, "n12 + c3 == n15"); + static_assert(std::is_same_v, "n12 + c3 == n15"); constexpr auto n12_sub_n3 = n12 - n3; constexpr auto n9 = xsimd::make_batch_constant, arch_type>(); - static_assert(std::is_same::value, "n12 - n3 == n9"); + static_assert(std::is_same_v, "n12 - n3 == n9"); constexpr auto n12_sub_c3 = n12 - c3; - static_assert(std::is_same::value, "n12 - c3 == n9"); + static_assert(std::is_same_v, "n12 - c3 == n9"); constexpr auto n12_mul_n3 = n12 * n3; constexpr auto n36 = xsimd::make_batch_constant, arch_type>(); - static_assert(std::is_same::value, "n12 * n3 == n36"); + static_assert(std::is_same_v, "n12 * n3 == n36"); constexpr auto n12_mul_c3 = n12 * c3; - static_assert(std::is_same::value, "n12 - c3 == n36"); + static_assert(std::is_same_v, "n12 - c3 == n36"); constexpr auto n12_div_n3 = n12 / n3; constexpr auto n4 = xsimd::make_batch_constant, arch_type>(); - static_assert(std::is_same::value, "n12 / n3 == n4"); + static_assert(std::is_same_v, "n12 / n3 == n4"); constexpr auto n12_div_c3 = n12 / c3; - static_assert(std::is_same::value, "n12 / c3 == n4"); + static_assert(std::is_same_v, "n12 / c3 == n4"); constexpr auto n12_mod_n3 = n12 % n3; constexpr auto n0 = xsimd::make_batch_constant, arch_type>(); - static_assert(std::is_same::value, "n12 % n3 == n0"); + static_assert(std::is_same_v, "n12 % n3 == n0"); constexpr auto n12_mod_c3 = n12 % c3; - static_assert(std::is_same::value, "n12 % c3 == n0"); + static_assert(std::is_same_v, "n12 % c3 == n0"); constexpr auto n12_land_n3 = n12 & n3; - static_assert(std::is_same::value, "n12 & n3 == n0"); + static_assert(std::is_same_v, "n12 & n3 == n0"); constexpr auto n12_land_c3 = n12 & c3; - static_assert(std::is_same::value, "n12 & c3 == n0"); + static_assert(std::is_same_v, "n12 & c3 == n0"); constexpr auto n12_lor_n3 = n12 | n3; - static_assert(std::is_same::value, "n12 | n3 == n15"); + static_assert(std::is_same_v, "n12 | n3 == n15"); constexpr auto n12_lor_c3 = n12 | c3; - static_assert(std::is_same::value, "n12 | c3 == n15"); + static_assert(std::is_same_v, "n12 | c3 == n15"); constexpr auto n12_lxor_n3 = n12 ^ n3; - static_assert(std::is_same::value, "n12 ^ n3 == n15"); + static_assert(std::is_same_v, "n12 ^ n3 == n15"); constexpr auto n12_lxor_c3 = n12 ^ c3; - static_assert(std::is_same::value, "n12 ^ c3 == n15"); + static_assert(std::is_same_v, "n12 ^ c3 == n15"); constexpr auto n96 = xsimd::make_batch_constant, arch_type>(); constexpr auto n12_lshift_n3 = n12 << n3; - static_assert(std::is_same::value, "n12 << n3 == n96"); + static_assert(std::is_same_v, "n12 << n3 == n96"); constexpr auto n12_lshift_c3 = n12 << c3; - static_assert(std::is_same::value, "n12 << c3 == n96"); + static_assert(std::is_same_v, "n12 << c3 == n96"); constexpr auto n1 = xsimd::make_batch_constant, arch_type>(); constexpr auto n12_rshift_n3 = n12 >> n3; - static_assert(std::is_same::value, "n12 >> n3 == n1"); + static_assert(std::is_same_v, "n12 >> n3 == n1"); constexpr auto n12_rshift_c3 = n12 >> c3; - static_assert(std::is_same::value, "n12 >> c3 == n1"); + static_assert(std::is_same_v, "n12 >> c3 == n1"); constexpr auto n12_uadd = +n12; - static_assert(std::is_same::value, "+n12 == n12"); + static_assert(std::is_same_v, "+n12 == n12"); constexpr auto n12_inv = ~n12; constexpr auto n12_inv_ = xsimd::make_batch_constant, arch_type>(); - static_assert(std::is_same::value, "~n12 == n12_inv"); + static_assert(std::is_same_v, "~n12 == n12_inv"); constexpr auto n12_usub = -n12; constexpr auto n12_usub_ = xsimd::make_batch_constant, arch_type>(); - static_assert(std::is_same::value, "-n12 == n12_usub"); + static_assert(std::is_same_v, "-n12 == n12_usub"); // comparison operators using true_batch_type = decltype(xsimd::make_batch_bool_constant()); using false_batch_type = decltype(xsimd::make_batch_bool_constant()); - static_assert(std::is_same::value, "same type"); + static_assert(std::is_same_v, "same type"); - static_assert(std::is_same::value, "n12 == n12"); - static_assert(std::is_same::value, "n12 == n3"); - static_assert(std::is_same::value, "n12 == c3"); + static_assert(std::is_same_v, "n12 == n12"); + static_assert(std::is_same_v, "n12 == n3"); + static_assert(std::is_same_v, "n12 == c3"); - static_assert(std::is_same::value, "n12 != n12"); - static_assert(std::is_same::value, "n12 != n3"); - static_assert(std::is_same::value, "n12 != c3"); + static_assert(std::is_same_v, "n12 != n12"); + static_assert(std::is_same_v, "n12 != n3"); + static_assert(std::is_same_v, "n12 != c3"); - static_assert(std::is_same::value, "n12 < n12"); - static_assert(std::is_same::value, "n12 < n3"); - static_assert(std::is_same::value, "n12 < c3"); + static_assert(std::is_same_v, "n12 < n12"); + static_assert(std::is_same_v, "n12 < n3"); + static_assert(std::is_same_v, "n12 < c3"); - static_assert(std::is_same n12), false_batch_type>::value, "n12 > n12"); - static_assert(std::is_same n3), true_batch_type>::value, "n12 > n3"); - static_assert(std::is_same c3), true_batch_type>::value, "n12 > c3"); + static_assert(std::is_same_v n12), false_batch_type>, "n12 > n12"); + static_assert(std::is_same_v n3), true_batch_type>, "n12 > n3"); + static_assert(std::is_same_v c3), true_batch_type>, "n12 > c3"); - static_assert(std::is_same::value, "n12 <= n12"); - static_assert(std::is_same::value, "n12 <= n3"); - static_assert(std::is_same::value, "n12 <= c3"); + static_assert(std::is_same_v, "n12 <= n12"); + static_assert(std::is_same_v, "n12 <= n3"); + static_assert(std::is_same_v, "n12 <= c3"); - static_assert(std::is_same= n12), true_batch_type>::value, "n12 >= n12"); - static_assert(std::is_same= n3), true_batch_type>::value, "n12 >= n3"); - static_assert(std::is_same= c3), true_batch_type>::value, "n12 >= c3"); + static_assert(std::is_same_v= n12), true_batch_type>, "n12 >= n12"); + static_assert(std::is_same_v= n3), true_batch_type>, "n12 >= n3"); + static_assert(std::is_same_v= c3), true_batch_type>, "n12 >= c3"); } }; @@ -369,25 +369,25 @@ struct constant_bool_batch_test constexpr auto y = xsimd::make_batch_bool_constant(); constexpr auto x_or_y = x | y; - static_assert(std::is_same::value, "x | y == true"); + static_assert(std::is_same_v, "x | y == true"); constexpr auto x_lor_y = x || y; - static_assert(std::is_same::value, "x || y == true"); + static_assert(std::is_same_v, "x || y == true"); constexpr auto x_and_y = x & y; - static_assert(std::is_same::value, "x & y == false"); + static_assert(std::is_same_v, "x & y == false"); constexpr auto x_land_y = x && y; - static_assert(std::is_same::value, "x && y == false"); + static_assert(std::is_same_v, "x && y == false"); constexpr auto x_xor_y = x ^ y; - static_assert(std::is_same::value, "x ^ y == true"); + static_assert(std::is_same_v, "x ^ y == true"); constexpr auto not_x = !x; - static_assert(std::is_same::value, "!x == y"); + static_assert(std::is_same_v, "!x == y"); constexpr auto inv_x = ~x; - static_assert(std::is_same::value, "~x == y"); + static_assert(std::is_same_v, "~x == y"); } struct first_half diff --git a/test/test_batch_int.cpp b/test/test_batch_int.cpp index fec1f27c6..e8e9b23b3 100644 --- a/test/test_batch_int.cpp +++ b/test/test_batch_int.cpp @@ -206,7 +206,7 @@ struct batch_int_test 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); + bool negative_lhs = std::is_signed_v && (i % 2 == 1); lhs[i] = value_type(i) * (negative_lhs ? -10 : 10); if (lhs[i] == value_type(0)) { @@ -306,7 +306,7 @@ struct batch_int_test void test_less_than_underflow() const { batch_type test_negative_compare = batch_type(5) - 6; - if (std::is_unsigned::value) + if (std::is_unsigned_v) { CHECK_FALSE(xsimd::any(test_negative_compare < 1)); } diff --git a/test/test_complex_trigonometric.cpp b/test/test_complex_trigonometric.cpp index 16e577ce1..89fdbd4aa 100644 --- a/test/test_complex_trigonometric.cpp +++ b/test/test_complex_trigonometric.cpp @@ -172,13 +172,13 @@ struct complex_trigonometric_test } } - template ::value, int> = 0> + template , int> = 0> void test_conditional_tan() { test_tan_impl(); } - template ::value, int> = 0> + template , int> = 0> void test_conditional_tan() { #if (XSIMD_ARM_INSTR_SET >= XSIMD_ARM7_NEON_VERSION) diff --git a/test/test_load_store.cpp b/test/test_load_store.cpp index f89f89c0f..08b34572f 100644 --- a/test/test_load_store.cpp +++ b/test/test_load_store.cpp @@ -368,7 +368,7 @@ struct load_store_test using lower_arch = xsimd::sse2; using expected_batch_type = xsimd::batch; using load_as_return_type = decltype(xsimd::load_as(std::declval(), xsimd::aligned_mode())); - static_assert(std::is_same::value, "honoring arch parameter"); + static_assert(std::is_same_v, "honoring arch parameter"); }; #endif @@ -429,7 +429,7 @@ struct load_store_test CHECK_BATCH_EQ(b, expected); stream_load_if_same(v.data(), b, expected, name, - std::integral_constant::value> {}); + std::integral_constant> {}); run_mask_tests(v, name, b, expected, std::is_same {}); } @@ -583,11 +583,11 @@ struct load_store_test struct test_load_char { /* Make sure xsimd doesn't try to be smart with char types */ - static_assert(std::is_same, decltype(xsimd::load_as(std::declval(), xsimd::aligned_mode()))>::value, + static_assert(std::is_same_v, decltype(xsimd::load_as(std::declval(), xsimd::aligned_mode()))>, "honor explicit type request"); - static_assert(std::is_same, decltype(xsimd::load_as(std::declval(), xsimd::aligned_mode()))>::value, + static_assert(std::is_same_v, decltype(xsimd::load_as(std::declval(), xsimd::aligned_mode()))>, "honor explicit type request"); - static_assert(std::is_same, decltype(xsimd::load_as(std::declval(), xsimd::aligned_mode()))>::value, + static_assert(std::is_same_v, decltype(xsimd::load_as(std::declval(), xsimd::aligned_mode()))>, "honor explicit type request"); }; @@ -622,7 +622,7 @@ struct load_store_test CHECK_VECTOR_EQ(res, v); stream_store_if_same(res, b, v, name, - std::integral_constant::value> {}); + std::integral_constant> {}); V expected_masked(size); diff --git a/test/test_memory.cpp b/test/test_memory.cpp index 1baebb533..3e99d2dc2 100644 --- a/test/test_memory.cpp +++ b/test/test_memory.cpp @@ -35,9 +35,9 @@ TEST_CASE("[alignment]") if (xsimd::default_arch::requires_alignment()) { - CHECK_UNARY((std::is_same::value)); - CHECK_UNARY((std::is_same::value)); - CHECK_UNARY((std::is_same::value)); + CHECK_UNARY((std::is_same_v)); + CHECK_UNARY((std::is_same_v)); + CHECK_UNARY((std::is_same_v)); } } diff --git a/test/test_traits.cpp b/test/test_traits.cpp index af8e18fbb..3ed1aac17 100644 --- a/test/test_traits.cpp +++ b/test/test_traits.cpp @@ -24,15 +24,15 @@ struct traits_test { using traits_type = xsimd::simd_traits; CHECK_EQ(traits_type::size, batch_type::size); - constexpr bool same_type = std::is_same::value; + constexpr bool same_type = std::is_same_v; CHECK_UNARY(same_type); using batch_bool_type = xsimd::batch_bool; - constexpr bool same_bool_type = std::is_same::value; + constexpr bool same_bool_type = std::is_same_v; CHECK_UNARY(same_bool_type); using vector_traits_type = xsimd::simd_traits>; CHECK_EQ(vector_traits_type::size, 1); - constexpr bool vec_same_type = std::is_same>::value; + constexpr bool vec_same_type = std::is_same_v>; CHECK_UNARY(vec_same_type); } @@ -40,29 +40,29 @@ struct traits_test { using traits_type = xsimd::revert_simd_traits; CHECK_EQ(traits_type::size, batch_type::size); - constexpr bool same_type = std::is_same::value; + constexpr bool same_type = std::is_same_v; CHECK_UNARY(same_type); } void test_simd_return_type() { using rtype1 = xsimd::simd_return_type; - constexpr bool res1 = std::is_same>::value; + constexpr bool res1 = std::is_same_v>; CHECK_UNARY(res1); using rtype2 = xsimd::simd_return_type; - constexpr bool res2 = std::is_same>::value; + constexpr bool res2 = std::is_same_v>; CHECK_UNARY(res2); } void test_mask_type() { using mtype0 = xsimd::mask_type_t; - constexpr bool res0 = std::is_same>>::value; + constexpr bool res0 = std::is_same_v>>; CHECK_UNARY(res0); using mtype1 = xsimd::mask_type_t; - constexpr bool res1 = std::is_same::value; + constexpr bool res1 = std::is_same_v; CHECK_UNARY(res1); } }; @@ -102,15 +102,15 @@ struct complex_traits_test { using traits_type = xsimd::simd_traits; CHECK_EQ(traits_type::size, batch_type::size); - constexpr bool same_type = std::is_same::value; + constexpr bool same_type = std::is_same_v; CHECK_UNARY(same_type); using batch_bool_type = xsimd::batch_bool; - constexpr bool same_bool_type = std::is_same::value; + constexpr bool same_bool_type = std::is_same_v; CHECK_UNARY(same_bool_type); using vector_traits_type = xsimd::simd_traits>; CHECK_EQ(vector_traits_type::size, 1); - constexpr bool vec_same_type = std::is_same>::value; + constexpr bool vec_same_type = std::is_same_v>; CHECK_UNARY(vec_same_type); } @@ -118,29 +118,29 @@ struct complex_traits_test { using traits_type = xsimd::revert_simd_traits; CHECK_EQ(traits_type::size, batch_type::size); - constexpr bool same_type = std::is_same::value; + constexpr bool same_type = std::is_same_v; CHECK_UNARY(same_type); } void test_simd_return_type() { using rtype1 = xsimd::simd_return_type; - constexpr bool res1 = std::is_same>>::value; + constexpr bool res1 = std::is_same_v>>; CHECK_UNARY(res1); using rtype2 = xsimd::simd_return_type; - constexpr bool res2 = std::is_same>::value; + constexpr bool res2 = std::is_same_v>; CHECK_UNARY(res2); } void test_mask_type() { using mtype0 = xsimd::mask_type_t; - constexpr bool res0 = std::is_same>>::value; + constexpr bool res0 = std::is_same_v>>; CHECK_UNARY(res0); using mtype1 = xsimd::mask_type_t; - constexpr bool res1 = std::is_same::value; + constexpr bool res1 = std::is_same_v; CHECK_UNARY(res1); } }; diff --git a/test/test_utils.hpp b/test/test_utils.hpp index caa8b8f8e..f0d64a7df 100644 --- a/test/test_utils.hpp +++ b/test/test_utils.hpp @@ -87,25 +87,25 @@ namespace detail { // define some overloads here as integer versions do not exist for msvc template - inline std::enable_if_t::value, bool> isinf(const T& c) + inline std::enable_if_t, bool> isinf(const T& c) { return std::isinf(c); } template - inline std::enable_if_t::value, bool> isinf(const T&) + inline std::enable_if_t, bool> isinf(const T&) { return false; } template - inline std::enable_if_t::value, bool> isnan(const T& c) + inline std::enable_if_t, bool> isnan(const T& c) { return std::isnan(c); } template - inline std::enable_if_t::value, bool> isnan(const T&) + inline std::enable_if_t, bool> isnan(const T&) { return false; } @@ -187,7 +187,7 @@ namespace detail using std::max; // direct compare integers -- but need tolerance for inexact double conversion - if (std::is_integral::value && lhs < 10e6 && rhs < 10e6) + if (std::is_integral_v && lhs < 10e6 && rhs < 10e6) { return lhs == rhs; } @@ -401,7 +401,7 @@ namespace detail void stringify(std::ostream* os) const override { *os << msg_; } }; - template ::value, int>::type = 0> + template , int> = 0> std::string to_string_full_precision(T value) { // TODO(C++17): use std::to_chars @@ -410,7 +410,7 @@ namespace detail return ss.str(); } - template ::value, int>::type = 0> + template , int> = 0> std::string to_string_full_precision(T value) { return doctest::toString(value).c_str(); diff --git a/test/test_xsimd_api.cpp b/test/test_xsimd_api.cpp index 454c360c9..36579ba97 100644 --- a/test/test_xsimd_api.cpp +++ b/test/test_xsimd_api.cpp @@ -366,7 +366,7 @@ struct xsimd_api_integral_types_functions /* Test when T is a batch_constant only, not a scalar. */ template - void test_bitwise_lshift_multiple(T const& vals, std::enable_if_t::value, int> = 0) + void test_bitwise_lshift_multiple(T const& vals, std::enable_if_t, int> = 0) { #ifndef XSIMD_NO_SUPPORTED_ARCHITECTURE constexpr auto Max = static_cast(std::numeric_limits::digits); @@ -389,7 +389,7 @@ struct xsimd_api_integral_types_functions /* Test multiple does not make sense when T is scalar. */ template - void test_bitwise_lshift_multiple(T const&, std::enable_if_t::value, int> = 0) + void test_bitwise_lshift_multiple(T const&, std::enable_if_t, int> = 0) { } @@ -668,7 +668,7 @@ struct xsimd_api_float_types_functions { value_type val(3.3); int res; - std::conditional_t::value, int, xsimd::as_integer_t> vres; + std::conditional_t, int, xsimd::as_integer_t> vres; CHECK_EQ(extract(xsimd::frexp(T(val), vres)), std::frexp(val, &res)); CHECK_EQ(extract(vres), res); } @@ -697,7 +697,7 @@ struct xsimd_api_float_types_functions { value_type val0(4); xsimd::as_integer_t val1(2); - using exponent_type = std::conditional_t::value, int, xsimd::as_integer_t>; + using exponent_type = std::conditional_t, int, xsimd::as_integer_t>; CHECK_EQ(extract(xsimd::ldexp(T(val0), exponent_type(val1))), std::ldexp(val0, static_cast(val1))); } void test_lgamma() @@ -1289,7 +1289,7 @@ struct xsimd_api_all_types_functions value_type val2(2); value_type val3(3); - if (std::is_integral::value) + if (std::is_integral_v) CHECK_EQ(extract(xsimd::avgr(T(val2), T(val3))), (val2 + val3 + 1) / value_type(2)); else CHECK_EQ(extract(xsimd::avgr(T(val2), T(val3))), (val2 + val3) / value_type(2));