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
2 changes: 1 addition & 1 deletion .github/workflows/cxx-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cxx-version: [11, 14, 17, 20]
cxx-version: [14, 17, 20]
steps:
- uses: actions/checkout@v3
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The mathematical functions are a lightweight implementation of the algorithms or

## Requirements

`xsimd` requires a C++11 compliant compiler. The following C++ compilers are supported:
`xsimd` requires a C++14 compliant compiler. The following C++ compilers are supported:

Compiler | Version
------------------------|-------------------------------
Expand Down
17 changes: 8 additions & 9 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
endif()

if(NOT MSVC)
CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_CPP11_FLAG)
if (ENABLE_XTL_COMPLEX)
CHECK_CXX_COMPILER_FLAG("-std=c++14" HAS_CPP14_FLAG)
if (NOT HAS_CPP14_FLAG)
message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++14 support when xtl complex support is enabled")
CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP17_FLAG)
if (NOT HAS_CPP17_FLAG)
message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++17 support when xtl complex support is enabled")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else()
CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_CPP11_FLAG)
if (NOT HAS_CPP11_FLAG)
message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++11 support!")
CHECK_CXX_COMPILER_FLAG("-std=c++14" HAS_CPP14_FLAG)
if (NOT HAS_CPP14_FLAG)
message(FATAL_ERROR "Unsupported compiler -- xsimd requires C++14 support!")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The following SIMD instruction set extensions are supported:
+--------------+---------------------------------------------------------+


`xsimd` requires a C++11 compliant compiler. The following C++ compilers are supported:
`xsimd` requires a C++14 compliant compiler. The following C++ compilers are supported:

+-------------------------+-------------------------------+
| Compiler | Version |
Expand Down
6 changes: 2 additions & 4 deletions examples/pico_bench.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,14 @@ namespace pico_bench
}

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

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

// bitwise_lshift
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value>::type*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
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 /*=typename std::enable_if<std::is_integral<T>::value>::type*/>
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
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 @@ -44,14 +44,14 @@ namespace xsimd
}

// bitwise_rshift
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value>::type*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
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 /*=typename std::enable_if<std::is_integral<T>::value>::type*/>
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
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 All @@ -74,7 +74,7 @@ namespace xsimd
}

// div
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch<T, A> div(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 @@ -169,7 +169,7 @@ namespace xsimd
}

// mul
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value>::type*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
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 @@ -213,7 +213,7 @@ namespace xsimd
{
return add(self, other); // no saturated arithmetic on floating point numbers
}
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value>::type*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
if (std::is_signed<T>::value)
Expand Down Expand Up @@ -241,7 +241,7 @@ namespace xsimd
{
return sub(self, other); // no saturated arithmetic on floating point numbers
}
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value>::type*/>
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
if (std::is_signed<T>::value)
Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/common/xsimd_common_details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace xsimd
template <class T, class A>
XSIMD_INLINE batch<T, A> sqrt(batch<T, A> const& self) noexcept;
template <class T, class A, class Vt, Vt... Values>
XSIMD_INLINE typename std::enable_if<std::is_arithmetic<T>::value, batch<T, A>>::type
XSIMD_INLINE std::enable_if_t<std::is_arithmetic<T>::value, batch<T, A>>
swizzle(batch<T, A> const& x, batch_constant<Vt, A, Values...> mask) noexcept;
template <class T, class A>
XSIMD_INLINE batch<T, A> tan(batch<T, A> const& self) noexcept;
Expand Down
12 changes: 6 additions & 6 deletions include/xsimd/arch/common/xsimd_common_logical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace xsimd
}

// isinf
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch_bool<T, A> isinf(batch<T, A> const&, requires_arch<common>) noexcept
{
return batch_bool<T, A>(false);
Expand All @@ -143,7 +143,7 @@ namespace xsimd
}

// isfinite
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch_bool<T, A> isfinite(batch<T, A> const&, requires_arch<common>) noexcept
{
return batch_bool<T, A>(true);
Expand All @@ -160,14 +160,14 @@ namespace xsimd
}

// isnan
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const&, requires_arch<common>) noexcept
{
return batch_bool<T, A>(false);
}

// le
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return (self < other) || (self == other);
Expand Down Expand Up @@ -220,7 +220,7 @@ namespace xsimd
using is_batch_bool_register_same = std::is_same<typename batch_bool<T, A>::register_type, typename batch<T, A>::register_type>;
}

