Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/pico_bench.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ namespace pico_bench
}

template <typename Fn>
std::enable_if_t<std::is_void<decltype(std::declval<Fn>()())>::value, stats_type>
std::enable_if_t<std::is_void_v<decltype(std::declval<Fn>()())>, stats_type>
operator()(Fn fn) const
{
return (*this)(BenchWrapper<Fn> { fn });
}

template <typename Fn>
std::enable_if_t<std::is_same<decltype(std::declval<Fn>()()), T>::value, stats_type>
std::enable_if_t<std::is_same_v<decltype(std::declval<Fn>()()), T>, stats_type>
operator()(Fn fn) const
{
// Do a single un-timed warm up run
Expand Down
18 changes: 9 additions & 9 deletions include/xsimd/arch/common/xsimd_common_arithmetic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ namespace xsimd
using namespace types;

// bitwise_lshift
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return detail::apply([](T x, T y) noexcept
{ return x << y; },
self, other);
}
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, requires_arch<common>) noexcept
{
constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
Expand All @@ -45,14 +45,14 @@ namespace xsimd
}

// bitwise_rshift
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return detail::apply([](T x, T y) noexcept
{ return x >> y; },
self, other);
}
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, requires_arch<common>) noexcept
{
constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
Expand Down Expand Up @@ -170,7 +170,7 @@ namespace xsimd
}

// mul
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return detail::apply([](T x, T y) noexcept -> T
Expand Down Expand Up @@ -298,7 +298,7 @@ namespace xsimd
}
}

template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> mul_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return detail::apply([](T x, T y) noexcept -> T
Expand All @@ -307,7 +307,7 @@ namespace xsimd
}

// mul_hilo
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE std::pair<batch<T, A>, batch<T, A>>
mul_hilo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
Expand Down Expand Up @@ -365,7 +365,7 @@ namespace xsimd
{
return add(self, other); // no saturated arithmetic on floating point numbers
}
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
if (std::is_signed_v<T>)
Expand Down Expand Up @@ -393,7 +393,7 @@ namespace xsimd
{
return sub(self, other); // no saturated arithmetic on floating point numbers
}
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
if (std::is_signed_v<T>)
Expand Down
6 changes: 3 additions & 3 deletions include/xsimd/arch/common/xsimd_common_logical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ namespace xsimd
namespace detail
{
template <typename T, typename A>
using is_batch_bool_register_same = std::is_same<typename batch_bool<T, A>::register_type, typename batch<T, A>::register_type>;
constexpr bool is_batch_bool_register_same_v = std::is_same_v<typename batch_bool<T, A>::register_type, typename batch<T, A>::register_type>;
}

template <class A, class T, std::enable_if_t<detail::is_batch_bool_register_same<T, A>::value, int> = 3>
template <class A, class T, std::enable_if_t<detail::is_batch_bool_register_same_v<T, A>, int> = 3>
XSIMD_INLINE batch_bool<T, A> select(batch_bool<T, A> const& cond, batch_bool<T, A> const& true_br, batch_bool<T, A> const& false_br, requires_arch<common>)
{
using register_type = typename batch_bool<T, A>::register_type;
Expand All @@ -223,7 +223,7 @@ namespace xsimd
return batch_bool<T, A> { select(cond, true_v, false_v) };
}

template <class A, class T, std::enable_if_t<!detail::is_batch_bool_register_same<T, A>::value, int> = 3>
template <class A, class T, std::enable_if_t<!detail::is_batch_bool_register_same_v<T, A>, int> = 3>
XSIMD_INLINE batch_bool<T, A> select(batch_bool<T, A> const& cond, batch_bool<T, A> const& true_br, batch_bool<T, A> const& false_br, requires_arch<common>)
{
return (true_br & cond) | (bitwise_andnot(false_br, cond));
Expand Down
4 changes: 2 additions & 2 deletions include/xsimd/arch/common/xsimd_common_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,7 @@ namespace xsimd
return { reduce_add(self.real()), reduce_add(self.imag()) };
}

template <class A, class T, class /*=std::enable_if_t<std::is_scalar<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_scalar_v<T>>*/>
XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<common>) noexcept
{
alignas(A::alignment()) T buffer[batch<T, A>::size];
Expand Down Expand Up @@ -2189,7 +2189,7 @@ namespace xsimd
return res;
}

