diff --git a/CMakeLists.txt b/CMakeLists.txt index 61d880508..872154c3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_fma3_avx.hpp ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_fma3_avx2.hpp ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_fma3_sse.hpp ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_fma4.hpp -${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_generic.hpp +${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_common.hpp ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_isa.hpp ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_neon.hpp ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_neon64.hpp @@ -68,7 +68,7 @@ ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_fma3_avx_register.hpp ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_fma3_avx2_register.hpp ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_fma3_sse_register.hpp ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_fma4_register.hpp -${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_generic_arch.hpp +${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_common_arch.hpp ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_register.hpp ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_rvv_register.hpp ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_sse2_register.hpp diff --git a/docs/Doxyfile b/docs/Doxyfile index b95ae599b..390baf223 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -7,7 +7,7 @@ INPUT = ../include/xsimd/types/xsimd_api.hpp \ ../include/xsimd/config/xsimd_config.hpp \ ../include/xsimd/memory/xsimd_alignment.hpp \ ../include/xsimd/memory/xsimd_aligned_allocator.hpp \ - ../include/xsimd/types/xsimd_generic_arch.hpp \ + ../include/xsimd/types/xsimd_common_arch.hpp \ ../include/xsimd/types/xsimd_traits.hpp \ ../include/xsimd/types/xsimd_avx2_register.hpp \ ../include/xsimd/types/xsimd_avx512bw_register.hpp \ diff --git a/include/xsimd/arch/generic/xsimd_generic_arithmetic.hpp b/include/xsimd/arch/common/xsimd_common_arithmetic.hpp similarity index 84% rename from include/xsimd/arch/generic/xsimd_generic_arithmetic.hpp rename to include/xsimd/arch/common/xsimd_common_arithmetic.hpp index e7916b0d4..dba8c38ca 100644 --- a/include/xsimd/arch/generic/xsimd_generic_arithmetic.hpp +++ b/include/xsimd/arch/common/xsimd_common_arithmetic.hpp @@ -9,14 +9,14 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_ARITHMETIC_HPP -#define XSIMD_GENERIC_ARITHMETIC_HPP +#ifndef XSIMD_COMMON_ARITHMETIC_HPP +#define XSIMD_COMMON_ARITHMETIC_HPP #include #include #include -#include "./xsimd_generic_details.hpp" +#include "./xsimd_common_details.hpp" namespace xsimd { @@ -28,7 +28,7 @@ namespace xsimd // bitwise_lshift template ::value, void>::type*/> - XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept { return x << y; }, @@ -37,7 +37,7 @@ namespace xsimd // bitwise_rshift template ::value, void>::type*/> - XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept { return x >> y; }, @@ -46,21 +46,21 @@ namespace xsimd // decr template - XSIMD_INLINE batch decr(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch decr(batch const& self, requires_arch) noexcept { return self - T(1); } // decr_if template - XSIMD_INLINE batch decr_if(batch const& self, Mask const& mask, requires_arch) noexcept + XSIMD_INLINE batch decr_if(batch const& self, Mask const& mask, requires_arch) noexcept { return select(mask, decr(self), self); } // div template ::value, void>::type> - XSIMD_INLINE batch div(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch div(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T { return x / y; }, @@ -69,13 +69,13 @@ namespace xsimd // fma template - XSIMD_INLINE batch fma(batch const& x, batch const& y, batch const& z, requires_arch) noexcept + XSIMD_INLINE batch fma(batch const& x, batch const& y, batch const& z, requires_arch) noexcept { return x * y + z; } template - XSIMD_INLINE batch, A> fma(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch, A> fma(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept { auto res_r = fms(x.real(), y.real(), fms(x.imag(), y.imag(), z.real())); auto res_i = fma(x.real(), y.imag(), fma(x.imag(), y.real(), z.imag())); @@ -84,13 +84,13 @@ namespace xsimd // fms template - XSIMD_INLINE batch fms(batch const& x, batch const& y, batch const& z, requires_arch) noexcept + XSIMD_INLINE batch fms(batch const& x, batch const& y, batch const& z, requires_arch) noexcept { return x * y - z; } template - XSIMD_INLINE batch, A> fms(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch, A> fms(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept { auto res_r = fms(x.real(), y.real(), fma(x.imag(), y.imag(), z.real())); auto res_i = fma(x.real(), y.imag(), fms(x.imag(), y.real(), z.imag())); @@ -99,13 +99,13 @@ namespace xsimd // fnma template - XSIMD_INLINE batch fnma(batch const& x, batch const& y, batch const& z, requires_arch) noexcept + XSIMD_INLINE batch fnma(batch const& x, batch const& y, batch const& z, requires_arch) noexcept { return -x * y + z; } template - XSIMD_INLINE batch, A> fnma(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch, A> fnma(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept { auto res_r = -fms(x.real(), y.real(), fma(x.imag(), y.imag(), z.real())); auto res_i = -fma(x.real(), y.imag(), fms(x.imag(), y.real(), z.imag())); @@ -114,13 +114,13 @@ namespace xsimd // fnms template - XSIMD_INLINE batch fnms(batch const& x, batch const& y, batch const& z, requires_arch) noexcept + XSIMD_INLINE batch fnms(batch const& x, batch const& y, batch const& z, requires_arch) noexcept { return -x * y - z; } template - XSIMD_INLINE batch, A> fnms(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch, A> fnms(batch, A> const& x, batch, A> const& y, batch, A> const& z, requires_arch) noexcept { auto res_r = -fms(x.real(), y.real(), fms(x.imag(), y.imag(), z.real())); auto res_i = -fma(x.real(), y.imag(), fma(x.imag(), y.real(), z.imag())); @@ -129,7 +129,7 @@ namespace xsimd // hadd template ::value, void>::type*/> - XSIMD_INLINE T hadd(batch const& self, requires_arch) noexcept + XSIMD_INLINE T hadd(batch const& self, requires_arch) noexcept { alignas(A::alignment()) T buffer[batch::size]; self.store_aligned(buffer); @@ -143,21 +143,21 @@ namespace xsimd // incr template - XSIMD_INLINE batch incr(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch incr(batch const& self, requires_arch) noexcept { return self + T(1); } // incr_if template - XSIMD_INLINE batch incr_if(batch const& self, Mask const& mask, requires_arch) noexcept + XSIMD_INLINE batch incr_if(batch const& self, Mask const& mask, requires_arch) noexcept { return select(mask, incr(self), self); } // mul template ::value, void>::type*/> - XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T { return x * y; }, @@ -166,7 +166,7 @@ namespace xsimd // rotl template - XSIMD_INLINE batch rotl(batch const& self, STy other, requires_arch) noexcept + XSIMD_INLINE batch rotl(batch const& self, STy other, requires_arch) noexcept { constexpr auto N = std::numeric_limits::digits; return (self << other) | (self >> (N - other)); @@ -174,7 +174,7 @@ namespace xsimd // rotr template - XSIMD_INLINE batch rotr(batch const& self, STy other, requires_arch) noexcept + XSIMD_INLINE batch rotr(batch const& self, STy other, requires_arch) noexcept { constexpr auto N = std::numeric_limits::digits; return (self >> other) | (self << (N - other)); @@ -182,12 +182,12 @@ namespace xsimd // sadd template - XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { return add(self, other); // no saturated arithmetic on floating point numbers } template ::value, void>::type*/> - XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) { @@ -204,19 +204,19 @@ namespace xsimd } } template - XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept { return add(self, other); // no saturated arithmetic on floating point numbers } // ssub template - XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { return sub(self, other); // no saturated arithmetic on floating point numbers } template ::value, void>::type*/> - XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { if (std::is_signed::value) { @@ -229,7 +229,7 @@ namespace xsimd } } template - XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept { return sub(self, other); // no saturated arithmetic on floating point numbers } diff --git a/include/xsimd/arch/generic/xsimd_generic_complex.hpp b/include/xsimd/arch/common/xsimd_common_complex.hpp similarity index 84% rename from include/xsimd/arch/generic/xsimd_generic_complex.hpp rename to include/xsimd/arch/common/xsimd_common_complex.hpp index 812c592ae..1283aecca 100644 --- a/include/xsimd/arch/generic/xsimd_generic_complex.hpp +++ b/include/xsimd/arch/common/xsimd_common_complex.hpp @@ -9,12 +9,12 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_COMPLEX_HPP -#define XSIMD_GENERIC_COMPLEX_HPP +#ifndef XSIMD_COMMON_COMPLEX_HPP +#define XSIMD_COMMON_COMPLEX_HPP #include -#include "./xsimd_generic_details.hpp" +#include "./xsimd_common_details.hpp" namespace xsimd { @@ -26,54 +26,54 @@ namespace xsimd // real template - XSIMD_INLINE batch real(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch real(batch const& self, requires_arch) noexcept { return self; } template - XSIMD_INLINE batch real(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch real(batch, A> const& self, requires_arch) noexcept { return self.real(); } // imag template - XSIMD_INLINE batch imag(batch const& /*self*/, requires_arch) noexcept + XSIMD_INLINE batch imag(batch const& /*self*/, requires_arch) noexcept { return batch(T(0)); } template - XSIMD_INLINE batch imag(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch imag(batch, A> const& self, requires_arch) noexcept { return self.imag(); } // arg template - XSIMD_INLINE real_batch_type_t> arg(batch const& self, requires_arch) noexcept + XSIMD_INLINE real_batch_type_t> arg(batch const& self, requires_arch) noexcept { return atan2(imag(self), real(self)); } // conj template - XSIMD_INLINE complex_batch_type_t> conj(batch const& self, requires_arch) noexcept + XSIMD_INLINE complex_batch_type_t> conj(batch const& self, requires_arch) noexcept { return { real(self), -imag(self) }; } // norm template - XSIMD_INLINE real_batch_type_t> norm(batch const& self, requires_arch) noexcept + XSIMD_INLINE real_batch_type_t> norm(batch const& self, requires_arch) noexcept { return { fma(real(self), real(self), imag(self) * imag(self)) }; } // proj template - XSIMD_INLINE complex_batch_type_t> proj(batch const& self, requires_arch) noexcept + XSIMD_INLINE complex_batch_type_t> proj(batch const& self, requires_arch) noexcept { using batch_type = complex_batch_type_t>; using real_batch = typename batch_type::real_batch; @@ -86,19 +86,19 @@ namespace xsimd } template - XSIMD_INLINE batch_bool isnan(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool isnan(batch, A> const& self, requires_arch) noexcept { return batch_bool(isnan(self.real()) || isnan(self.imag())); } template - XSIMD_INLINE batch_bool isinf(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool isinf(batch, A> const& self, requires_arch) noexcept { return batch_bool(isinf(self.real()) || isinf(self.imag())); } template - XSIMD_INLINE batch_bool isfinite(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool isfinite(batch, A> const& self, requires_arch) noexcept { return batch_bool(isfinite(self.real()) && isfinite(self.imag())); } diff --git a/include/xsimd/arch/generic/xsimd_generic_details.hpp b/include/xsimd/arch/common/xsimd_common_details.hpp similarity index 92% rename from include/xsimd/arch/generic/xsimd_generic_details.hpp rename to include/xsimd/arch/common/xsimd_common_details.hpp index a9af608c8..0a8abc419 100644 --- a/include/xsimd/arch/generic/xsimd_generic_details.hpp +++ b/include/xsimd/arch/common/xsimd_common_details.hpp @@ -9,13 +9,13 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_DETAILS_HPP -#define XSIMD_GENERIC_DETAILS_HPP +#ifndef XSIMD_COMMON_DETAILS_HPP +#define XSIMD_COMMON_DETAILS_HPP #include #include "../../math/xsimd_rem_pio2.hpp" -#include "../../types/xsimd_generic_arch.hpp" +#include "../../types/xsimd_common_arch.hpp" #include "../../types/xsimd_utils.hpp" #include "../xsimd_constants.hpp" @@ -137,54 +137,54 @@ namespace xsimd } } - // some generic fast_cast conversion + // some common fast_cast conversion namespace detail { template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } template - XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& self, batch const&, requires_arch) noexcept { return bitwise_cast(self); } - // Provide a generic uint32_t -> float cast only if we have a - // non-generic int32_t -> float fast_cast + // Provide a common uint32_t -> float cast only if we have a + // non-common int32_t -> float fast_cast template const&>(), std::declval const&>(), A {}))> - XSIMD_INLINE batch fast_cast(batch const& v, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& v, batch const&, requires_arch) noexcept { // see https://stackoverflow.com/questions/34066228/how-to-perform-uint32-float-conversion-with-sse batch msk_lo(0xFFFF); @@ -198,10 +198,10 @@ namespace xsimd return v_hi_flt + v_lo_flt; /* Rounding may occur here, mul and add may fuse to fma for haswell and newer */ } - // Provide a generic float -> uint32_t cast only if we have a - // non-generic float -> int32_t fast_cast + // Provide a common float -> uint32_t cast only if we have a + // non-common float -> int32_t fast_cast template const&>(), std::declval const&>(), A {}))> - XSIMD_INLINE batch fast_cast(batch const& v, batch const&, requires_arch) noexcept + XSIMD_INLINE batch fast_cast(batch const& v, batch const&, requires_arch) noexcept { auto is_large = v >= batch(1u << 31); auto small_v = bitwise_cast(batch_cast(v)); diff --git a/include/xsimd/arch/generic/xsimd_generic_logical.hpp b/include/xsimd/arch/common/xsimd_common_logical.hpp similarity index 87% rename from include/xsimd/arch/generic/xsimd_generic_logical.hpp rename to include/xsimd/arch/common/xsimd_common_logical.hpp index 4f5dd8e4b..7640c2841 100644 --- a/include/xsimd/arch/generic/xsimd_generic_logical.hpp +++ b/include/xsimd/arch/common/xsimd_common_logical.hpp @@ -9,10 +9,10 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_LOGICAL_HPP -#define XSIMD_GENERIC_LOGICAL_HPP +#ifndef XSIMD_COMMON_LOGICAL_HPP +#define XSIMD_COMMON_LOGICAL_HPP -#include "./xsimd_generic_details.hpp" +#include "./xsimd_common_details.hpp" #include @@ -26,7 +26,7 @@ namespace xsimd // count template - XSIMD_INLINE size_t count(batch_bool const& self, requires_arch) noexcept + XSIMD_INLINE size_t count(batch_bool const& self, requires_arch) noexcept { uint64_t m = self.mask(); XSIMD_IF_CONSTEXPR(batch_bool::size < 14) @@ -69,7 +69,7 @@ namespace xsimd // from mask template - XSIMD_INLINE batch_bool from_mask(batch_bool const&, uint64_t mask, requires_arch) noexcept + XSIMD_INLINE batch_bool from_mask(batch_bool const&, uint64_t mask, requires_arch) noexcept { alignas(A::alignment()) bool buffer[batch_bool::size]; // This is inefficient but should never be called. It's just a @@ -81,28 +81,28 @@ namespace xsimd // ge template - XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch_bool ge(batch const& self, batch const& other, requires_arch) noexcept { return other <= self; } // gt template - XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept { return other < self; } // is_even template - XSIMD_INLINE batch_bool is_even(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool is_even(batch const& self, requires_arch) noexcept { return is_flint(self * T(0.5)); } // is_flint template - XSIMD_INLINE batch_bool is_flint(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool is_flint(batch const& self, requires_arch) noexcept { auto frac = select(isnan(self - self), constants::nan>(), self - trunc(self)); return frac == T(0.); @@ -110,69 +110,69 @@ namespace xsimd // is_odd template - XSIMD_INLINE batch_bool is_odd(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool is_odd(batch const& self, requires_arch) noexcept { return is_even(self - T(1.)); } // isinf template ::value, void>::type> - XSIMD_INLINE batch_bool isinf(batch const&, requires_arch) noexcept + XSIMD_INLINE batch_bool isinf(batch const&, requires_arch) noexcept { return batch_bool(false); } template - XSIMD_INLINE batch_bool isinf(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool isinf(batch const& self, requires_arch) noexcept { return abs(self) == std::numeric_limits::infinity(); } template - XSIMD_INLINE batch_bool isinf(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool isinf(batch const& self, requires_arch) noexcept { return abs(self) == std::numeric_limits::infinity(); } // isfinite template ::value, void>::type> - XSIMD_INLINE batch_bool isfinite(batch const&, requires_arch) noexcept + XSIMD_INLINE batch_bool isfinite(batch const&, requires_arch) noexcept { return batch_bool(true); } template - XSIMD_INLINE batch_bool isfinite(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool isfinite(batch const& self, requires_arch) noexcept { return (self - self) == 0.f; } template - XSIMD_INLINE batch_bool isfinite(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch_bool isfinite(batch const& self, requires_arch) noexcept { return (self - self) == 0.; } // isnan template ::value, void>::type> - XSIMD_INLINE batch_bool isnan(batch const&, requires_arch) noexcept + XSIMD_INLINE batch_bool isnan(batch const&, requires_arch) noexcept { return batch_bool(false); } // le template ::value, void>::type> - XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch_bool le(batch const& self, batch const& other, requires_arch) noexcept { return (self < other) || (self == other); } // neq template - XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept { return !(other == self); } // logical_and template - XSIMD_INLINE batch logical_and(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch logical_and(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept { return x && y; }, @@ -181,7 +181,7 @@ namespace xsimd // logical_or template - XSIMD_INLINE batch logical_or(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch logical_or(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept { return x || y; }, @@ -190,7 +190,7 @@ namespace xsimd // mask template - XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept + XSIMD_INLINE uint64_t mask(batch_bool const& self, requires_arch) noexcept { alignas(A::alignment()) bool buffer[batch_bool::size]; self.store_aligned(buffer); diff --git a/include/xsimd/arch/generic/xsimd_generic_math.hpp b/include/xsimd/arch/common/xsimd_common_math.hpp similarity index 96% rename from include/xsimd/arch/generic/xsimd_generic_math.hpp rename to include/xsimd/arch/common/xsimd_common_math.hpp index 4dc9c3878..71dc75787 100644 --- a/include/xsimd/arch/generic/xsimd_generic_math.hpp +++ b/include/xsimd/arch/common/xsimd_common_math.hpp @@ -9,12 +9,12 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_MATH_HPP -#define XSIMD_GENERIC_MATH_HPP +#ifndef XSIMD_COMMON_MATH_HPP +#define XSIMD_COMMON_MATH_HPP #include "../xsimd_scalar.hpp" -#include "./xsimd_generic_details.hpp" -#include "./xsimd_generic_trigo.hpp" +#include "./xsimd_common_details.hpp" +#include "./xsimd_common_trigo.hpp" #include @@ -27,7 +27,7 @@ namespace xsimd using namespace types; // abs template - XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept { if (std::is_unsigned::value) return self; @@ -40,7 +40,7 @@ namespace xsimd } template - XSIMD_INLINE batch abs(batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch abs(batch, A> const& z, requires_arch) noexcept { return hypot(z.real(), z.imag()); } @@ -73,7 +73,7 @@ namespace xsimd } template - XSIMD_INLINE batch avg(batch const& x, batch const& y, requires_arch) noexcept + XSIMD_INLINE batch avg(batch const& x, batch const& y, requires_arch) noexcept { return detail::avg(x, y, typename std::is_integral::type {}, typename std::is_signed::type {}); } @@ -97,14 +97,14 @@ namespace xsimd } template - XSIMD_INLINE batch avgr(batch const& x, batch const& y, requires_arch) noexcept + XSIMD_INLINE batch avgr(batch const& x, batch const& y, requires_arch) noexcept { return detail::avgr(x, y, typename std::is_integral::type {}); } // batch_cast template - XSIMD_INLINE batch batch_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch batch_cast(batch const& self, batch const&, requires_arch) noexcept { return self; } @@ -112,12 +112,12 @@ namespace xsimd namespace detail { template - XSIMD_INLINE batch batch_cast(batch const& self, batch const& out, requires_arch, with_fast_conversion) noexcept + XSIMD_INLINE batch batch_cast(batch const& self, batch const& out, requires_arch, with_fast_conversion) noexcept { return fast_cast(self, out, A {}); } template - XSIMD_INLINE batch batch_cast(batch const& self, batch const&, requires_arch, with_slow_conversion) noexcept + 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"); using batch_type_in = batch; @@ -133,14 +133,14 @@ namespace xsimd } template - XSIMD_INLINE batch batch_cast(batch const& self, batch const& out, requires_arch) noexcept + XSIMD_INLINE batch batch_cast(batch const& self, batch const& out, requires_arch) noexcept { return detail::batch_cast(self, out, A {}, detail::conversion_type {}); } // bitofsign template - XSIMD_INLINE batch bitofsign(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch bitofsign(batch const& self, requires_arch) noexcept { static_assert(std::is_integral::value, "int type implementation"); if (std::is_unsigned::value) @@ -150,19 +150,19 @@ namespace xsimd } template - XSIMD_INLINE batch bitofsign(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch bitofsign(batch const& self, requires_arch) noexcept { return self & constants::signmask>(); } template - XSIMD_INLINE batch bitofsign(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch bitofsign(batch const& self, requires_arch) noexcept { return self & constants::signmask>(); } // bitwise_cast template - XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept + XSIMD_INLINE batch bitwise_cast(batch const& self, batch const&, requires_arch) noexcept { return self; } @@ -178,7 +178,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch cbrt(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch cbrt(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type z = abs(self); @@ -225,7 +225,7 @@ namespace xsimd } template - XSIMD_INLINE batch cbrt(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch cbrt(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type z = abs(self); @@ -274,14 +274,14 @@ namespace xsimd // clip template - XSIMD_INLINE batch clip(batch const& self, batch const& lo, batch const& hi, requires_arch) noexcept + XSIMD_INLINE batch clip(batch const& self, batch const& lo, batch const& hi, requires_arch) noexcept { return min(hi, max(self, lo)); } // copysign template ::value, void>::type> - XSIMD_INLINE batch copysign(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch copysign(batch const& self, batch const& other, requires_arch) noexcept { return abs(self) | bitofsign(other); } @@ -290,7 +290,7 @@ namespace xsimd namespace detail { - /* origin: boost/simd/arch/common/detail/generic/erf_kernel.hpp */ + /* origin: boost/simd/arch/common/detail/common/erf_kernel.hpp */ /* * ==================================================== * copyright 2016 NumScale SAS @@ -461,7 +461,7 @@ namespace xsimd */ template - XSIMD_INLINE batch erf(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch erf(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -485,7 +485,7 @@ namespace xsimd } template - XSIMD_INLINE batch erf(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch erf(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -521,7 +521,7 @@ namespace xsimd // erfc template - XSIMD_INLINE batch erfc(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch erfc(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -546,7 +546,7 @@ namespace xsimd } template - XSIMD_INLINE batch erfc(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch erfc(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -910,13 +910,13 @@ namespace xsimd } template - XSIMD_INLINE batch exp(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch exp(batch const& self, requires_arch) noexcept { return detail::exp(self); } template - XSIMD_INLINE batch, A> exp(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch, A> exp(batch, A> const& self, requires_arch) noexcept { using batch_type = batch, A>; auto isincos = sincos(self.imag()); @@ -925,14 +925,14 @@ namespace xsimd // exp10 template - XSIMD_INLINE batch exp10(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch exp10(batch const& self, requires_arch) noexcept { return detail::exp(self); } // exp2 template - XSIMD_INLINE batch exp2(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch exp2(batch const& self, requires_arch) noexcept { return detail::exp(self); } @@ -940,7 +940,7 @@ namespace xsimd // expm1 namespace detail { - /* origin: boost/simd/arch/common/detail/generic/expm1_kernel.hpp */ + /* origin: boost/simd/arch/common/detail/common/expm1_kernel.hpp */ /* * ==================================================== * copyright 2016 NumScale SAS @@ -1005,7 +1005,7 @@ namespace xsimd } template - XSIMD_INLINE batch expm1(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch expm1(batch const& self, requires_arch) noexcept { using batch_type = batch; return select(self < constants::logeps(), @@ -1016,7 +1016,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> expm1(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> expm1(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -1029,7 +1029,7 @@ namespace xsimd // polar template - XSIMD_INLINE batch, A> polar(const batch& r, const batch& theta, requires_arch) noexcept + XSIMD_INLINE batch, A> polar(const batch& r, const batch& theta, requires_arch) noexcept { auto sincosTheta = sincos(theta); return { r * sincosTheta.second, r * sincosTheta.first }; @@ -1037,14 +1037,14 @@ namespace xsimd // fdim template - XSIMD_INLINE batch fdim(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch fdim(batch const& self, batch const& other, requires_arch) noexcept { return fmax(batch(0), self - other); } // fmod template - XSIMD_INLINE batch fmod(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch fmod(batch const& self, batch const& other, requires_arch) noexcept { return fnma(trunc(self / other), other, self); } @@ -1060,7 +1060,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch frexp(const batch& self, batch, A>& exp, requires_arch) noexcept + XSIMD_INLINE batch frexp(const batch& self, batch, A>& exp, requires_arch) noexcept { using batch_type = batch; using int_type = as_integer_t; @@ -1075,7 +1075,7 @@ namespace xsimd // from bool template - XSIMD_INLINE batch from_bool(batch_bool const& self, requires_arch) noexcept + XSIMD_INLINE batch from_bool(batch_bool const& self, requires_arch) noexcept { return batch(self.data) & batch(1); } @@ -1089,14 +1089,14 @@ namespace xsimd // hypot template - XSIMD_INLINE batch hypot(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch hypot(batch const& self, batch const& other, requires_arch) noexcept { return sqrt(fma(self, self, other * other)); } // ipow template - XSIMD_INLINE batch ipow(batch const& self, ITy other, requires_arch) noexcept + XSIMD_INLINE batch ipow(batch const& self, ITy other, requires_arch) noexcept { return ::xsimd::detail::ipow(self, other); } @@ -1112,7 +1112,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch ldexp(const batch& self, const batch, A>& other, requires_arch) noexcept + XSIMD_INLINE batch ldexp(const batch& self, const batch, A>& other, requires_arch) noexcept { using batch_type = batch; using itype = as_integer_t; @@ -1123,11 +1123,11 @@ namespace xsimd // lgamma template - XSIMD_INLINE batch lgamma(batch const& self, requires_arch) noexcept; + XSIMD_INLINE batch lgamma(batch const& self, requires_arch) noexcept; namespace detail { - /* origin: boost/simd/arch/common/detail/generic/gammaln_kernel.hpp */ + /* origin: boost/simd/arch/common/detail/common/gammaln_kernel.hpp */ /* * ==================================================== * copyright 2016 NumScale SAS @@ -1426,7 +1426,7 @@ namespace xsimd } template - XSIMD_INLINE batch lgamma(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch lgamma(batch const& self, requires_arch) noexcept { return detail::lgamma_impl>::compute(self); } @@ -1442,7 +1442,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch log(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log(batch const& self, requires_arch) noexcept { using batch_type = batch; using int_type = as_integer_t; @@ -1482,7 +1482,7 @@ namespace xsimd } template - XSIMD_INLINE batch log(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log(batch const& self, requires_arch) noexcept { using batch_type = batch; using int_type = as_integer_t; @@ -1525,14 +1525,14 @@ namespace xsimd } template - XSIMD_INLINE batch, A> log(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> log(const batch, A>& z, requires_arch) noexcept { return batch, A>(log(abs(z)), atan2(z.imag(), z.real())); } // log2 template - XSIMD_INLINE batch log2(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log2(batch const& self, requires_arch) noexcept { using batch_type = batch; using int_type = as_integer_t; @@ -1572,7 +1572,7 @@ namespace xsimd } template - XSIMD_INLINE batch log2(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log2(batch const& self, requires_arch) noexcept { using batch_type = batch; using int_type = as_integer_t; @@ -1631,7 +1631,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> log2(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch, A> log2(batch, A> const& self, requires_arch) noexcept { return detail::logN_complex_impl(self, std::log(2)); } @@ -1649,7 +1649,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch log10(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log10(batch const& self, requires_arch) noexcept { using batch_type = batch; const batch_type @@ -1700,7 +1700,7 @@ namespace xsimd } template - XSIMD_INLINE batch log10(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log10(batch const& self, requires_arch) noexcept { using batch_type = batch; const batch_type @@ -1754,7 +1754,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> log10(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> log10(const batch, A>& z, requires_arch) noexcept { return detail::logN_complex_impl(z, std::log(10)); } @@ -1770,7 +1770,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch log1p(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log1p(batch const& self, requires_arch) noexcept { using batch_type = batch; using int_type = as_integer_t; @@ -1802,7 +1802,7 @@ namespace xsimd } template - XSIMD_INLINE batch log1p(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch log1p(batch const& self, requires_arch) noexcept { using batch_type = batch; using int_type = as_integer_t; @@ -1835,7 +1835,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> log1p(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch, A> log1p(batch, A> const& self, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -1850,7 +1850,7 @@ namespace xsimd // mod template ::value, void>::type> - XSIMD_INLINE batch mod(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch mod(batch const& self, batch const& other, requires_arch) noexcept { return detail::apply([](T x, T y) noexcept -> T { return x % y; }, @@ -1859,7 +1859,7 @@ namespace xsimd // nearbyint template ::value, void>::type> - XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept { return self; } @@ -1886,19 +1886,19 @@ namespace xsimd } } template - XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept { return detail::nearbyintf(self); } template - XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch nearbyint(batch const& self, requires_arch) noexcept { return detail::nearbyintf(self); } // nearbyint_as_int template ::value, void>::type> - XSIMD_INLINE batch nearbyint_as_int(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch nearbyint_as_int(batch const& self, requires_arch) noexcept { return self; } @@ -1906,7 +1906,7 @@ namespace xsimd // nearbyint_as_int template XSIMD_INLINE batch, A> - nearbyint_as_int(batch const& self, requires_arch) noexcept + nearbyint_as_int(batch const& self, requires_arch) noexcept { using U = as_integer_t; return kernel::detail::apply_transform([](float x) noexcept -> U @@ -1916,7 +1916,7 @@ namespace xsimd template XSIMD_INLINE batch, A> - nearbyint_as_int(batch const& self, requires_arch) noexcept + nearbyint_as_int(batch const& self, requires_arch) noexcept { using U = as_integer_t; return kernel::detail::apply_transform([](double x) noexcept -> U @@ -1979,7 +1979,7 @@ namespace xsimd }; } template - XSIMD_INLINE batch nextafter(batch const& from, batch const& to, requires_arch) noexcept + XSIMD_INLINE batch nextafter(batch const& from, batch const& to, requires_arch) noexcept { using kernel = detail::nextafter_kernel; return select(from == to, from, @@ -1997,7 +1997,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch pow(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch pow(batch const& self, batch const& other, requires_arch) noexcept { using batch_type = batch; const auto zero = batch_type(0.); @@ -2012,7 +2012,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> pow(const batch, A>& a, const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> pow(const batch, A>& a, const batch, A>& z, requires_arch) noexcept { using cplx_batch = batch, A>; using real_batch = typename cplx_batch::real_batch; @@ -2031,7 +2031,7 @@ namespace xsimd } template - inline batch, A> pow(const batch, A>& a, const batch& z, requires_arch) noexcept + inline batch, A> pow(const batch, A>& a, const batch& z, requires_arch) noexcept { using cplx_batch = batch, A>; @@ -2045,7 +2045,7 @@ namespace xsimd } template - inline batch, A> pow(const batch& a, const batch, A>& z, requires_arch) noexcept + inline batch, A> pow(const batch& a, const batch, A>& z, requires_arch) noexcept { return pow(batch, A> { a, batch {} }, z); } @@ -2053,7 +2053,7 @@ namespace xsimd // reciprocal template ::value, void>::type> XSIMD_INLINE batch reciprocal(batch const& self, - requires_arch) noexcept + requires_arch) noexcept { using batch_type = batch; return div(batch_type(1), self); @@ -2061,7 +2061,7 @@ namespace xsimd // reduce_add template - XSIMD_INLINE std::complex reduce_add(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE std::complex reduce_add(batch, A> const& self, requires_arch) noexcept { return { reduce_add(self.real()), reduce_add(self.imag()) }; } @@ -2094,7 +2094,7 @@ namespace xsimd // reduce_max template - XSIMD_INLINE T reduce_max(batch const& self, requires_arch) noexcept + XSIMD_INLINE T reduce_max(batch const& self, requires_arch) noexcept { return detail::reduce([](batch const& x, batch const& y) { return max(x, y); }, @@ -2103,7 +2103,7 @@ namespace xsimd // reduce_min template - XSIMD_INLINE T reduce_min(batch const& self, requires_arch) noexcept + XSIMD_INLINE T reduce_min(batch const& self, requires_arch) noexcept { return detail::reduce([](batch const& x, batch const& y) { return min(x, y); }, @@ -2112,17 +2112,17 @@ namespace xsimd // remainder template - XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept { return fnma(nearbyint(self / other), other, self); } template - XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept { return fnma(nearbyint(self / other), other, self); } template ::value, void>::type> - XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch remainder(batch const& self, batch const& other, requires_arch) noexcept { auto mod = self % other; return select(mod <= other / 2, mod, mod - other); @@ -2130,14 +2130,14 @@ namespace xsimd // select template - XSIMD_INLINE batch, A> select(batch_bool const& cond, batch, A> const& true_br, batch, A> const& false_br, requires_arch) noexcept + XSIMD_INLINE batch, A> select(batch_bool const& cond, batch, A> const& true_br, batch, A> const& false_br, requires_arch) noexcept { return { select(cond, true_br.real(), false_br.real()), select(cond, true_br.imag(), false_br.imag()) }; } // sign template ::value, void>::type> - XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type res = select(self > batch_type(0), batch_type(1), batch_type(0)) - select(self < batch_type(0), batch_type(1), batch_type(0)); @@ -2160,17 +2160,17 @@ namespace xsimd } template - XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept { return detail::signf(self); } template - XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch sign(batch const& self, requires_arch) noexcept { return detail::signf(self); } template - XSIMD_INLINE batch, A> sign(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> sign(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -2183,7 +2183,7 @@ namespace xsimd // signnz template ::value, void>::type> - XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept { using batch_type = batch; return (self >> (sizeof(T) * 8 - 1)) | batch_type(1.); @@ -2204,19 +2204,19 @@ namespace xsimd } template - XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept { return detail::signnzf(self); } template - XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch signnz(batch const& self, requires_arch) noexcept { return detail::signnzf(self); } // sqrt template - XSIMD_INLINE batch, A> sqrt(batch, A> const& z, requires_arch) noexcept + 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; @@ -2255,7 +2255,7 @@ namespace xsimd namespace detail { - /* origin: boost/simd/arch/common/detail/generic/stirling_kernel.hpp */ + /* origin: boost/simd/arch/common/detail/common/stirling_kernel.hpp */ /* * ==================================================== * copyright 2016 NumScale SAS @@ -2349,7 +2349,7 @@ namespace xsimd return select(x > stirlinglargelim, constants::infinity(), y); } - /* origin: boost/simd/arch/common/detail/generic/gamma_kernel.hpp */ + /* origin: boost/simd/arch/common/detail/common/gamma_kernel.hpp */ /* * ==================================================== * copyright 2016 NumScale SAS @@ -2471,7 +2471,7 @@ namespace xsimd } template - XSIMD_INLINE batch tgamma(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch tgamma(batch const& self, requires_arch) noexcept { using batch_type = batch; auto nan_result = (self < batch_type(0.) && is_flint(self)); diff --git a/include/xsimd/arch/generic/xsimd_generic_memory.hpp b/include/xsimd/arch/common/xsimd_common_memory.hpp similarity index 92% rename from include/xsimd/arch/generic/xsimd_generic_memory.hpp rename to include/xsimd/arch/common/xsimd_common_memory.hpp index af884c185..812ad0bca 100644 --- a/include/xsimd/arch/generic/xsimd_generic_memory.hpp +++ b/include/xsimd/arch/common/xsimd_common_memory.hpp @@ -9,15 +9,15 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_MEMORY_HPP -#define XSIMD_GENERIC_MEMORY_HPP +#ifndef XSIMD_COMMON_MEMORY_HPP +#define XSIMD_COMMON_MEMORY_HPP #include #include #include #include "../../types/xsimd_batch_constant.hpp" -#include "./xsimd_generic_details.hpp" +#include "./xsimd_common_details.hpp" namespace xsimd { @@ -77,7 +77,7 @@ namespace xsimd template XSIMD_INLINE batch compress(batch const& x, batch_bool const& mask, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { using IT = as_unsigned_integer_t; constexpr std::size_t size = batch_bool::size; @@ -103,7 +103,7 @@ namespace xsimd template XSIMD_INLINE batch expand(batch const& x, batch_bool const& mask, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { constexpr std::size_t size = batch_bool::size; auto bitmask = mask.mask(); @@ -114,7 +114,7 @@ namespace xsimd // extract_pair template - XSIMD_INLINE batch extract_pair(batch const& self, batch const& other, std::size_t i, requires_arch) noexcept + XSIMD_INLINE batch extract_pair(batch const& self, batch const& other, std::size_t i, requires_arch) noexcept { constexpr std::size_t size = batch::size; assert(i < size && "index in bounds"); @@ -163,7 +163,7 @@ namespace xsimd template XSIMD_INLINE batch gather(batch const&, T const* src, batch const& index, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { static_assert(batch::size == batch::size, "Index and destination sizes must match"); @@ -175,7 +175,7 @@ namespace xsimd template XSIMD_INLINE detail::sizes_mismatch_t> gather(batch const&, U const* src, batch const& index, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { static_assert(batch::size == batch::size, "Index and destination sizes must match"); @@ -187,7 +187,7 @@ namespace xsimd template XSIMD_INLINE detail::stride_match_t> gather(batch const&, U const* src, batch const& index, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { static_assert(batch::size == batch::size, "Index and destination sizes must match"); @@ -197,7 +197,7 @@ namespace xsimd // insert template - XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept + XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept { struct index_mask { @@ -212,7 +212,7 @@ namespace xsimd // get template - XSIMD_INLINE T get(batch const& self, ::xsimd::index, requires_arch) noexcept + XSIMD_INLINE T get(batch const& self, ::xsimd::index, requires_arch) noexcept { alignas(A::alignment()) T buffer[batch::size]; self.store_aligned(&buffer[0]); @@ -220,7 +220,7 @@ namespace xsimd } template - XSIMD_INLINE T get(batch_bool const& self, ::xsimd::index, requires_arch) noexcept + XSIMD_INLINE T get(batch_bool const& self, ::xsimd::index, requires_arch) noexcept { alignas(A::alignment()) T buffer[batch_bool::size]; self.store_aligned(&buffer[0]); @@ -228,7 +228,7 @@ namespace xsimd } template - XSIMD_INLINE auto get(batch, A> const& self, ::xsimd::index, requires_arch) noexcept -> typename batch, A>::value_type + XSIMD_INLINE auto get(batch, A> const& self, ::xsimd::index, requires_arch) noexcept -> typename batch, A>::value_type { alignas(A::alignment()) T buffer[batch, A>::size]; self.store_aligned(&buffer[0]); @@ -236,7 +236,7 @@ namespace xsimd } template - XSIMD_INLINE T get(batch const& self, std::size_t i, requires_arch) noexcept + XSIMD_INLINE T get(batch const& self, std::size_t i, requires_arch) noexcept { alignas(A::alignment()) T buffer[batch::size]; self.store_aligned(&buffer[0]); @@ -244,7 +244,7 @@ namespace xsimd } template - XSIMD_INLINE T get(batch_bool const& self, std::size_t i, requires_arch) noexcept + XSIMD_INLINE T get(batch_bool const& self, std::size_t i, requires_arch) noexcept { alignas(A::alignment()) bool buffer[batch_bool::size]; self.store_aligned(&buffer[0]); @@ -252,7 +252,7 @@ namespace xsimd } template - XSIMD_INLINE auto get(batch, A> const& self, std::size_t i, requires_arch) noexcept -> typename batch, A>::value_type + XSIMD_INLINE auto get(batch, A> const& self, std::size_t i, requires_arch) noexcept -> typename batch, A>::value_type { using T2 = typename batch, A>::value_type; alignas(A::alignment()) T2 buffer[batch, A>::size]; @@ -262,7 +262,7 @@ namespace xsimd // load template - XSIMD_INLINE batch_bool load_unaligned(bool const* mem, batch_bool, requires_arch) noexcept + XSIMD_INLINE batch_bool load_unaligned(bool const* mem, batch_bool, requires_arch) noexcept { using batch_type = batch; batch_type ref(0); @@ -274,7 +274,7 @@ namespace xsimd } template - XSIMD_INLINE batch_bool load_aligned(bool const* mem, batch_bool b, requires_arch) noexcept + XSIMD_INLINE batch_bool load_aligned(bool const* mem, batch_bool b, requires_arch) noexcept { return load_unaligned(mem, b, A {}); } @@ -283,14 +283,14 @@ namespace xsimd namespace detail { template - XSIMD_INLINE batch load_aligned(T_in const* mem, convert, requires_arch, with_fast_conversion) noexcept + XSIMD_INLINE batch load_aligned(T_in const* mem, convert, requires_arch, with_fast_conversion) noexcept { using batch_type_in = batch; using batch_type_out = batch; return fast_cast(batch_type_in::load_aligned(mem), batch_type_out(), A {}); } template - XSIMD_INLINE batch load_aligned(T_in const* mem, convert, requires_arch, with_slow_conversion) noexcept + 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"); using batch_type_out = batch; @@ -300,7 +300,7 @@ namespace xsimd } } template - XSIMD_INLINE batch load_aligned(T_in const* mem, convert cvt, requires_arch) noexcept + XSIMD_INLINE batch load_aligned(T_in const* mem, convert cvt, requires_arch) noexcept { return detail::load_aligned(mem, cvt, A {}, detail::conversion_type {}); } @@ -309,7 +309,7 @@ namespace xsimd namespace detail { template - XSIMD_INLINE batch load_unaligned(T_in const* mem, convert, requires_arch, with_fast_conversion) noexcept + XSIMD_INLINE batch load_unaligned(T_in const* mem, convert, requires_arch, with_fast_conversion) noexcept { using batch_type_in = batch; using batch_type_out = batch; @@ -317,21 +317,21 @@ namespace xsimd } template - XSIMD_INLINE batch load_unaligned(T_in const* mem, convert cvt, requires_arch, with_slow_conversion) noexcept + 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"); - return load_aligned(mem, cvt, generic {}, with_slow_conversion {}); + return load_aligned(mem, cvt, common {}, with_slow_conversion {}); } } template - XSIMD_INLINE batch load_unaligned(T_in const* mem, convert cvt, requires_arch) noexcept + XSIMD_INLINE batch load_unaligned(T_in const* mem, convert cvt, requires_arch) noexcept { - return detail::load_unaligned(mem, cvt, generic {}, detail::conversion_type {}); + return detail::load_unaligned(mem, cvt, common {}, detail::conversion_type {}); } // rotate_right template - XSIMD_INLINE batch rotate_right(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch rotate_right(batch const& self, requires_arch) noexcept { struct rotate_generator { @@ -345,14 +345,14 @@ namespace xsimd } template - XSIMD_INLINE batch, A> rotate_right(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch, A> rotate_right(batch, A> const& self, requires_arch) noexcept { return { rotate_right(self.real()), rotate_right(self.imag()) }; } // rotate_left template - XSIMD_INLINE batch rotate_left(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch rotate_left(batch const& self, requires_arch) noexcept { struct rotate_generator { @@ -366,7 +366,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> rotate_left(batch, A> const& self, requires_arch) noexcept + XSIMD_INLINE batch, A> rotate_left(batch, A> const& self, requires_arch) noexcept { return { rotate_left(self.real()), rotate_left(self.imag()) }; } @@ -399,7 +399,7 @@ namespace xsimd XSIMD_INLINE void scatter(batch const& src, T* dst, batch const& index, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { static_assert(batch::size == batch::size, "Source and index sizes must match"); @@ -411,7 +411,7 @@ namespace xsimd XSIMD_INLINE detail::sizes_mismatch_t scatter(batch const& src, U* dst, batch const& index, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { static_assert(batch::size == batch::size, "Source and index sizes must match"); @@ -423,7 +423,7 @@ namespace xsimd XSIMD_INLINE detail::stride_match_t scatter(batch const& src, U* dst, batch const& index, - kernel::requires_arch) noexcept + kernel::requires_arch) noexcept { static_assert(batch::size == batch::size, "Source and index sizes must match"); @@ -501,7 +501,7 @@ namespace xsimd } template - XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept + XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept { constexpr size_t bsize = sizeof...(Indices); static_assert(bsize == batch::size, "valid shuffle"); @@ -549,7 +549,7 @@ namespace xsimd // typedef ITy integer_vector_type __attribute__((vector_size(sizeof(batch)))); // return __builtin_shuffle(x.data, y.data, integer_vector_type{Indices...}); #else - // Use a generic_pattern. It is suboptimal but clang optimizes this + // Use a common_pattern. It is suboptimal but clang optimizes this // pretty well. batch x_lane = swizzle(x, batch_constant= bsize) ? (Indices - bsize) : Indices)...>()); batch y_lane = swizzle(y, batch_constant= bsize) ? (Indices - bsize) : Indices)...>()); @@ -560,7 +560,7 @@ namespace xsimd // store template - XSIMD_INLINE void store(batch_bool const& self, bool* mem, requires_arch) noexcept + XSIMD_INLINE void store(batch_bool const& self, bool* mem, requires_arch) noexcept { using batch_type = batch; constexpr auto size = batch_bool::size; @@ -572,7 +572,7 @@ namespace xsimd // store_aligned template - XSIMD_INLINE void store_aligned(T_out* mem, batch const& self, requires_arch) noexcept + 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"); alignas(A::alignment()) T_in buffer[batch::size]; @@ -582,21 +582,21 @@ namespace xsimd // store_unaligned template - XSIMD_INLINE void store_unaligned(T_out* mem, batch const& self, requires_arch) noexcept + 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"); - return store_aligned(mem, self, generic {}); + return store_aligned(mem, self, common {}); } // swizzle template - XSIMD_INLINE batch, A> swizzle(batch, A> const& self, batch_constant mask, requires_arch) noexcept + XSIMD_INLINE batch, A> swizzle(batch, A> const& self, batch_constant mask, requires_arch) noexcept { return { swizzle(self.real(), mask), swizzle(self.imag(), mask) }; } template - XSIMD_INLINE batch swizzle(batch const& self, batch mask, requires_arch) noexcept + XSIMD_INLINE batch swizzle(batch const& self, batch mask, requires_arch) noexcept { constexpr size_t size = batch::size; alignas(A::alignment()) T self_buffer[size]; @@ -612,7 +612,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> swizzle(batch, A> const& self, batch mask, requires_arch) noexcept + XSIMD_INLINE batch, A> swizzle(batch, A> const& self, batch mask, requires_arch) noexcept { return { swizzle(self.real(), mask), swizzle(self.imag(), mask) }; } @@ -621,26 +621,26 @@ namespace xsimd namespace detail { template - XSIMD_INLINE batch, A> load_complex(batch const& /*hi*/, batch const& /*lo*/, requires_arch) noexcept + 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"); } template - XSIMD_INLINE batch complex_high(batch, A> const& /*src*/, requires_arch) noexcept + 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"); } template - XSIMD_INLINE batch complex_low(batch, A> const& /*src*/, requires_arch) noexcept + 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"); } } template - XSIMD_INLINE batch, A> load_complex_aligned(std::complex const* mem, convert>, requires_arch) noexcept + XSIMD_INLINE batch, A> load_complex_aligned(std::complex const* mem, convert>, requires_arch) noexcept { using real_batch = batch; T_in const* buffer = reinterpret_cast(mem); @@ -651,7 +651,7 @@ namespace xsimd // load_complex_unaligned template - XSIMD_INLINE batch, A> load_complex_unaligned(std::complex const* mem, convert>, requires_arch) noexcept + XSIMD_INLINE batch, A> load_complex_unaligned(std::complex const* mem, convert>, requires_arch) noexcept { using real_batch = batch; T_in const* buffer = reinterpret_cast(mem); @@ -662,7 +662,7 @@ namespace xsimd // store_complex_aligned template - XSIMD_INLINE void store_complex_aligned(std::complex* dst, batch, A> const& src, requires_arch) noexcept + XSIMD_INLINE void store_complex_aligned(std::complex* dst, batch, A> const& src, requires_arch) noexcept { using real_batch = batch; real_batch hi = detail::complex_high(src, A {}); @@ -674,7 +674,7 @@ namespace xsimd // store_complex_unaligned template - XSIMD_INLINE void store_complex_unaligned(std::complex* dst, batch, A> const& src, requires_arch) noexcept + XSIMD_INLINE void store_complex_unaligned(std::complex* dst, batch, A> const& src, requires_arch) noexcept { using real_batch = batch; real_batch hi = detail::complex_high(src, A {}); @@ -686,7 +686,7 @@ namespace xsimd // transpose template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept { assert((matrix_end - matrix_begin == batch::size) && "correctly sized matrix"); (void)matrix_end; @@ -712,7 +712,7 @@ namespace xsimd // transpose template ::size == 8, void>::type> - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept { assert((matrix_end - matrix_begin == batch::size) && "correctly sized matrix"); (void)matrix_end; @@ -750,13 +750,13 @@ namespace xsimd } template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept { transpose(reinterpret_cast*>(matrix_begin), reinterpret_cast*>(matrix_end), A {}); } template ::size == 16, void>::type> - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept { assert((matrix_end - matrix_begin == batch::size) && "correctly sized matrix"); (void)matrix_end; @@ -840,7 +840,7 @@ namespace xsimd } template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept { transpose(reinterpret_cast*>(matrix_begin), reinterpret_cast*>(matrix_end), A {}); } diff --git a/include/xsimd/arch/generic/xsimd_generic_rounding.hpp b/include/xsimd/arch/common/xsimd_common_rounding.hpp similarity index 88% rename from include/xsimd/arch/generic/xsimd_generic_rounding.hpp rename to include/xsimd/arch/common/xsimd_common_rounding.hpp index daf7b58ea..a46c263d0 100644 --- a/include/xsimd/arch/generic/xsimd_generic_rounding.hpp +++ b/include/xsimd/arch/common/xsimd_common_rounding.hpp @@ -9,10 +9,10 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_ROUNDING_HPP -#define XSIMD_GENERIC_ROUNDING_HPP +#ifndef XSIMD_COMMON_ROUNDING_HPP +#define XSIMD_COMMON_ROUNDING_HPP -#include "./xsimd_generic_details.hpp" +#include "./xsimd_common_details.hpp" namespace xsimd { @@ -24,7 +24,7 @@ namespace xsimd // ceil template - XSIMD_INLINE batch ceil(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch ceil(batch const& self, requires_arch) noexcept { batch truncated_self = trunc(self); return select(truncated_self < self, truncated_self + 1, truncated_self); @@ -32,7 +32,7 @@ namespace xsimd // floor template - XSIMD_INLINE batch floor(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch floor(batch const& self, requires_arch) noexcept { batch truncated_self = trunc(self); return select(truncated_self > self, truncated_self - 1, truncated_self); @@ -40,7 +40,7 @@ namespace xsimd // round template - XSIMD_INLINE batch round(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch round(batch const& self, requires_arch) noexcept { auto v = abs(self); auto c = ceil(v); @@ -50,17 +50,17 @@ namespace xsimd // trunc template ::value, void>::type> - XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept { return self; } template - XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept { return select(abs(self) < constants::maxflint>(), to_float(to_int(self)), self); } template - XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch trunc(batch const& self, requires_arch) noexcept { return select(abs(self) < constants::maxflint>(), to_float(to_int(self)), self); } diff --git a/include/xsimd/arch/generic/xsimd_generic_trigo.hpp b/include/xsimd/arch/common/xsimd_common_trigo.hpp similarity index 96% rename from include/xsimd/arch/generic/xsimd_generic_trigo.hpp rename to include/xsimd/arch/common/xsimd_common_trigo.hpp index b1bb68f25..235bbc14b 100644 --- a/include/xsimd/arch/generic/xsimd_generic_trigo.hpp +++ b/include/xsimd/arch/common/xsimd_common_trigo.hpp @@ -9,10 +9,10 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_TRIGO_HPP -#define XSIMD_GENERIC_TRIGO_HPP +#ifndef XSIMD_COMMON_TRIGO_HPP +#define XSIMD_COMMON_TRIGO_HPP -#include "./xsimd_generic_details.hpp" +#include "./xsimd_common_details.hpp" #include @@ -35,7 +35,7 @@ namespace xsimd // acos template - XSIMD_INLINE batch acos(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch acos(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -47,7 +47,7 @@ namespace xsimd return select(x_larger_05, x, constants::pio2() - x); } template - XSIMD_INLINE batch, A> acos(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> acos(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -66,7 +66,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch acosh(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch acosh(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = self - batch_type(1.); @@ -76,7 +76,7 @@ namespace xsimd return select(test, l1pz + constants::log_2(), l1pz); } template - XSIMD_INLINE batch, A> acosh(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> acosh(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; batch_type w = acos(z); @@ -86,7 +86,7 @@ namespace xsimd // asin template - XSIMD_INLINE batch asin(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch asin(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -105,7 +105,7 @@ namespace xsimd return z ^ sign; } template - XSIMD_INLINE batch asin(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch asin(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -127,7 +127,7 @@ namespace xsimd ^ bitofsign(self)); } template - XSIMD_INLINE batch, A> asin(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> asin(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -184,7 +184,7 @@ namespace xsimd } } template - XSIMD_INLINE batch asinh(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch asinh(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -212,7 +212,7 @@ namespace xsimd #endif } template - XSIMD_INLINE batch asinh(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch asinh(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -226,7 +226,7 @@ namespace xsimd return bitofsign(self) ^ z; } template - XSIMD_INLINE batch, A> asinh(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> asinh(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; batch_type w = asin(batch_type(-z.imag(), z.real())); @@ -288,7 +288,7 @@ namespace xsimd } } template - XSIMD_INLINE batch atan(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch atan(batch const& self, requires_arch) noexcept { using batch_type = batch; const batch_type absa = abs(self); @@ -296,7 +296,7 @@ namespace xsimd return x ^ bitofsign(self); } template - XSIMD_INLINE batch, A> atan(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> atan(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -327,7 +327,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch atanh(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch atanh(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -338,7 +338,7 @@ namespace xsimd return bitofsign(self) ^ (batch_type(0.5) * log1p(select(test, fma(t, tmp, t), tmp))); } template - XSIMD_INLINE batch, A> atanh(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> atanh(const batch, A>& z, requires_arch) noexcept { using batch_type = batch, A>; batch_type w = atan(batch_type(-z.imag(), z.real())); @@ -348,7 +348,7 @@ namespace xsimd // atan2 template - XSIMD_INLINE batch atan2(batch const& self, batch const& other, requires_arch) noexcept + XSIMD_INLINE batch atan2(batch const& self, batch const& other, requires_arch) noexcept { using batch_type = batch; const batch_type q = abs(self / other); @@ -617,7 +617,7 @@ namespace xsimd } template - XSIMD_INLINE batch cos(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch cos(batch const& self, requires_arch) noexcept { using batch_type = batch; const batch_type x = abs(self); @@ -634,7 +634,7 @@ namespace xsimd } template - XSIMD_INLINE batch, A> cos(batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch, A> cos(batch, A> const& z, requires_arch) noexcept { return { cos(z.real()) * cosh(z.imag()), -sin(z.real()) * sinh(z.imag()) }; } @@ -652,7 +652,7 @@ namespace xsimd */ template - XSIMD_INLINE batch cosh(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch cosh(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type x = abs(self); @@ -663,7 +663,7 @@ namespace xsimd return select(test1, tmp1 * tmp, detail::average(tmp, batch_type(1.) / tmp)); } template - XSIMD_INLINE batch, A> cosh(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> cosh(const batch, A>& z, requires_arch) noexcept { auto x = z.real(); auto y = z.imag(); @@ -692,20 +692,20 @@ namespace xsimd } template - XSIMD_INLINE batch sin(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch sin(batch const& self, requires_arch) noexcept { return detail::sin(self); } template - XSIMD_INLINE batch, A> sin(batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch, A> sin(batch, A> const& z, requires_arch) noexcept { return { sin(z.real()) * cosh(z.imag()), cos(z.real()) * sinh(z.imag()) }; } // sincos template - XSIMD_INLINE std::pair, batch> sincos(batch const& self, requires_arch) noexcept + XSIMD_INLINE std::pair, batch> sincos(batch const& self, requires_arch) noexcept { using batch_type = batch; const batch_type x = abs(self); @@ -725,7 +725,7 @@ namespace xsimd template XSIMD_INLINE std::pair, A>, batch, A>> - sincos(batch, A> const& z, requires_arch) noexcept + sincos(batch, A> const& z, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -739,7 +739,7 @@ namespace xsimd // sinh namespace detail { - /* origin: boost/simd/arch/common/detail/generic/sinh_kernel.hpp */ + /* origin: boost/simd/arch/common/detail/common/sinh_kernel.hpp */ /* * ==================================================== * copyright 2016 NumScale SAS @@ -792,7 +792,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch sinh(batch const& a, requires_arch) noexcept + XSIMD_INLINE batch sinh(batch const& a, requires_arch) noexcept { using batch_type = batch; batch_type half(0.5); @@ -814,7 +814,7 @@ namespace xsimd return select(lt1, z, r) ^ bts; } template - XSIMD_INLINE batch, A> sinh(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> sinh(const batch, A>& z, requires_arch) noexcept { auto x = z.real(); auto y = z.imag(); @@ -823,7 +823,7 @@ namespace xsimd // tan template - XSIMD_INLINE batch tan(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch tan(batch const& self, requires_arch) noexcept { using batch_type = batch; const batch_type x = abs(self); @@ -836,7 +836,7 @@ namespace xsimd return y ^ bitofsign(self); } template - XSIMD_INLINE batch, A> tan(batch, A> const& z, requires_arch) noexcept + XSIMD_INLINE batch, A> tan(batch, A> const& z, requires_arch) noexcept { using batch_type = batch, A>; using real_batch = typename batch_type::real_batch; @@ -851,7 +851,7 @@ namespace xsimd // tanh namespace detail { - /* origin: boost/simd/arch/common/detail/generic/tanh_kernel.hpp */ + /* origin: boost/simd/arch/common/detail/common/tanh_kernel.hpp */ /* * ==================================================== * copyright 2016 NumScale SAS @@ -934,7 +934,7 @@ namespace xsimd * ==================================================== */ template - XSIMD_INLINE batch tanh(batch const& self, requires_arch) noexcept + XSIMD_INLINE batch tanh(batch const& self, requires_arch) noexcept { using batch_type = batch; batch_type one(1.); @@ -952,7 +952,7 @@ namespace xsimd return select(test, z, r) ^ bts; } template - XSIMD_INLINE batch, A> tanh(const batch, A>& z, requires_arch) noexcept + XSIMD_INLINE batch, A> tanh(const batch, A>& z, requires_arch) noexcept { using real_batch = typename batch, A>::real_batch; auto x = z.real(); diff --git a/include/xsimd/arch/xsimd_avx.hpp b/include/xsimd/arch/xsimd_avx.hpp index 3292aaaaf..883f055be 100644 --- a/include/xsimd/arch/xsimd_avx.hpp +++ b/include/xsimd/arch/xsimd_avx.hpp @@ -27,12 +27,12 @@ namespace xsimd // fwd template - XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; + XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; namespace detail { @@ -760,10 +760,10 @@ namespace xsimd } else { - return insert(self, val, pos, generic {}); + return insert(self, val, pos, common {}); } #endif - return insert(self, val, pos, generic {}); + return insert(self, val, pos, common {}); } // isnan @@ -1224,7 +1224,7 @@ namespace xsimd if (I4 == (I0 + 4) && I5 == (I1 + 4) && I6 == (I2 + 4) && I7 == (I3 + 4) && I2 < 4 && I3 < 4 && I0 >= 8 && I0 < 12 && I1 >= 8 && I1 < 12) return _mm256_shuffle_ps(y, x, smask); - return shuffle(x, y, mask, generic {}); + return shuffle(x, y, mask, common {}); } template @@ -1239,7 +1239,7 @@ namespace xsimd if (I1 < 2 && I0 >= 4 && I0 < 6 && I3 >= 2 && I3 < 4 && I2 >= 6) return _mm256_shuffle_pd(y, x, smask); - return shuffle(x, y, mask, generic {}); + return shuffle(x, y, mask, common {}); } // slide_left diff --git a/include/xsimd/arch/xsimd_avx2.hpp b/include/xsimd/arch/xsimd_avx2.hpp index d1f89d223..3ab8517a9 100644 --- a/include/xsimd/arch/xsimd_avx2.hpp +++ b/include/xsimd/arch/xsimd_avx2.hpp @@ -90,7 +90,7 @@ namespace xsimd } else { - return avgr(self, other, generic {}); + return avgr(self, other, common {}); } } @@ -110,7 +110,7 @@ namespace xsimd } else { - return avg(self, other, generic {}); + return avg(self, other, common {}); } } diff --git a/include/xsimd/arch/xsimd_avx512bw.hpp b/include/xsimd/arch/xsimd_avx512bw.hpp index 136adf1fe..832cba6a1 100644 --- a/include/xsimd/arch/xsimd_avx512bw.hpp +++ b/include/xsimd/arch/xsimd_avx512bw.hpp @@ -126,7 +126,7 @@ namespace xsimd } else { - return avgr(self, other, generic {}); + return avgr(self, other, common {}); } } @@ -146,7 +146,7 @@ namespace xsimd } else { - return avg(self, other, generic {}); + return avg(self, other, common {}); } } diff --git a/include/xsimd/arch/xsimd_avx512f.hpp b/include/xsimd/arch/xsimd_avx512f.hpp index d58724a61..dc46cd867 100644 --- a/include/xsimd/arch/xsimd_avx512f.hpp +++ b/include/xsimd/arch/xsimd_avx512f.hpp @@ -27,15 +27,15 @@ namespace xsimd // fwd template - XSIMD_INLINE batch decr_if(batch const& self, Mask const& mask, requires_arch) noexcept; + XSIMD_INLINE batch decr_if(batch const& self, Mask const& mask, requires_arch) noexcept; template - XSIMD_INLINE batch incr_if(batch const& self, Mask const& mask, requires_arch) noexcept; + XSIMD_INLINE batch incr_if(batch const& self, Mask const& mask, requires_arch) noexcept; template - XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; + XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; namespace detail { @@ -778,7 +778,7 @@ namespace xsimd } else { - return decr_if(self, mask, generic {}); + return decr_if(self, mask, common {}); } } @@ -1112,7 +1112,7 @@ namespace xsimd } else { - return incr_if(self, mask, generic {}); + return incr_if(self, mask, common {}); } } @@ -1144,7 +1144,7 @@ namespace xsimd } else { - return insert(self, val, pos, generic {}); + return insert(self, val, pos, common {}); } } @@ -1826,7 +1826,7 @@ namespace xsimd if ((I4 == I0 + 4) && (I5 == I1 + 4) && (I6 == I2 + 4) && (I7 == I3 + 4) && (I8 == I0 + 8) && (I9 == I1 + 8) && (I10 == I2 + 8) && (I11 == I3 + 8) && (I12 == I0 + 12) && (I13 == I1 + 12) && (I14 == I2 + 12) && (I15 == I3 + 12) && I2 < 4 && I3 < 4 && I0 >= 16 && I0 < 20 && I1 >= 16 && I1 < 20) return _mm512_shuffle_ps(y, x, smask); - return shuffle(x, y, mask, generic {}); + return shuffle(x, y, mask, common {}); } template @@ -1841,7 +1841,7 @@ namespace xsimd if (I1 < 2 && I0 >= 8 && I0 < 10 && I3 >= 2 && I3 < 4 && I2 >= 10 && I2 < 12 && I5 >= 4 && I5 < 6 && I4 >= 12 && I4 < 14 && I7 >= 6 && I7 < 8 && I6 >= 14) return _mm512_shuffle_pd(y, x, smask); - return shuffle(x, y, mask, generic {}); + return shuffle(x, y, mask, common {}); } // slide_left @@ -2095,7 +2095,7 @@ namespace xsimd swizzle(batch const& self, batch_constant, requires_arch) noexcept { // FIXME: this sequence is very inefficient, but it's here to catch - // a pattern generated by detail::reduce from xsimd_generic_math.hpp. + // a pattern generated by detail::reduce from xsimd_common_math.hpp. // The whole pattern is actually decently folded by GCC and Clang, // so bare with it. constexpr batch_constant mask32; diff --git a/include/xsimd/arch/xsimd_generic.hpp b/include/xsimd/arch/xsimd_common.hpp similarity index 67% rename from include/xsimd/arch/xsimd_generic.hpp rename to include/xsimd/arch/xsimd_common.hpp index 6403cfb0f..4f8c09f37 100644 --- a/include/xsimd/arch/xsimd_generic.hpp +++ b/include/xsimd/arch/xsimd_common.hpp @@ -9,15 +9,15 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_HPP -#define XSIMD_GENERIC_HPP +#ifndef XSIMD_COMMON_HPP +#define XSIMD_COMMON_HPP -#include "./generic/xsimd_generic_arithmetic.hpp" -#include "./generic/xsimd_generic_complex.hpp" -#include "./generic/xsimd_generic_logical.hpp" -#include "./generic/xsimd_generic_math.hpp" -#include "./generic/xsimd_generic_memory.hpp" -#include "./generic/xsimd_generic_rounding.hpp" -#include "./generic/xsimd_generic_trigo.hpp" +#include "./common/xsimd_common_arithmetic.hpp" +#include "./common/xsimd_common_complex.hpp" +#include "./common/xsimd_common_logical.hpp" +#include "./common/xsimd_common_math.hpp" +#include "./common/xsimd_common_memory.hpp" +#include "./common/xsimd_common_rounding.hpp" +#include "./common/xsimd_common_trigo.hpp" #endif diff --git a/include/xsimd/arch/xsimd_generic_fwd.hpp b/include/xsimd/arch/xsimd_common_fwd.hpp similarity index 82% rename from include/xsimd/arch/xsimd_generic_fwd.hpp rename to include/xsimd/arch/xsimd_common_fwd.hpp index 02708d60f..26a9bdbdb 100644 --- a/include/xsimd/arch/xsimd_generic_fwd.hpp +++ b/include/xsimd/arch/xsimd_common_fwd.hpp @@ -9,8 +9,8 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_FWD_HPP -#define XSIMD_GENERIC_FWD_HPP +#ifndef XSIMD_COMMON_FWD_HPP +#define XSIMD_COMMON_FWD_HPP #include "../types/xsimd_batch_constant.hpp" @@ -22,21 +22,21 @@ namespace xsimd { // forward declaration template ::value, void>::type> - XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept; + XSIMD_INLINE batch abs(batch const& self, requires_arch) noexcept; template ::value, void>::type> - XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept; + XSIMD_INLINE batch bitwise_lshift(batch const& self, batch const& other, requires_arch) noexcept; template ::value, void>::type> - XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept; + XSIMD_INLINE batch bitwise_rshift(batch const& self, batch const& other, requires_arch) noexcept; template - XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept; + XSIMD_INLINE batch_bool gt(batch const& self, batch const& other, requires_arch) noexcept; template ::value, void>::type> - XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept; + XSIMD_INLINE batch mul(batch const& self, batch const& other, requires_arch) noexcept; template ::value, void>::type> - XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept; + XSIMD_INLINE batch sadd(batch const& self, batch const& other, requires_arch) noexcept; template ::value, void>::type> - XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept; + XSIMD_INLINE batch ssub(batch const& self, batch const& other, requires_arch) noexcept; template ::value, void>::type> - XSIMD_INLINE T hadd(batch const& self, requires_arch) noexcept; + XSIMD_INLINE T hadd(batch const& self, requires_arch) noexcept; } } diff --git a/include/xsimd/arch/xsimd_emulated.hpp b/include/xsimd/arch/xsimd_emulated.hpp index 2f4585bbb..11e607479 100644 --- a/include/xsimd/arch/xsimd_emulated.hpp +++ b/include/xsimd/arch/xsimd_emulated.hpp @@ -39,9 +39,9 @@ namespace xsimd // fwd template - XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; + XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; template - XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept; + XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept; namespace detail { diff --git a/include/xsimd/arch/xsimd_isa.hpp b/include/xsimd/arch/xsimd_isa.hpp index a617f836d..f88d94f93 100644 --- a/include/xsimd/arch/xsimd_isa.hpp +++ b/include/xsimd/arch/xsimd_isa.hpp @@ -14,7 +14,7 @@ #include "../config/xsimd_arch.hpp" -#include "./xsimd_generic_fwd.hpp" +#include "./xsimd_common_fwd.hpp" #if XSIMD_WITH_EMULATED #include "./xsimd_emulated.hpp" @@ -129,6 +129,6 @@ #endif // Must come last to have access to all conversion specializations. -#include "./xsimd_generic.hpp" +#include "./xsimd_common.hpp" #endif diff --git a/include/xsimd/arch/xsimd_neon.hpp b/include/xsimd/arch/xsimd_neon.hpp index 2d0a24452..ac3cdacd0 100644 --- a/include/xsimd/arch/xsimd_neon.hpp +++ b/include/xsimd/arch/xsimd_neon.hpp @@ -1678,14 +1678,14 @@ namespace xsimd * reduce_max * **************/ - // Using generic implementation because ARM doe snot provide intrinsics + // Using common implementation because ARM doe snot provide intrinsics // for this operation /************** * reduce_min * **************/ - // Using generic implementation because ARM doe snot provide intrinsics + // Using common implementation because ARM doe snot provide intrinsics // for this operation /********** diff --git a/include/xsimd/arch/xsimd_scalar.hpp b/include/xsimd/arch/xsimd_scalar.hpp index f72dc76a7..82f284958 100644 --- a/include/xsimd/arch/xsimd_scalar.hpp +++ b/include/xsimd/arch/xsimd_scalar.hpp @@ -1123,7 +1123,7 @@ namespace xsimd XSIMD_HASSINCOS_TRAIT(__sincos); XSIMD_HASSINCOS_TRAIT(__sincosf); - struct generic_sincosf + struct common_sincosf { template XSIMD_INLINE typename std::enable_if::type @@ -1148,7 +1148,7 @@ namespace xsimd } }; - struct generic_sincos + struct common_sincos { template XSIMD_INLINE typename std::enable_if::type @@ -1180,14 +1180,14 @@ namespace xsimd XSIMD_INLINE std::pair sincos(float val) noexcept { float s, c; - detail::generic_sincosf {}(val, s, c); + detail::common_sincosf {}(val, s, c); return std::make_pair(s, c); } XSIMD_INLINE std::pair sincos(double val) noexcept { double s, c; - detail::generic_sincos {}(val, s, c); + detail::common_sincos {}(val, s, c); return std::make_pair(s, c); } diff --git a/include/xsimd/arch/xsimd_sse2.hpp b/include/xsimd/arch/xsimd_sse2.hpp index fed786576..94d7af5d4 100644 --- a/include/xsimd/arch/xsimd_sse2.hpp +++ b/include/xsimd/arch/xsimd_sse2.hpp @@ -57,13 +57,13 @@ namespace xsimd // fwd template - XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; + XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; template - XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept; + XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept; template - XSIMD_INLINE batch avg(batch const&, batch const&, requires_arch) noexcept; + XSIMD_INLINE batch avg(batch const&, batch const&, requires_arch) noexcept; template - XSIMD_INLINE batch avgr(batch const&, batch const&, requires_arch) noexcept; + XSIMD_INLINE batch avgr(batch const&, batch const&, requires_arch) noexcept; // abs template @@ -166,7 +166,7 @@ namespace xsimd } else { - return avgr(self, other, generic {}); + return avgr(self, other, common {}); } } @@ -186,7 +186,7 @@ namespace xsimd } else { - return avg(self, other, generic {}); + return avg(self, other, common {}); } } @@ -806,12 +806,12 @@ namespace xsimd } else { - return gt(self, other, generic {}); + return gt(self, other, common {}); } } else { - return gt(self, other, generic {}); + return gt(self, other, common {}); } } @@ -859,7 +859,7 @@ namespace xsimd } else { - return insert(self, val, pos, generic {}); + return insert(self, val, pos, common {}); } } @@ -1243,7 +1243,7 @@ namespace xsimd } else { - return hadd(self, generic {}); + return hadd(self, common {}); } } @@ -1344,7 +1344,7 @@ namespace xsimd // shuffle within opposite lane if (I0 >= 4 && I1 >= 4 && I2 < 4 && I3 < 4) return _mm_shuffle_ps(y, x, smask); - return shuffle(x, y, mask, generic {}); + return shuffle(x, y, mask, common {}); } template @@ -1358,7 +1358,7 @@ namespace xsimd // shuffle within opposite lane if (I0 >= 2 && I1 < 2) return _mm_shuffle_pd(y, x, smask); - return shuffle(x, y, mask, generic {}); + return shuffle(x, y, mask, common {}); } // sqrt @@ -1404,7 +1404,7 @@ namespace xsimd } else { - return sadd(self, other, generic {}); + return sadd(self, other, common {}); } } else @@ -1419,7 +1419,7 @@ namespace xsimd } else { - return sadd(self, other, generic {}); + return sadd(self, other, common {}); } } } @@ -1497,7 +1497,7 @@ namespace xsimd } else { - return ssub(self, other, generic {}); + return ssub(self, other, common {}); } } else @@ -1512,7 +1512,7 @@ namespace xsimd } else { - return ssub(self, other, generic {}); + return ssub(self, other, common {}); } } } diff --git a/include/xsimd/arch/xsimd_wasm.hpp b/include/xsimd/arch/xsimd_wasm.hpp index 9d2983992..f4721aedd 100644 --- a/include/xsimd/arch/xsimd_wasm.hpp +++ b/include/xsimd/arch/xsimd_wasm.hpp @@ -34,13 +34,13 @@ namespace xsimd // fwd template - XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; + XSIMD_INLINE batch insert(batch const& self, T val, index, requires_arch) noexcept; template - XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept; + XSIMD_INLINE batch shuffle(batch const& x, batch const& y, batch_constant, requires_arch) noexcept; template - XSIMD_INLINE batch avg(batch const&, batch const&, requires_arch) noexcept; + XSIMD_INLINE batch avg(batch const&, batch const&, requires_arch) noexcept; template - XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; + XSIMD_INLINE void transpose(batch* matrix_begin, batch* matrix_end, requires_arch) noexcept; // abs template ::value && std::is_signed::value, void>::type> @@ -134,7 +134,7 @@ namespace xsimd } else { - return avgr(self, other, generic {}); + return avgr(self, other, common {}); } } @@ -154,7 +154,7 @@ namespace xsimd } else { - return avg(self, other, generic {}); + return avg(self, other, common {}); } } @@ -728,7 +728,7 @@ namespace xsimd } else { - return gt(self, other, generic {}); + return gt(self, other, common {}); } } } @@ -1170,7 +1170,7 @@ namespace xsimd } else { - return hadd(self, generic {}); + return hadd(self, common {}); } } template @@ -1244,7 +1244,7 @@ namespace xsimd } else { - return sadd(self, other, generic {}); + return sadd(self, other, common {}); } } else @@ -1259,7 +1259,7 @@ namespace xsimd } else { - return sadd(self, other, generic {}); + return sadd(self, other, common {}); } } } @@ -1375,7 +1375,7 @@ namespace xsimd } else { - return ssub(self, other, generic {}); + return ssub(self, other, common {}); } } else @@ -1390,7 +1390,7 @@ namespace xsimd } else { - return ssub(self, other, generic {}); + return ssub(self, other, common {}); } } } @@ -1608,7 +1608,7 @@ namespace xsimd } else { - transpose(matrix_begin, matrix_end, generic {}); + transpose(matrix_begin, matrix_end, common {}); } } diff --git a/include/xsimd/memory/xsimd_aligned_allocator.hpp b/include/xsimd/memory/xsimd_aligned_allocator.hpp index f6e9c9d12..6d4431f13 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, generic, default_arch>::type::alignment()> + template ::value, common, default_arch>::type::alignment()> class aligned_allocator { public: diff --git a/include/xsimd/types/xsimd_avx512f_register.hpp b/include/xsimd/types/xsimd_avx512f_register.hpp index 7f4bda929..c7af6d9f7 100644 --- a/include/xsimd/types/xsimd_avx512f_register.hpp +++ b/include/xsimd/types/xsimd_avx512f_register.hpp @@ -12,7 +12,7 @@ #ifndef XSIMD_AVX512F_REGISTER_HPP #define XSIMD_AVX512F_REGISTER_HPP -#include "./xsimd_generic_arch.hpp" +#include "./xsimd_common_arch.hpp" namespace xsimd { @@ -22,7 +22,7 @@ namespace xsimd * * AVX512F instructions */ - struct avx512f : generic + struct avx512f : common { static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512F; } static constexpr bool available() noexcept { return true; } diff --git a/include/xsimd/types/xsimd_avx_register.hpp b/include/xsimd/types/xsimd_avx_register.hpp index 0cd423473..47997ee76 100644 --- a/include/xsimd/types/xsimd_avx_register.hpp +++ b/include/xsimd/types/xsimd_avx_register.hpp @@ -12,7 +12,7 @@ #ifndef XSIMD_AVX_REGISTER_HPP #define XSIMD_AVX_REGISTER_HPP -#include "./xsimd_generic_arch.hpp" +#include "./xsimd_common_arch.hpp" namespace xsimd { @@ -22,7 +22,7 @@ namespace xsimd * * AVX instructions */ - struct avx : generic + struct avx : common { static constexpr bool supported() noexcept { return XSIMD_WITH_AVX; } static constexpr bool available() noexcept { return true; } diff --git a/include/xsimd/types/xsimd_generic_arch.hpp b/include/xsimd/types/xsimd_common_arch.hpp similarity index 91% rename from include/xsimd/types/xsimd_generic_arch.hpp rename to include/xsimd/types/xsimd_common_arch.hpp index d16a37fea..28491aeda 100644 --- a/include/xsimd/types/xsimd_generic_arch.hpp +++ b/include/xsimd/types/xsimd_common_arch.hpp @@ -9,8 +9,8 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ -#ifndef XSIMD_GENERIC_ARCH_HPP -#define XSIMD_GENERIC_ARCH_HPP +#ifndef XSIMD_COMMON_ARCH_HPP +#define XSIMD_COMMON_ARCH_HPP #include "../config/xsimd_config.hpp" @@ -24,7 +24,7 @@ namespace xsimd * * Base class for all architectures. */ - struct generic + struct common { /// Whether this architecture is supported at compile-time. static constexpr bool supported() noexcept { return true; } @@ -36,7 +36,7 @@ namespace xsimd /// Whether this architecture requires aligned memory access. static constexpr bool requires_alignment() noexcept { return false; } /// Name of the architecture. - static constexpr char const* name() noexcept { return "generic"; } + static constexpr char const* name() noexcept { return "common"; } }; struct unsupported diff --git a/include/xsimd/types/xsimd_emulated_register.hpp b/include/xsimd/types/xsimd_emulated_register.hpp index 6e0d659bd..306ca0cf4 100644 --- a/include/xsimd/types/xsimd_emulated_register.hpp +++ b/include/xsimd/types/xsimd_emulated_register.hpp @@ -12,7 +12,7 @@ #ifndef XSIMD_EMULATED_REGISTER_HPP #define XSIMD_EMULATED_REGISTER_HPP -#include "./xsimd_generic_arch.hpp" +#include "./xsimd_common_arch.hpp" #include "./xsimd_register.hpp" namespace xsimd @@ -23,7 +23,7 @@ namespace xsimd * emulated instructions */ template - struct emulated : generic + struct emulated : common { static constexpr bool supported() noexcept { return true; } static constexpr bool available() noexcept { return true; } diff --git a/include/xsimd/types/xsimd_neon_register.hpp b/include/xsimd/types/xsimd_neon_register.hpp index a9f4a46c8..4f40a4287 100644 --- a/include/xsimd/types/xsimd_neon_register.hpp +++ b/include/xsimd/types/xsimd_neon_register.hpp @@ -12,7 +12,7 @@ #ifndef XSIMD_NEON_REGISTER_HPP #define XSIMD_NEON_REGISTER_HPP -#include "xsimd_generic_arch.hpp" +#include "xsimd_common_arch.hpp" #include "xsimd_register.hpp" #if XSIMD_WITH_NEON @@ -26,7 +26,7 @@ namespace xsimd * * NEON instructions for arm32 */ - struct neon : generic + struct neon : common { static constexpr bool supported() noexcept { return XSIMD_WITH_NEON; } static constexpr bool available() noexcept { return true; } diff --git a/include/xsimd/types/xsimd_rvv_register.hpp b/include/xsimd/types/xsimd_rvv_register.hpp index 4d5258d30..feadc00f9 100644 --- a/include/xsimd/types/xsimd_rvv_register.hpp +++ b/include/xsimd/types/xsimd_rvv_register.hpp @@ -13,7 +13,7 @@ #ifndef XSIMD_RVV_REGISTER_HPP #define XSIMD_RVV_REGISTER_HPP -#include "xsimd_generic_arch.hpp" +#include "xsimd_common_arch.hpp" #include "xsimd_register.hpp" #if XSIMD_WITH_RVV @@ -30,7 +30,7 @@ namespace xsimd * RVV instructions (fixed vector size) for riscv */ template - struct rvv : xsimd::generic + struct rvv : xsimd::common { static constexpr size_t width = Width; static constexpr bool supported() noexcept { return Width == XSIMD_RVV_BITS; } diff --git a/include/xsimd/types/xsimd_sse2_register.hpp b/include/xsimd/types/xsimd_sse2_register.hpp index e6eabec7a..48c1fd53f 100644 --- a/include/xsimd/types/xsimd_sse2_register.hpp +++ b/include/xsimd/types/xsimd_sse2_register.hpp @@ -12,7 +12,7 @@ #ifndef XSIMD_SSE2_REGISTER_HPP #define XSIMD_SSE2_REGISTER_HPP -#include "./xsimd_generic_arch.hpp" +#include "./xsimd_common_arch.hpp" #include "./xsimd_register.hpp" #if XSIMD_WITH_SSE2 @@ -27,7 +27,7 @@ namespace xsimd * * SSE2 instructions */ - struct sse2 : generic + struct sse2 : common { static constexpr bool supported() noexcept { return XSIMD_WITH_SSE2; } static constexpr bool available() noexcept { return true; } diff --git a/include/xsimd/types/xsimd_sve_register.hpp b/include/xsimd/types/xsimd_sve_register.hpp index 29564d023..9d33fc484 100644 --- a/include/xsimd/types/xsimd_sve_register.hpp +++ b/include/xsimd/types/xsimd_sve_register.hpp @@ -13,7 +13,7 @@ #ifndef XSIMD_SVE_REGISTER_HPP #define XSIMD_SVE_REGISTER_HPP -#include "xsimd_generic_arch.hpp" +#include "xsimd_common_arch.hpp" #include "xsimd_register.hpp" #if XSIMD_WITH_SVE @@ -30,7 +30,7 @@ namespace xsimd * SVE instructions (fixed vector size) for arm64 */ template - struct sve : xsimd::generic + struct sve : xsimd::common { static constexpr bool supported() noexcept { return Width == XSIMD_SVE_BITS; } static constexpr bool available() noexcept { return true; } diff --git a/include/xsimd/types/xsimd_wasm_register.hpp b/include/xsimd/types/xsimd_wasm_register.hpp index a1b840360..70b6ff9ad 100644 --- a/include/xsimd/types/xsimd_wasm_register.hpp +++ b/include/xsimd/types/xsimd_wasm_register.hpp @@ -13,7 +13,7 @@ #ifndef XSIMD_WASM_REGISTER_HPP #define XSIMD_WASM_REGISTER_HPP -#include "xsimd_generic_arch.hpp" +#include "xsimd_common_arch.hpp" #include "xsimd_register.hpp" #if XSIMD_WITH_WASM @@ -27,7 +27,7 @@ namespace xsimd * * WASM instructions */ - struct wasm : generic + struct wasm : common { static constexpr bool supported() noexcept { return XSIMD_WITH_WASM; } static constexpr bool available() noexcept { return true; } diff --git a/test/test_arch.cpp b/test/test_arch.cpp index 4a5c3154e..9bb19291f 100644 --- a/test/test_arch.cpp +++ b/test/test_arch.cpp @@ -99,8 +99,8 @@ TEST_CASE("[multi arch support]") SUBCASE("xsimd::arch_list<...>::alignment()") { - static_assert(xsimd::arch_list::alignment() == 0, - "generic"); + static_assert(xsimd::arch_list::alignment() == 0, + "common"); static_assert(xsimd::arch_list::alignment() == xsimd::sse2::alignment(), "one architecture"); diff --git a/test/test_batch.cpp b/test/test_batch.cpp index 49559b25d..dc6b1940d 100644 --- a/test/test_batch.cpp +++ b/test/test_batch.cpp @@ -803,17 +803,17 @@ struct batch_test } template - typename std::enable_if<4 <= N, void>::type test_generic_horizontal_operations(std::integral_constant) const + typename std::enable_if<4 <= N, void>::type test_common_horizontal_operations(std::integral_constant) const { - // reduce generic + // reduce common { value_type expected = std::accumulate(lhs.cbegin(), lhs.cend(), value_type(1), std::multiplies()); value_type res = reduce(xsimd::mul, batch_lhs()); - INFO("generic reduce"); + INFO("common reduce"); CHECK_SCALAR_EQ(res, expected); } } - void test_generic_horizontal_operations(...) const { } + void test_common_horizontal_operations(...) const { } void test_boolean_conversions() const { @@ -986,7 +986,7 @@ TEST_CASE_TEMPLATE("[batch]", B, BATCH_TYPES) SUBCASE("horizontal_operations") { Test.test_horizontal_operations(); - Test.test_generic_horizontal_operations(std::integral_constant()); + Test.test_common_horizontal_operations(std::integral_constant()); } SUBCASE("boolean_conversions") diff --git a/test/test_shuffle.cpp b/test/test_shuffle.cpp index a2f66157d..1c7c9884b 100644 --- a/test/test_shuffle.cpp +++ b/test/test_shuffle.cpp @@ -332,7 +332,7 @@ struct compress_test CHECK_BATCH_EQ(b, expected); } - void generic() + void common() { for (size_t i = 0; i < size; ++i) mask[i] = i % 3 == 0; @@ -362,9 +362,9 @@ TEST_CASE_TEMPLATE("[compress]", B, BATCH_FLOAT_TYPES, xsimd::batch, xs //{ // Test.interleave(); // } - // SUBCASE("generic") + // SUBCASE("common") //{ - // Test.generic(); + // Test.common(); // } } @@ -428,7 +428,7 @@ struct expand_test CHECK_BATCH_EQ(b, expected); } - void generic() + void common() { for (size_t i = 0; i < size; ++i) mask[i] = i % 3 == 0; @@ -458,9 +458,9 @@ TEST_CASE_TEMPLATE("[expand]", B, BATCH_FLOAT_TYPES, xsimd::batch, xsim { Test.interleave(); } - SUBCASE("generic") + SUBCASE("common") { - Test.generic(); + Test.common(); } } @@ -514,12 +514,12 @@ struct shuffle_test CHECK_BATCH_EQ(b_res_rhs, b_rhs); } - void generic() + void common() { B b_lhs = B::load_unaligned(lhs.data()); B b_rhs = B::load_unaligned(rhs.data()); - struct generic_generator + struct common_generator { static constexpr size_t get(size_t index, size_t size) { @@ -535,7 +535,7 @@ struct shuffle_test } B b_ref = B::load_unaligned(ref.data()); - B b_res = xsimd::shuffle(b_lhs, b_rhs, xsimd::make_batch_constant()); + B b_res = xsimd::shuffle(b_lhs, b_rhs, xsimd::make_batch_constant()); CHECK_BATCH_EQ(b_res, b_ref); } @@ -697,9 +697,9 @@ TEST_CASE_TEMPLATE("[shuffle]", B, BATCH_FLOAT_TYPES, xsimd::batch, xs { Test.no_op(); } - SUBCASE("generic") + SUBCASE("common") { - Test.generic(); + Test.common(); } SUBCASE("pick") {