template <class A, class T, typename std::enable_if<detail::is_batch_bool_register_same<T, A>::value, int>::type = 3>
template <class A, class T, std::enable_if_t<detail::is_batch_bool_register_same<T, A>::value, 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 @@ -230,7 +230,7 @@ namespace xsimd
return batch_bool<T, A> { select(cond, true_v, false_v) };
}

template <class A, class T, typename std::enable_if<!detail::is_batch_bool_register_same<T, A>::value, int>::type = 3>
template <class A, class T, std::enable_if_t<!detail::is_batch_bool_register_same<T, A>::value, 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
26 changes: 13 additions & 13 deletions include/xsimd/arch/common/xsimd_common_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace xsimd
// Inspired by
// https://stackoverflow.com/questions/5697500/take-the-average-of-two-signed-numbers-in-c
auto t = (x & y) + ((x ^ y) >> 1);
auto t_u = bitwise_cast<typename std::make_unsigned<T>::type>(t);
auto t_u = bitwise_cast<std::make_unsigned_t<T>>(t);
auto avg = t + (bitwise_cast<T>(t_u >> (8 * sizeof(T) - 1)) & (x ^ y));
return avg;
}
Expand Down Expand Up @@ -286,7 +286,7 @@ namespace xsimd
}

// copysign
template <class A, class T, class = typename std::enable_if<std::is_floating_point<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
XSIMD_INLINE batch<T, A> copysign(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return abs(self) | bitofsign(other);
Expand Down Expand Up @@ -613,15 +613,15 @@ namespace xsimd
}

template <size_t... Is, class Tuple>
XSIMD_INLINE B eval(::xsimd::detail::index_sequence<Is...>, const Tuple& tuple)
XSIMD_INLINE B eval(std::index_sequence<Is...>, const Tuple& tuple)
{
return estrin { x * x }(std::get<Is>(tuple)...);
}

template <class... Args>
XSIMD_INLINE B eval(const std::tuple<Args...>& tuple) noexcept
{
return eval(::xsimd::detail::make_index_sequence<sizeof...(Args)>(), tuple);
return eval(std::make_index_sequence<sizeof...(Args)>(), tuple);
}

template <class... Args>
Expand Down Expand Up @@ -1877,7 +1877,7 @@ namespace xsimd
}

// mod
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch<T, A> mod(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 @@ -1886,7 +1886,7 @@ namespace xsimd
}

// nearbyint
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch<T, A> nearbyint(batch<T, A> const& self, requires_arch<common>) noexcept
{
return self;
Expand Down Expand Up @@ -1926,7 +1926,7 @@ namespace xsimd
}

// nearbyint_as_int
template <class T, class A, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class T, class A, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch<T, A> nearbyint_as_int(batch<T, A> const& self, requires_arch<common>) noexcept
{
return self;
Expand Down Expand Up @@ -2088,7 +2088,7 @@ namespace xsimd
}

// reciprocal
template <class T, class A, class = typename std::enable_if<std::is_floating_point<T>::value>::type>
template <class T, class A, class = std::enable_if_t<std::is_floating_point<T>::value>>
XSIMD_INLINE batch<T, A> reciprocal(batch<T, A> const& self,
requires_arch<common>) noexcept
{
Expand All @@ -2103,7 +2103,7 @@ namespace xsimd
return { reduce_add(self.real()), reduce_add(self.imag()) };
}

template <class A, class T, class /*=typename std::enable_if<std::is_scalar<T>::value>::type*/>
template <class A, class T, class /*=std::enable_if_t<std::is_scalar<T>::value>*/>
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 @@ -2175,7 +2175,7 @@ namespace xsimd
return res;
}

template <class A, class T, class /*=typename std::enable_if<std::is_scalar<T>::value>::type*/>
template <class A, class T, class /*=std::enable_if_t<std::is_scalar<T>::value>*/>
XSIMD_INLINE T reduce_mul(batch<T, A> const& self, requires_arch<common>) noexcept
{
alignas(A::alignment()) T buffer[batch<T, A>::size];
Expand All @@ -2199,7 +2199,7 @@ namespace xsimd
{
return fnma(nearbyint(self / other), other, self);
}
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch<T, A> remainder(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
auto mod = self % other;
Expand All @@ -2214,7 +2214,7 @@ namespace xsimd
}

// sign
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch<T, A> sign(batch<T, A> const& self, requires_arch<common>) noexcept
{
using batch_type = batch<T, A>;
Expand Down Expand Up @@ -2260,7 +2260,7 @@ namespace xsimd
}

// signnz
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
XSIMD_INLINE batch<T, A> signnz(batch<T, A> const& self, requires_arch<common>) noexcept
{
using batch_type = batch<T, A>;
Expand Down
Loading