template <class A, class T, class /*=std::enable_if_t<std::is_scalar<T>::value>*/>
template <class A, class T, class /*=std::enable_if_t<std::is_scalar_v<T>>*/>
XSIMD_INLINE T reduce_mul(batch<T, A> const& self, requires_arch<common>) noexcept
{
alignas(A::alignment()) T buffer[batch<T, A>::size];
Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/common/xsimd_common_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ namespace xsimd
std::is_same_v<T_in, T_out>
&& std::is_integral_v<T_out>
&& !std::is_void_v<sized_fp_t<sizeof(T_out)>>
&& types::has_simd_register<sized_fp_t<sizeof(T_out)>, A>::value>;
&& types::has_simd_register_v<sized_fp_t<sizeof(T_out)>, A>>;

// Scalar-buffer fallback: materialize masked-off lanes as zero, then load.
template <class A, class T_in, class T_out, bool... Values, class alignment>
Expand Down
10 changes: 5 additions & 5 deletions include/xsimd/arch/xsimd_avx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,24 +1100,24 @@ namespace xsimd
// True when batch_bool<T, A> shares the data register (__m256/__m256d) rather
// than an EVEX k-register; the _mm256_cast*_si256 path below needs the former.
template <class T, class A>
using uses_vector_mask = std::is_same<typename batch_bool<T, A>::register_type,
typename batch<T, A>::register_type>;
inline constexpr bool uses_vector_mask_v = std::is_same_v<typename batch_bool<T, A>::register_type,
typename batch<T, A>::register_type>;

template <class A, class = std::enable_if_t<uses_vector_mask<float, A>::value>>
template <class A, class = std::enable_if_t<uses_vector_mask_v<float, A>>>
XSIMD_INLINE void maskstore(float* mem, batch_bool<float, A> const& mask, batch<float, A> const& src) noexcept
{
_mm256_maskstore_ps(mem, _mm256_castps_si256(mask), src);
}

template <class A, class = std::enable_if_t<uses_vector_mask<double, A>::value>>
template <class A, class = std::enable_if_t<uses_vector_mask_v<double, A>>>
XSIMD_INLINE void maskstore(double* mem, batch_bool<double, A> const& mask, batch<double, A> const& src) noexcept
{
_mm256_maskstore_pd(mem, _mm256_castpd_si256(mask), src);
}
}

template <class A, class T, bool... Values, class Mode,
typename = std::enable_if_t<std::is_floating_point_v<T> && detail::uses_vector_mask<T, A>::value>>
typename = std::enable_if_t<std::is_floating_point_v<T> && detail::uses_vector_mask_v<T, A>>>
XSIMD_INLINE void store_masked(T* mem, batch<T, A> const& src, batch_bool_constant<T, A, Values...> mask, Mode, requires_arch<avx>) noexcept
{
constexpr size_t half_size = batch<T, A>::size / 2;
Expand Down
5 changes: 4 additions & 1 deletion include/xsimd/arch/xsimd_avx512f.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2669,6 +2669,9 @@ namespace xsimd
{
};

template <class T, class A, T... Idx>
inline constexpr bool is_pair_of_contiguous_indices_v = is_pair_of_contiguous_indices<T, A, Idx...>::value;

template <class A, uint16_t I0, uint16_t I1, uint16_t I2, uint16_t I3, uint16_t I4, uint16_t I5, uint16_t I6, uint16_t I7,
uint16_t I8, uint16_t I9, uint16_t I10, uint16_t I11, uint16_t I12, uint16_t I13, uint16_t I14, uint16_t I15,
uint16_t I16, uint16_t I17, uint16_t I18, uint16_t I19, uint16_t I20, uint16_t I21, uint16_t I22, uint16_t I23,
Expand Down Expand Up @@ -2700,7 +2703,7 @@ namespace xsimd
template <class A, uint16_t... Idx>
XSIMD_INLINE batch<uint16_t, A> swizzle(batch<uint16_t, A> const& self, batch_constant<uint16_t, A, Idx...> mask, requires_arch<avx512f>) noexcept
{
if constexpr (detail::is_pair_of_contiguous_indices<uint16_t, A, Idx...>::value)
if constexpr (detail::is_pair_of_contiguous_indices_v<uint16_t, A, Idx...>)
{
constexpr typename detail::fold_batch_constant<A, Idx...>::type mask32;
return _mm512_permutexvar_epi32(static_cast<batch<uint32_t, A>>(mask32), self);
Expand Down
3 changes: 3 additions & 0 deletions include/xsimd/arch/xsimd_common_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ namespace xsimd
{
template <typename T, class A>
struct has_simd_register;

template <typename T, class A>
inline constexpr bool has_simd_register_v = has_simd_register<T, A>::value;
}

namespace kernel
Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/xsimd_emulated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ namespace xsimd
}

// isnan
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size, class = std::enable_if_t<std::is_floating_point<T>::value>>
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size, class = std::enable_if_t<std::is_floating_point_v<T>>>
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
{
return detail::emulated_apply([](T v)
Expand Down
Loading
Loading