diff --git a/include/eve/module/core/decorator/core.hpp b/include/eve/module/core/decorator/core.hpp index a9e08eb338..f713586dc9 100644 --- a/include/eve/module/core/decorator/core.hpp +++ b/include/eve/module/core/decorator/core.hpp @@ -120,7 +120,7 @@ namespace eve inline constexpr auto as_option(kind_1_type const&) { return kind_12; } inline constexpr auto as_option(kind_2_type const&) { return kind_22; } inline constexpr auto as_option(musl_type const&) { return musl2; } - inline constexpr auto as_option(numeric_type const&) { return numeric; } + inline constexpr auto as_option(numeric_type const&) { return numeric2; } inline constexpr auto as_option(p_kind_type const&) { return p_kind2; } inline constexpr auto as_option(pedantic_type const&) { return pedantic2; } inline constexpr auto as_option(plain_type const&) { return plain2; } diff --git a/include/eve/module/core/decorator/numeric.hpp b/include/eve/module/core/decorator/numeric.hpp index 07672effc1..e5f6bf27ef 100644 --- a/include/eve/module/core/decorator/numeric.hpp +++ b/include/eve/module/core/decorator/numeric.hpp @@ -50,5 +50,5 @@ using numeric_type = decorated; //! //! @} //================================================================================================ -inline constexpr numeric_type const numeric = {}; +[[maybe_unused]] inline constexpr numeric_type const numeric = {}; } diff --git a/include/eve/module/core/numeric/absmax.hpp b/include/eve/module/core/numeric/absmax.hpp deleted file mode 100644 index ac0e627832..0000000000 --- a/include/eve/module/core/numeric/absmax.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/absmin.hpp b/include/eve/module/core/numeric/absmin.hpp deleted file mode 100644 index ffea1a2419..0000000000 --- a/include/eve/module/core/numeric/absmin.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/core.hpp b/include/eve/module/core/numeric/core.hpp index 926c175b6b..da69e54ce3 100644 --- a/include/eve/module/core/numeric/core.hpp +++ b/include/eve/module/core/numeric/core.hpp @@ -7,8 +7,6 @@ //================================================================================================== #pragma once -#include -#include #include #include #include @@ -20,13 +18,3 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/include/eve/module/core/numeric/impl/absmax.hpp b/include/eve/module/core/numeric/impl/absmax.hpp deleted file mode 100644 index 6fff25b34c..0000000000 --- a/include/eve/module/core/numeric/impl/absmax.hpp +++ /dev/null @@ -1,54 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(absmax(a, b)) -{ - return arithmetic_call(numeric(absmax), a, b); -} - -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return eve::abs(eve::numeric(max)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmax_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) - -> decltype(absmax(a0, a1, args...)) -{ - return eve::abs(numeric(eve::max)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/numeric/impl/absmin.hpp b/include/eve/module/core/numeric/impl/absmin.hpp deleted file mode 100644 index 2d4620ae6c..0000000000 --- a/include/eve/module/core/numeric/impl/absmin.hpp +++ /dev/null @@ -1,55 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(absmin(a, b)) -{ - return arithmetic_call(numeric(absmin), a, b); -} - -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return eve::abs(numeric(eve::min)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmin_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) -{ - return eve::abs(numeric(eve::min)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/numeric/impl/max.hpp b/include/eve/module/core/numeric/impl/max.hpp deleted file mode 100644 index 2fa625eb9a..0000000000 --- a/include/eve/module/core/numeric/impl/max.hpp +++ /dev/null @@ -1,83 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& v0, - U const& v1) noexcept --> decltype(max(v0, v1)){ - return arithmetic_call(numeric(max), v0, v1); -} - -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& v0, T const& v1) noexcept -{ - if constexpr( integral_value ) return eve::max(v0, v1); - else - { - if constexpr( eve::platform::supports_invalids ) - { - if constexpr( scalar_value ) - { - if( is_eqz(v0) && is_eqz(v1) ) return bit_and(v0, v1); - return is_nan(v0) ? v1 : is_nan(v1) ? v0 : max(v0, v1); - } - else - { - auto tmp = if_else(is_nan(v0), v1, if_else(is_nan(v1), v0, max(v0, v1))); - return if_else(is_eqz(v0) && is_eqz(v1), bit_and(v0, v1), tmp); - } - } - else - { - if constexpr( scalar_value ) - { - return (is_eqz(v0) && is_eqz(v1) ? bit_and(v0, v1) : eve::max(v0, v1)); - } - else { return if_else(is_eqz(v0) && is_eqz(v1), bit_and(v0, v1), eve::max(v0, v1)); } - } - } -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -max_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) - -> decltype(max(a0, a1, args...)) -{ - auto m = numeric(max); - using r_t = decltype(max(a0, a1, args...)); - r_t that(m(r_t(a0), r_t(a1))); - ((that = m(that, r_t(args))), ...); - return that; -} - -} diff --git a/include/eve/module/core/numeric/impl/maxabs.hpp b/include/eve/module/core/numeric/impl/maxabs.hpp deleted file mode 100644 index aceb60f916..0000000000 --- a/include/eve/module/core/numeric/impl/maxabs.hpp +++ /dev/null @@ -1,57 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(maxabs(a, b)) -{ - return arithmetic_call(numeric(maxabs), a, b); -} - -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return eve::numeric(max)(eve::abs(a), eve::abs(b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -maxabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) noexcept - -> decltype(maxabs(a0, a1, args...)) -{ - using r_t = common_value_t; - r_t that(numeric(maxabs)(r_t(a0), r_t(a1))); - ((that = numeric(maxabs)(that, r_t(args))), ...); - return that; -} -} diff --git a/include/eve/module/core/numeric/impl/maxmag.hpp b/include/eve/module/core/numeric/impl/maxmag.hpp deleted file mode 100644 index dd6e324034..0000000000 --- a/include/eve/module/core/numeric/impl/maxmag.hpp +++ /dev/null @@ -1,47 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(maxmag(a, b)) -{ - return arithmetic_call(numeric(maxmag), a, b); -} - -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - auto aa = if_else(is_nan(a), b, a); - auto bb = if_else(is_nan(b), a, b); - return eve::pedantic(maxmag)(aa, bb); -} -} diff --git a/include/eve/module/core/numeric/impl/min.hpp b/include/eve/module/core/numeric/impl/min.hpp deleted file mode 100644 index a7b896403e..0000000000 --- a/include/eve/module/core/numeric/impl/min.hpp +++ /dev/null @@ -1,84 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& v0, - U const& v1) noexcept --> decltype(min(v0, v1)) -{ - return arithmetic_call(numeric(min), v0, v1); -} - -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& v0, T const& v1) noexcept -{ - if constexpr( integral_value ) return eve::min(v0, v1); - else - { - if constexpr( eve::platform::supports_invalids ) - { - if constexpr( scalar_value ) - { - if( is_nan(v0) ) return v1; - else if( is_nan(v1) ) return v0; - else if( is_eqz(v0) && is_eqz(v1) ) return bit_or(v0, v1); - else return min(v0, v1); - } - else - { - auto tmp = if_else(is_nan(v0), v1, if_else(is_nan(v1), v0, min(v0, v1))); - return if_else(is_eqz(v0) && is_eqz(v1), bit_or(v0, v1), tmp); - } - } - else - { - if constexpr( scalar_value ) - { - return (is_eqz(v0) && is_eqz(v1) ? bit_or(v0, v1) : eve::min(v0, v1)); - } - else { return if_else(is_eqz(v0) && is_eqz(v1), bit_or(v0, v1), eve::min(v0, v1)); } - } - } -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -min_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) noexcept - -> common_value_t -{ - auto m = numeric(min); - using r_t = common_value_t; - r_t that(m(r_t(a0), r_t(a1))); - ((that = m(that, r_t(args))), ...); - return that; -} -} diff --git a/include/eve/module/core/numeric/impl/minabs.hpp b/include/eve/module/core/numeric/impl/minabs.hpp deleted file mode 100644 index aa458d9212..0000000000 --- a/include/eve/module/core/numeric/impl/minabs.hpp +++ /dev/null @@ -1,57 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(minabs(a, b)) -{ - return arithmetic_call(numeric(minabs), a, b); -} - -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return eve::numeric(min)(eve::abs(a), eve::abs(b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -minabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) - -> decltype(minabs(a0, a1, args...)) -{ - using r_t = common_value_t; - r_t that(numeric(minabs)(r_t(a0), r_t(a1))); - ((that = numeric(minabs)(that, r_t(args))), ...); - return that; -} -} diff --git a/include/eve/module/core/numeric/impl/minmag.hpp b/include/eve/module/core/numeric/impl/minmag.hpp deleted file mode 100644 index 68057376fa..0000000000 --- a/include/eve/module/core/numeric/impl/minmag.hpp +++ /dev/null @@ -1,47 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(minmag(a, b)) -{ - return arithmetic_call(numeric(minmag), a, b); -} - -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - auto aa = if_else(is_nan(a), b, a); - auto bb = if_else(is_nan(b), a, b); - return eve::pedantic(minmag)(aa, bb); -} -} diff --git a/include/eve/module/core/numeric/impl/negabsmax.hpp b/include/eve/module/core/numeric/impl/negabsmax.hpp deleted file mode 100644 index 99a0e2c6a5..0000000000 --- a/include/eve/module/core/numeric/impl/negabsmax.hpp +++ /dev/null @@ -1,49 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negabsmax_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(negabsmax(a, b)) -{ - return arithmetic_call(numeric(negabsmax), a, b); -} - -template -EVE_FORCEINLINE T -negabsmax_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return -numeric(absmax)(a, b); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negabsmax_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) noexcept -{ - return minus(numeric(eve::absmax)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/numeric/impl/negabsmin.hpp b/include/eve/module/core/numeric/impl/negabsmin.hpp deleted file mode 100644 index 21bd14ac3b..0000000000 --- a/include/eve/module/core/numeric/impl/negabsmin.hpp +++ /dev/null @@ -1,50 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(negabsmin(a, b)) -{ - return arithmetic_call(numeric(negabsmin), a, b); -} - -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return minus(numeric(absmin)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negabsmin_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(negabsmin(a0,a1, args...)) -{ - return minus(numeric(eve::absmin)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/numeric/impl/negmaxabs.hpp b/include/eve/module/core/numeric/impl/negmaxabs.hpp deleted file mode 100644 index b456426500..0000000000 --- a/include/eve/module/core/numeric/impl/negmaxabs.hpp +++ /dev/null @@ -1,50 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(negmaxabs(a, b)) -{ - return arithmetic_call(numeric(negmaxabs), a, b); -} - -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return minus(numeric(maxabs)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negmaxabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) noexcept - -> decltype(negmaxabs(a0, a1, args...)) -{ - return minus(numeric(eve::maxabs)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/numeric/impl/negminabs.hpp b/include/eve/module/core/numeric/impl/negminabs.hpp deleted file mode 100644 index a89197b0c1..0000000000 --- a/include/eve/module/core/numeric/impl/negminabs.hpp +++ /dev/null @@ -1,50 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T const& a, - U const& b) noexcept --> decltype(negminabs(a, b)) -{ - return arithmetic_call(numeric(negminabs), a, b); -} - -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T const& a, T const& b) noexcept -{ - return minus(numeric(minabs)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negminabs_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 a0, T1 a1, Ts... args) noexcept - -> decltype(negminabs(a0, a1, args...)) -{ - return minus(numeric(eve::minabs)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/numeric/max.hpp b/include/eve/module/core/numeric/max.hpp deleted file mode 100644 index 9a69123310..0000000000 --- a/include/eve/module/core/numeric/max.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/maxabs.hpp b/include/eve/module/core/numeric/maxabs.hpp deleted file mode 100644 index c6eb6e9fdc..0000000000 --- a/include/eve/module/core/numeric/maxabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/maxmag.hpp b/include/eve/module/core/numeric/maxmag.hpp deleted file mode 100644 index 5a44d9c038..0000000000 --- a/include/eve/module/core/numeric/maxmag.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/min.hpp b/include/eve/module/core/numeric/min.hpp deleted file mode 100644 index ee5e589f03..0000000000 --- a/include/eve/module/core/numeric/min.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/minabs.hpp b/include/eve/module/core/numeric/minabs.hpp deleted file mode 100644 index 2c4e789518..0000000000 --- a/include/eve/module/core/numeric/minabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/minmag.hpp b/include/eve/module/core/numeric/minmag.hpp deleted file mode 100644 index 31206252e0..0000000000 --- a/include/eve/module/core/numeric/minmag.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/negabsmax.hpp b/include/eve/module/core/numeric/negabsmax.hpp deleted file mode 100644 index af3ee54cf3..0000000000 --- a/include/eve/module/core/numeric/negabsmax.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/negabsmin.hpp b/include/eve/module/core/numeric/negabsmin.hpp deleted file mode 100644 index 75fe1a079a..0000000000 --- a/include/eve/module/core/numeric/negabsmin.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/negmaxabs.hpp b/include/eve/module/core/numeric/negmaxabs.hpp deleted file mode 100644 index f8c66d92f4..0000000000 --- a/include/eve/module/core/numeric/negmaxabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/numeric/negminabs.hpp b/include/eve/module/core/numeric/negminabs.hpp deleted file mode 100644 index 61aade4de8..0000000000 --- a/include/eve/module/core/numeric/negminabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/absmax.hpp b/include/eve/module/core/pedantic/absmax.hpp deleted file mode 100644 index f4da3120f1..0000000000 --- a/include/eve/module/core/pedantic/absmax.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/absmin.hpp b/include/eve/module/core/pedantic/absmin.hpp deleted file mode 100644 index feb578d235..0000000000 --- a/include/eve/module/core/pedantic/absmin.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/core.hpp b/include/eve/module/core/pedantic/core.hpp index 9dffbc56d0..1a7496912f 100644 --- a/include/eve/module/core/pedantic/core.hpp +++ b/include/eve/module/core/pedantic/core.hpp @@ -7,8 +7,6 @@ //================================================================================================== #pragma once -#include -#include #include #include #include @@ -23,18 +21,8 @@ #include #include #include -#include -#include -#include -#include -#include -#include #include -#include -#include #include -#include -#include #include #include #include diff --git a/include/eve/module/core/pedantic/impl/absmax.hpp b/include/eve/module/core/pedantic/impl/absmax.hpp deleted file mode 100644 index b394ff64b6..0000000000 --- a/include/eve/module/core/pedantic/impl/absmax.hpp +++ /dev/null @@ -1,54 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(absmax(a, b)) -{ - return arithmetic_call(pedantic(absmax), a, b); -} - -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return eve::abs(eve::pedantic(max)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmax_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) --> decltype(absmax(a0, a1, args...)) -{ - return eve::abs(pedantic(eve::max)(a0, a1, args...)); -} -} diff --git a/include/eve/module/core/pedantic/impl/absmin.hpp b/include/eve/module/core/pedantic/impl/absmin.hpp deleted file mode 100644 index a790175efc..0000000000 --- a/include/eve/module/core/pedantic/impl/absmin.hpp +++ /dev/null @@ -1,52 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(absmin(a, b)){ - return arithmetic_call(pedantic(absmin), a, b); -} - -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return eve::abs(eve::pedantic(min)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmin_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) -{ - return eve::abs(pedantic(eve::min)(a0, a1, args...)); -} -} diff --git a/include/eve/module/core/pedantic/impl/max.hpp b/include/eve/module/core/pedantic/impl/max.hpp deleted file mode 100644 index 1e8181d88a..0000000000 --- a/include/eve/module/core/pedantic/impl/max.hpp +++ /dev/null @@ -1,81 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& v0, - U const& v1) noexcept --> decltype(max(v0, v1)) -{ - return arithmetic_call(pedantic(max), v0, v1); -} - -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& v0, T const& v1) noexcept -{ - if constexpr( integral_value ) return eve::max(v0, v1); - else - { - if constexpr( eve::platform::supports_invalids ) - { - if constexpr( scalar_value ) - { - if( is_eqz(v0) && is_eqz(v1) ) return bit_and(v0, v1); - return is_unordered(v0, v1) ? v0 : eve::max(v0, v1); - } - else - { - auto tmp = if_else(is_unordered(v0, v1), v0, eve::max(v0, v1)); - return if_else(is_eqz(v0) && is_eqz(v1), bit_and(v0, v1), tmp); - } - } - else - { - if constexpr( scalar_value ) - { - return (is_eqz(v0) && is_eqz(v1) ? bit_and(v0, v1) : eve::max(v0, v1)); - } - else { return if_else(is_eqz(v0) && is_eqz(v1), bit_and(v0, v1), eve::max(v0, v1)); } - } - } -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -max_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(max(a0, a1, args...)) -{ - auto m = pedantic(max); - using r_t = decltype(max(a0, a1, args...)); - r_t that(m(r_t(a0), r_t(a1))); - ((that = m(that, r_t(args))), ...); - return that; -} -} diff --git a/include/eve/module/core/pedantic/impl/maxabs.hpp b/include/eve/module/core/pedantic/impl/maxabs.hpp deleted file mode 100644 index c639ac1f05..0000000000 --- a/include/eve/module/core/pedantic/impl/maxabs.hpp +++ /dev/null @@ -1,55 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(maxabs(a, b)) -{ - return arithmetic_call(pedantic(maxabs), a, b); -} - -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return pedantic(max)(eve::abs(a), eve::abs(b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -maxabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(maxabs(a0, a1, args...)) -{ - using r_t = decltype(maxabs(a0, a1, args...)); - r_t that(pedantic(maxabs)(r_t(a0), r_t(a1))); - ((that = pedantic(maxabs)(that, r_t(args))), ...); - return that; -} -} diff --git a/include/eve/module/core/pedantic/impl/maxmag.hpp b/include/eve/module/core/pedantic/impl/maxmag.hpp deleted file mode 100644 index 2109f5225d..0000000000 --- a/include/eve/module/core/pedantic/impl/maxmag.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(maxmag(a, b)) -{ - return arithmetic_call(pedantic(maxmag), a, b); -} - -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - auto aa = eve::abs[saturated](a); - auto bb = eve::abs[saturated](b); - if constexpr( simd_value ) - { - auto tmp = if_else(is_not_greater_equal(aa, bb), b, pedantic(eve::max)(a, b)); - return if_else(is_not_greater_equal(bb, aa), a, tmp); - } - else { return aa < bb ? b : bb < aa ? a : pedantic(eve::max)(a, b); } -} -} diff --git a/include/eve/module/core/pedantic/impl/min.hpp b/include/eve/module/core/pedantic/impl/min.hpp deleted file mode 100644 index 7cfe5ae1fa..0000000000 --- a/include/eve/module/core/pedantic/impl/min.hpp +++ /dev/null @@ -1,81 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& v0, - U const& v1) noexcept --> decltype(min(v0, v1)) -{ - return arithmetic_call(pedantic(min), v0, v1); -} - -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& v0, T const& v1) noexcept -{ - if constexpr( integral_value ) return eve::min(v0, v1); - else - { - if constexpr( eve::platform::supports_invalids ) - { - if constexpr( scalar_value ) - { - if( is_eqz(v0) && is_eqz(v1) ) return bit_or(v0, v1); - return is_unordered(v0, v1) ? v0 : eve::min(v0, v1); - } - else - { - auto tmp = if_else(is_unordered(v0, v1), v0, eve::min(v0, v1)); - return if_else(is_eqz(v0) && is_eqz(v1), bit_or(v0, v1), tmp); - } - } - else - { - if constexpr( scalar_value ) - { - return (is_eqz(v0) && is_eqz(v1) ? bit_or(v0, v1) : eve::min(v0, v1)); - } - else { return if_else(is_eqz(v0) && is_eqz(v1), bit_or(v0, v1), eve::min(v0, v1)); } - } - } -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -min_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) --> decltype(min(a0, a1, args...)) -{ - auto m = pedantic(min); - using r_t = decltype(min(a0, a1, args...)); - r_t that(m(r_t(a0), r_t(a1))); - ((that = m(that, r_t(args))), ...); - return that; -} -} diff --git a/include/eve/module/core/pedantic/impl/minabs.hpp b/include/eve/module/core/pedantic/impl/minabs.hpp deleted file mode 100644 index 4c5e772bfc..0000000000 --- a/include/eve/module/core/pedantic/impl/minabs.hpp +++ /dev/null @@ -1,53 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(minabs(a, b)) -{ - return arithmetic_call(pedantic(minabs), a, b); -} - -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return pedantic(min)(eve::abs(a), eve::abs(b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -minabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(minabs(a0, a1, args...)) -{ - using r_t = decltype(minabs(a0, a1, args...)); - r_t that(pedantic(minabs)(r_t(a0), r_t(a1))); - ((that = pedantic(minabs)(that, r_t(args))), ...); - return that; -} -} diff --git a/include/eve/module/core/pedantic/impl/minmag.hpp b/include/eve/module/core/pedantic/impl/minmag.hpp deleted file mode 100644 index b2d0810ea4..0000000000 --- a/include/eve/module/core/pedantic/impl/minmag.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(minmag(a, b)) -{ - return arithmetic_call(pedantic(minmag), a, b); -} - -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - auto aa = eve::abs[saturated](a); - auto bb = eve::abs[saturated](b); - if constexpr( simd_value ) - { - auto tmp = if_else(is_not_greater_equal(bb, aa), b, pedantic(eve::min)(a, b)); - return if_else(is_not_greater_equal(aa, bb), a, tmp); - } - else { return aa < bb ? a : bb < aa ? b : pedantic(eve::min)(a, b); } -} -} diff --git a/include/eve/module/core/pedantic/impl/negabsmax.hpp b/include/eve/module/core/pedantic/impl/negabsmax.hpp deleted file mode 100644 index 2abb49d2af..0000000000 --- a/include/eve/module/core/pedantic/impl/negabsmax.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negabsmax_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(negabsmax(a, b)) -{ - return arithmetic_call(pedantic(negabsmax), a, b); -} - -template -EVE_FORCEINLINE auto -negabsmax_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return minus(pedantic(absmax)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negabsmax_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) -{ - return minus(pedantic(eve::absmax)(a0, a1, args...)); -} -} diff --git a/include/eve/module/core/pedantic/impl/negabsmin.hpp b/include/eve/module/core/pedantic/impl/negabsmin.hpp deleted file mode 100644 index d81a0fbdf3..0000000000 --- a/include/eve/module/core/pedantic/impl/negabsmin.hpp +++ /dev/null @@ -1,52 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(negabsmin(a, b)) -{ - return arithmetic_call(pedantic(negabsmin), a, b); -} - -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return minus(pedantic(absmin)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negabsmin_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) --> decltype(negabsmin(a0, a1, args...)) -{ - return minus(pedantic(eve::absmin)(a0, a1, args...)); -} -} diff --git a/include/eve/module/core/pedantic/impl/negmaxabs.hpp b/include/eve/module/core/pedantic/impl/negmaxabs.hpp deleted file mode 100644 index 51a80af39d..0000000000 --- a/include/eve/module/core/pedantic/impl/negmaxabs.hpp +++ /dev/null @@ -1,52 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(maxabs(a, b)) -{ - return arithmetic_call(pedantic(negmaxabs), a, b); -} - -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return minus(pedantic(maxabs)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negmaxabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) --> decltype(negmaxabs(a0, a1, args...)) -{ - return minus(pedantic(eve::maxabs)(a0, a1, args...)); -} -} diff --git a/include/eve/module/core/pedantic/impl/negminabs.hpp b/include/eve/module/core/pedantic/impl/negminabs.hpp deleted file mode 100644 index f7d61c55f8..0000000000 --- a/include/eve/module/core/pedantic/impl/negminabs.hpp +++ /dev/null @@ -1,52 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T const& a, - U const& b) noexcept --> decltype(minabs(a, b)) -{ - return arithmetic_call(pedantic(negminabs), a, b); -} - -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T const& a, T const& b) noexcept -{ - return minus(pedantic(minabs)(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negminabs_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 a0, T1 a1, Ts... args) --> decltype(negminabs(a0, a1, args...)) -{ - return minus(pedantic(eve::minabs)(a0, a1, args...)); -} -} diff --git a/include/eve/module/core/pedantic/impl/simd/arm/neon/max.hpp b/include/eve/module/core/pedantic/impl/simd/arm/neon/max.hpp deleted file mode 100644 index 106cf627e0..0000000000 --- a/include/eve/module/core/pedantic/impl/simd/arm/neon/max.hpp +++ /dev/null @@ -1,32 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE wide - max_(EVE_SUPPORTS(neon128_), - pedantic_type const&, - wide const &a0, - wide const &a1) noexcept requires arm_abi> -{ - auto tmp = eve::max(a0, a1); - if constexpr( eve::platform::supports_invalids ) tmp = if_else(is_nan(a1), a0, tmp); - return if_else(is_eqz(a0) && is_eqz(a1), bit_and(a0, a1), tmp); -} -} diff --git a/include/eve/module/core/pedantic/impl/simd/arm/neon/min.hpp b/include/eve/module/core/pedantic/impl/simd/arm/neon/min.hpp deleted file mode 100644 index 09dfd6ff20..0000000000 --- a/include/eve/module/core/pedantic/impl/simd/arm/neon/min.hpp +++ /dev/null @@ -1,32 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE wide - min_(EVE_SUPPORTS(neon128_), - pedantic_type const&, - wide const &a0, - wide const &a1) noexcept requires arm_abi> -{ - auto tmp = eve::min(a0, a1); - if constexpr( eve::platform::supports_invalids ) tmp = if_else(is_nan(a1), a0, tmp); - return if_else(is_eqz(a0) && is_eqz(a1), bit_or(a0, a1), tmp); -} -} diff --git a/include/eve/module/core/pedantic/max.hpp b/include/eve/module/core/pedantic/max.hpp deleted file mode 100644 index 5236185e2f..0000000000 --- a/include/eve/module/core/pedantic/max.hpp +++ /dev/null @@ -1,15 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -#if defined(EVE_INCLUDE_ARM_HEADER) -# include -#endif diff --git a/include/eve/module/core/pedantic/maxabs.hpp b/include/eve/module/core/pedantic/maxabs.hpp deleted file mode 100644 index c822f63424..0000000000 --- a/include/eve/module/core/pedantic/maxabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/maxmag.hpp b/include/eve/module/core/pedantic/maxmag.hpp deleted file mode 100644 index 02c8fb4147..0000000000 --- a/include/eve/module/core/pedantic/maxmag.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/min.hpp b/include/eve/module/core/pedantic/min.hpp deleted file mode 100644 index 1cf3dcaab0..0000000000 --- a/include/eve/module/core/pedantic/min.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/minabs.hpp b/include/eve/module/core/pedantic/minabs.hpp deleted file mode 100644 index 18357d3f9a..0000000000 --- a/include/eve/module/core/pedantic/minabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/minmag.hpp b/include/eve/module/core/pedantic/minmag.hpp deleted file mode 100644 index 843e5d2d3f..0000000000 --- a/include/eve/module/core/pedantic/minmag.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/negabsmax.hpp b/include/eve/module/core/pedantic/negabsmax.hpp deleted file mode 100644 index 7fde328613..0000000000 --- a/include/eve/module/core/pedantic/negabsmax.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/negabsmin.hpp b/include/eve/module/core/pedantic/negabsmin.hpp deleted file mode 100644 index f316266deb..0000000000 --- a/include/eve/module/core/pedantic/negabsmin.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/negmaxabs.hpp b/include/eve/module/core/pedantic/negmaxabs.hpp deleted file mode 100644 index 82ce14a225..0000000000 --- a/include/eve/module/core/pedantic/negmaxabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/pedantic/negminabs.hpp b/include/eve/module/core/pedantic/negminabs.hpp deleted file mode 100644 index e99785b1d3..0000000000 --- a/include/eve/module/core/pedantic/negminabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/regular/absmax.hpp b/include/eve/module/core/regular/absmax.hpp index 377f69a4ae..6f4b18a4ca 100644 --- a/include/eve/module/core/regular/absmax.hpp +++ b/include/eve/module/core/regular/absmax.hpp @@ -7,10 +7,29 @@ //================================================================================================== #pragma once -#include +#include +#include +#include namespace eve { + template + struct absmax_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr + kumi::apply_traits_t + operator()(Tup const& t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(absmax_t, absmax_); + }; + //================================================================================================ //! @addtogroup core_arithmetic @@ -71,7 +90,7 @@ namespace eve //! //! @} //================================================================================================ -EVE_MAKE_CALLABLE(absmax_, absmax); +inline constexpr auto absmax = functor; } #include diff --git a/include/eve/module/core/regular/absmin.hpp b/include/eve/module/core/regular/absmin.hpp index e1c92aee16..1a34a98893 100644 --- a/include/eve/module/core/regular/absmin.hpp +++ b/include/eve/module/core/regular/absmin.hpp @@ -7,10 +7,29 @@ //================================================================================================== #pragma once -#include +#include +#include +#include namespace eve { + + template + struct absmin_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr kumi::apply_traits_t + operator()(Tup const& t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(absmin_t, absmin_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -70,7 +89,7 @@ namespace eve //! //! @} //================================================================================================ -EVE_MAKE_CALLABLE(absmin_, absmin); +inline constexpr auto absmin = functor; } #include diff --git a/include/eve/module/core/regular/impl/absmax.hpp b/include/eve/module/core/regular/impl/absmax.hpp index 0e244a6cdb..354bb34ccc 100644 --- a/include/eve/module/core/regular/impl/absmax.hpp +++ b/include/eve/module/core/regular/impl/absmax.hpp @@ -1,106 +1,21 @@ -//================================================================================================== +//====================================================================================================================== /* EVE - Expressive Vector Engine Copyright : EVE Project Contributors SPDX-License-Identifier: BSL-1.0 */ -//================================================================================================== +//====================================================================================================================== #pragma once - #include #include -#include #include namespace eve::detail { -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> decltype(eve::abs(eve::max(a, b))) -{ - return arithmetic_call(absmax, a, b); -} - -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept --> decltype(eve::abs(a)) -{ - if constexpr(has_native_abi_v) - return eve::abs(eve::max(a, b)); - else - return apply_over(absmax, a, b); -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), C const& cond, D const&, U const& t, V const& f) noexcept --> decltype(absmax(t, f)) -{ - return mask_op(cond, D()(eve::absmax), t, f); -} - -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), - C const& cond, - U const& t, - V const& f) noexcept --> decltype(absmax(t, f)) -{ - return mask_op(cond, eve::absmax, t, f); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmax_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> decltype(eve::abs(eve::max(a0, a1, args...))) -{ - return eve::abs(eve::max(a0, a1, args...)); -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -absmax_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return eve::abs(get<0>(tup)); - else return eve::abs(kumi::apply( [&](auto... m) { return max(m...); }, tup)); -} - -template -auto -absmax_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) -{ - if constexpr(std::same_as) + template + EVE_FORCEINLINE constexpr common_value_t + absmax_(EVE_REQUIRES(cpu_), O const & o, T0 r0, T1 r1, Ts... rs) noexcept { - if constexpr( kumi::size_v == 1) return eve::abs[d](get<0>(tup)); - else return eve::abs[d](kumi::apply( [&](auto... m) { return d(max)(m...); }, tup)); + return eve::abs[o.drop(pedantic2,numeric2)](eve::max[o.drop(saturated2)](r0, r1, rs...)); } - else - { - if constexpr( kumi::size_v == 1) return eve::abs(get<0>(tup)); - else return eve::abs(kumi::apply( [&](auto... m) { return d(max)(m...); }, tup)); - } -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), C const& cond, T0 a0, T1 a1, Ts... args) noexcept --> decltype(absmax(a0, a1, args...)) -{ - return mask_op(cond, eve::absmax, a0, a1, args...); -} - } diff --git a/include/eve/module/core/regular/impl/absmin.hpp b/include/eve/module/core/regular/impl/absmin.hpp index fab4d39fad..21ccf9822d 100644 --- a/include/eve/module/core/regular/impl/absmin.hpp +++ b/include/eve/module/core/regular/impl/absmin.hpp @@ -9,98 +9,14 @@ #include #include -#include #include namespace eve::detail { -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> decltype(eve::abs(eve::max(a, b))) -{ - return arithmetic_call(absmin, a, b); -} - -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept --> decltype(eve::abs(a)) -{ - if constexpr(has_native_abi_v) - return eve::abs(eve::min(a, b)); - else - return apply_over(absmin, a, b); -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), C const& cond, D const&, U const& t, V const& f) noexcept --> decltype(absmin(t, f)) -{ - return mask_op(cond, D()(eve::absmin), t, f); -} - -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), - C const& cond, - U const& t, - V const& f) noexcept --> decltype(absmin(t, f)) -{ - return mask_op(cond, eve::absmin, t, f); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmin_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> decltype(eve::abs(eve::min(a0, a1, args...))) -{ - return eve::abs(eve::min(a0, a1, args...)); -} -//================================================================================================ -// tuples -//================================================================================================ -template -auto -absmin_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return eve::abs(get<0>(tup)); - else return eve::abs(kumi::apply( [&](auto... m) { return min(m...); }, tup)); -} - - -template -auto -absmin_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) -{ - if constexpr(std::same_as) + template + EVE_FORCEINLINE constexpr common_value_t + absmin_(EVE_REQUIRES(cpu_), O const & o, T0 r0, T1 r1, Ts... rs) noexcept { - if constexpr( kumi::size_v == 1) return eve::abs[d](get<0>(tup)); - else return eve::abs[d](kumi::apply( [&](auto... m) { return d(min)(m...); }, tup)); + return eve::abs[o.drop(pedantic2,numeric2)](eve::min[o.drop(saturated2)](r0, r1, rs...)); } - else - { - if constexpr( kumi::size_v == 1) return eve::abs(get<0>(tup)); - else return eve::abs(kumi::apply( [&](auto... m) { return d(min)(m...); }, tup)); - } -} - -// ----------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), C const& cond, T0 a0, T1 a1, Ts... args) noexcept -->decltype(absmin(a0, a1, args...)) -{ - return mask_op(cond, eve::absmin, a0, a1, args...); -} - } diff --git a/include/eve/module/core/regular/impl/max.hpp b/include/eve/module/core/regular/impl/max.hpp index 392d3bc32a..57d3aa4b8c 100644 --- a/include/eve/module/core/regular/impl/max.hpp +++ b/include/eve/module/core/regular/impl/max.hpp @@ -12,104 +12,110 @@ #include #include #include +#include #include +#include +#include +#include #include #include +#include namespace eve::detail { -// ----------------------------------------------------------------------------------------------- -// Regular -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> common_value_t -{ - return arithmetic_call(max, a, b); -} + template + EVE_FORCEINLINE constexpr common_value_t + max_(EVE_REQUIRES(cpu_), O const & o, T0 r0, T1 r1, Ts... rs) noexcept + { + using r_t = common_value_t; + if constexpr(sizeof...(Ts) == 0) // 2 parameters + { + if constexpr( has_native_abi_v ) + { + constexpr bool is_scalar = scalar_value; + auto a0 = r_t(r0); + auto a1 = r_t(r1); -template -EVE_FORCEINLINE T -max_(EVE_SUPPORTS(cpu_), T const& a0, T const& a1) noexcept -{ - if constexpr(scalar_value) - return a0 < a1 ? a1 : a0; - else - return if_else(a0 < a1, a1, a0); -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(cpu_), - C const& cond, - U const& t, - V const& f) noexcept -{ - return mask_op(cond, eve::max, t, f); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -max_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> common_value_t -{ - using r_t = common_value_t; - r_t that(max(r_t(a0), r_t(a1))); - ((that = max(that, r_t(args))), ...); - return that; -} - -template -auto -max_(EVE_SUPPORTS(cpu_), D const &, Ts... args) noexcept -{ - return max(args...); -} - -//================================================================================================ -// N parameters masked -//================================================================================================ -template -auto max_(EVE_SUPPORTS(cpu_), C const & cond, T0 a0, T1 a1, Ts... args) noexcept -{ - return mask_op(cond, eve::max, a0, a1, args...); -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -max_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return max(m...); }, tup); -} - -template -auto -max_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return d(max)(m...); }, tup); -} - -//================================================================================================ -// Predicate case -//================================================================================================ -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(cpu_), Callable f) noexcept -{ - if constexpr( std::same_as ) return eve::max; - else if constexpr( std::same_as ) return eve::min; - else return [f](auto x, auto y) { return if_else(f(y, x), x, y); }; -} + if constexpr(O::contains(pedantic2)) //pedantic + { + if constexpr( integral_value ) return max(a0, a1); + else if constexpr( eve::platform::supports_invalids ) + { + if constexpr(is_scalar) + { + if( is_eqz(a0) && is_eqz(a1) ) return bit_and(a0, a1); + return is_unordered(a0, a1) ? a0 : eve::max(a0, a1); + } + else + { + auto tmp = if_else(is_unordered(a0, a1), a0, eve::max(a0, a1)); + return if_else(is_eqz(a0) && is_eqz(a1), bit_and(a0, a1), tmp); + } + } + else + { + if constexpr(is_scalar) + { + return (is_eqz(a0) && is_eqz(a1) ? bit_and(a0, a1) : eve::max(a0, a1)); + } + else { return if_else(is_eqz(a0) && is_eqz(a1), bit_and(a0, a1), eve::max(a0, a1)); } + } + } + else if constexpr(O::contains(numeric2)) // numeric + { + if constexpr( integral_value ) return max(a0, a1); + else if constexpr( eve::platform::supports_invalids ) + { + if constexpr(is_scalar) + { + if( is_eqz(a0) && is_eqz(a1) ) return bit_and(a0, a1); + return is_nan(a0) ? a1 : is_nan(a1) ? a0 : max(a0, a1); + } + else + { + auto tmp = if_else(is_nan(a0), a1, if_else(is_nan(a1), a0, max(a0, a1))); + return if_else(is_eqz(a0) && is_eqz(a1), bit_and(a0, a1), tmp); + } + } + else + { + if constexpr(is_scalar) + { + return (is_eqz(a0) && is_eqz(a1) ? bit_and(a0, a1) : eve::max(a0, a1)); + } + else { return if_else(is_eqz(a0) && is_eqz(a1), bit_and(a0, a1), eve::max(a0, a1)); } + } + } + else + { + if constexpr(is_scalar) return a0 < a1 ? a1 : a0; + else return if_else(a0 < a1, a1, a0); + } + } + else + return arithmetic_call(max[o], r_t(r0), r_t(r1)); + } + else // N > 2 parameters + { + auto m = max[o]; + r_t that(m(r_t(r0), r_t(r1))); + ((that = m(that, r_t(rs))), ...); + return that; + } + } + //================================================================================================ + // Predicate case + //================================================================================================ + template + EVE_FORCEINLINE constexpr auto + max_(EVE_REQUIRES(cpu_), O const &, Callable const & f) noexcept + { + if constexpr( std::same_as ) return eve::max; + else if constexpr( std::same_as ) return eve::min; + else + { + return [f](auto x, auto y){ return eve::if_else(f(y, x), x, y); }; + }; + } } diff --git a/include/eve/module/core/regular/impl/maxabs.hpp b/include/eve/module/core/regular/impl/maxabs.hpp index 57ef86ee40..c8777d509a 100644 --- a/include/eve/module/core/regular/impl/maxabs.hpp +++ b/include/eve/module/core/regular/impl/maxabs.hpp @@ -7,117 +7,17 @@ //================================================================================================== #pragma once -#include -#include -#include -#include -#include -#include #include #include - -#include +#include namespace eve::detail { -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> decltype(add(abs(a), abs(b))) -{ - return arithmetic_call(maxabs, a, b); -} - -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept -requires has_native_abi_v -{ - return eve::max(eve::abs(a), eve::abs(b)); -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), C const& cond, D const&, U const& t, V const& f) noexcept --> decltype(maxabs(t, f)) -{ - return mask_op(cond, D()(eve::maxabs), t, f); -} - -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), - C const& cond, - U const& t, - V const& f) noexcept --> decltype(maxabs(t, f)) -{ - return mask_op(cond, eve::maxabs, t, f); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -maxabs_(EVE_SUPPORTS(cpu_), D const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)) -{ - auto dma = D()(max); - using r_t = decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)); - r_t that(dma(r_t(eve::abs(a0)), r_t(eve::abs((a1))))); - ((that = dma(that, eve::abs(args))), ...); - return that; -} - -template -auto -maxabs_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)) -{ - using r_t = decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)); - r_t that(max(r_t(eve::abs((a0))), r_t(eve::abs((a1))))); - ((that = max(that, eve::abs(args))), ...); - return that; -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -maxabs_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return eve::abs(get<0>(tup)); - else return kumi::apply( [&](auto... m) { return maxabs(m...); }, tup); -} - -template -auto -maxabs_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return d(eve::abs)(get<0>(tup)); - else return kumi::apply( [&](auto... m) { return d(maxabs)(m...); }, tup); -} - -// ----------------------------------------------------------------------------------------------- -// N parameters Masked case -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), C const& cond, D const & d, T0 a0, T1 a1, Ts... args) noexcept --> decltype(maxabs(a0, a1, args...)) -{ - return mask_op(cond, d(eve::maxabs), a0, a1, args...); -} - -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), C const& cond, T0 a0, T1 a1, Ts... args) noexcept --> decltype(maxabs(a0, a1, args...)) -{ - return mask_op(cond, eve::maxabs, a0, a1, args...); -} + template + EVE_FORCEINLINE constexpr common_value_t + maxabs_(EVE_REQUIRES(cpu_), O const & o, T0 a0, T1 a1, Ts... as) noexcept + { + auto abso = abs[o.drop(pedantic2,numeric2)]; + return eve::max[o.drop(saturated2)](abso(a0), abso(a1), abso(as)...); + } } diff --git a/include/eve/module/core/regular/impl/maxmag.hpp b/include/eve/module/core/regular/impl/maxmag.hpp index 5c0479e934..b65b706d0d 100644 --- a/include/eve/module/core/regular/impl/maxmag.hpp +++ b/include/eve/module/core/regular/impl/maxmag.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -22,83 +21,47 @@ namespace eve::detail { -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> common_value_t -{ - return arithmetic_call(maxmag, a, b); -} -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept -{ - auto aa = eve::abs(a); - auto bb = eve::abs(b); - if constexpr( simd_value ) + template + EVE_FORCEINLINE constexpr common_value_t + maxmag_(EVE_REQUIRES(cpu_), O const & o, T0 a, T1 b, Ts... cs) noexcept { - auto tmp = if_else(is_not_greater_equal(aa, bb), b, eve::max(a, b)); - return if_else(is_not_greater_equal(bb, aa), a, tmp); + using r_t = common_value_t; + auto maxo = max[o.drop(saturated2)]; + auto abso = abs[saturated]; + if constexpr(sizeof...(Ts) == 0) // 2 parameters + { + if constexpr(O::contains(numeric2)) + { + auto aaa = if_else(is_nan(a), b, a); + auto bbb = if_else(is_nan(b), a, b); + return eve::maxmag[pedantic2](aaa, bbb); + } + if constexpr( has_native_abi_v ) + { + auto ra = r_t(a); + auto rb = r_t(b); + constexpr bool is_scalar = scalar_value; + auto aa = abso(ra); + auto bb = abso(rb); + if constexpr(is_scalar) + { + return aa < bb ? rb : bb < aa ? ra : maxo(ra, rb); + } + else + { + auto tmp = if_else(is_not_greater_equal(aa, bb), rb, maxo(ra, rb)); + return if_else(is_not_greater_equal(bb, aa), ra, tmp); + } + } + else + return arithmetic_call(maxmag[o], r_t(a), r_t(b)); + } + else // N > 2 parameters + { + r_t that(maxmag[o](r_t(a), r_t(b))); + ((that = eve::maxmag[o](that, r_t(cs))), ...); + return that; + } } - else { return aa < bb ? b : bb < aa ? a : eve::max(a, b); } -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), - C const& cond, - U t, - V ...f) noexcept -{ - return mask_op(cond, eve::maxmag, t, f...); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -maxmag_(EVE_SUPPORTS(cpu_), D const&, T0 a0, T1 a1, Ts... args) noexcept --> common_value_t -{ - using r_t = common_value_t; - r_t that(D()(maxmag)(r_t(a0), r_t(a1))); - ((that = D()(maxmag)(that, r_t(args))), ...); - return that; -} - -template -auto -maxmag_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> common_value_t -{ - using r_t = common_value_t; - r_t that(maxmag(r_t(a0), r_t(a1))); - ((that = maxmag(that, r_t(args))), ...); - return that; -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -maxmag_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return maxmag(m...); }, tup); -} - -template -auto -maxmag_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return d(maxmag)(m...); }, tup); -} - } diff --git a/include/eve/module/core/regular/impl/min.hpp b/include/eve/module/core/regular/impl/min.hpp index cef6d9b86c..4b631a7119 100644 --- a/include/eve/module/core/regular/impl/min.hpp +++ b/include/eve/module/core/regular/impl/min.hpp @@ -12,104 +12,96 @@ #include #include #include +#include #include +#include +#include #include #include #include namespace eve::detail { -// ----------------------------------------------------------------------------------------------- -// Regular -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> common_value_t -{ - return arithmetic_call(min, a, b); -} - -template -EVE_FORCEINLINE T -min_(EVE_SUPPORTS(cpu_), T const& a0, T const& a1) noexcept -{ - if constexpr(scalar_value) - return a0 < a1 ? a0 : a1; - else - return if_else(a0 < a1, a0, a1); -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(cpu_), - C const& cond, - U const& t, - V const& f) noexcept -> common_value_t -{ - return mask_op(cond, eve::min, t, f); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -min_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> common_value_t -{ - using r_t = common_value_t; - r_t that(min(r_t(a0), r_t(a1))); - ((that = min(that, r_t(args))), ...); - return that; -} - -template -auto -min_(EVE_SUPPORTS(cpu_), D const &, Ts... args) -{ - return min(args...); -} - -//================================================================================================ -// N parameters masked -//================================================================================================ -template -auto min_(EVE_SUPPORTS(cpu_), C const & cond, T0 a0, T1 a1, Ts... args) noexcept -{ - return mask_op(cond, eve::min, a0, a1, args...); -} -//================================================================================================ -// tuples -//================================================================================================ -template -auto -min_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return min(m...); }, tup); -} - -template -auto -min_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return d(min)(m...); }, tup); -} - -//================================================================================================ -// Predicate case -//================================================================================================ -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(cpu_), Callable f) -{ - if constexpr( std::same_as ) return eve::min; - else if constexpr( std::same_as ) return eve::max; - else return [f](auto x, auto y) { return if_else(f(y, x), y, x); }; -} + template + EVE_FORCEINLINE constexpr common_value_t + min_(EVE_REQUIRES(cpu_), O const & o, T0 r0, T1 r1, Ts... rs) noexcept + { + using r_t = common_value_t; + if constexpr(sizeof...(Ts) == 0) // 2 parameters + { + if constexpr( has_native_abi_v ) + { + constexpr bool is_scalar = scalar_value; + auto a0 = r_t(r0); + auto a1 = r_t(r1); + if constexpr(O::contains(pedantic2)) //pedantic + { + if constexpr( eve::platform::supports_invalids ) + { + if constexpr(is_scalar) + { + if( is_eqz(a0) && is_eqz(a1) ) return bit_or(a0, a1); + return is_unordered(a0, a1) ? a0 : eve::min(a0, a1); + } + else + { + auto tmp = if_else(is_unordered(a0, a1), a0, eve::min(a0, a1)); + return if_else(is_eqz(a0) && is_eqz(a1), bit_or(a0, a1), tmp); + } + } + else + { + if constexpr(is_scalar) return (is_eqz(a0) && is_eqz(a1) ? bit_or(a0, a1) : eve::min(a0, a1)); + else return if_else(is_eqz(a0) && is_eqz(a1), bit_or(a0, a1), eve::min(a0, a1)); + } + } + else if constexpr(O::contains(numeric2)) // numeric + { + if constexpr( eve::platform::supports_invalids ) + { + if constexpr(is_scalar) + { + if( is_eqz(a0) && is_eqz(a1) ) return bit_or(a0, a1); + return is_nan(a0) ? a1 : is_nan(a1) ? a0 : min(a0, a1); + } + else + { + auto tmp = if_else(is_nan(a0), a1, if_else(is_nan(a1), a0, min(a0, a1))); + return if_else(is_eqz(a0) && is_eqz(a1), bit_or(a0, a1), tmp); + } + } + else + { + if constexpr(is_scalar) return (is_eqz(a0) && is_eqz(a1) ? bit_or(a0, a1) : eve::min(a0, a1)); + else return if_else(is_eqz(a0) && is_eqz(a1), bit_or(a0, a1), eve::min(a0, a1)); + } + } + else + { + if constexpr(is_scalar) return a0 < a1 ? a0: a1; + else return if_else(a0 < a1, a0, a1); + } + } + else return arithmetic_call(min[o], r_t(r0), r_t(r1)); + } + else // N > 2 parameters + { + auto m = min[o]; + r_t that(m(r_t(r0), r_t(r1))); + ((that = m(that, r_t(rs))), ...); + return that; + } + } + //================================================================================================ + // Predicate case + //================================================================================================ + template + EVE_FORCEINLINE constexpr auto + min_(EVE_REQUIRES(cpu_), O const &, Callable const& f) noexcept + { + if constexpr( std::same_as ) return eve::min; + else if constexpr( std::same_as ) return eve::max; + else return [f](auto x, auto y){ return eve::if_else(f(y, x), y, x); }; + } } diff --git a/include/eve/module/core/regular/impl/minabs.hpp b/include/eve/module/core/regular/impl/minabs.hpp index 596cfa85a3..394661b6b4 100644 --- a/include/eve/module/core/regular/impl/minabs.hpp +++ b/include/eve/module/core/regular/impl/minabs.hpp @@ -6,118 +6,17 @@ */ //================================================================================================== #pragma once - -#include -#include -#include -#include -#include -#include #include #include - -#include +#include namespace eve::detail { -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> decltype(add(abs(a), abs(b))) -{ - return arithmetic_call(minabs, a, b); -} - -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept -requires has_native_abi_v -{ - return eve::min(eve::abs(a), eve::abs(b)); -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), C const& cond, D const&, U const& t, V const& f) noexcept --> decltype(minabs(t, f)) -{ - return mask_op(cond, D()(eve::minabs), t, f); -} - -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), - C const& cond, - U const& t, - V const& f) noexcept --> decltype(minabs(t, f)) -{ - return mask_op(cond, eve::minabs, t, f); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -minabs_(EVE_SUPPORTS(cpu_), D const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)) -{ - auto dma = D()(min); - using r_t = decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)); - r_t that(dma(r_t(eve::abs(a0)), r_t(eve::abs((a1))))); - ((that = dma(that, eve::abs(args))), ...); - return that; -} - -template -auto -minabs_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)) -{ - using r_t = decltype(eve::add(eve::abs(a0), eve::abs(a1), eve::abs(args)...)); - r_t that(min(r_t(eve::abs(a0)), r_t(eve::abs((a1))))); - ((that = min(that, eve::abs(args))), ...); - return that; -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -minabs_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return eve::abs(get<0>(tup)); - else return kumi::apply( [&](auto... m) { return minabs(m...); }, tup); -} - -template -auto -minabs_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return d(eve::abs)(get<0>(tup)); - else return kumi::apply( [&](auto... m) { return d(minabs)(m...); }, tup); -} - -// ----------------------------------------------------------------------------------------------- -// N parameters Masked case -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), C const& cond, D const & d, T0 a0, T1 a1, Ts... args) noexcept --> decltype(minabs(a0, a1, args...)) -{ - return mask_op(cond, d(eve::minabs), a0, a1, args...); -} - -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), C const& cond, T0 a0, T1 a1, Ts... args) noexcept --> decltype(minabs(a0, a1, args...)) -{ - return mask_op(cond, eve::minabs, a0, a1, args...); -} + template + EVE_FORCEINLINE constexpr common_value_t + minabs_(EVE_REQUIRES(cpu_), O const & o, T0 a0, T1 a1, Ts... as) noexcept + { + auto abso = abs[o.drop(pedantic2,numeric2)]; + return eve::min[o.drop(saturated2)](abso(a0), abso(a1), abso(as)...); + } } diff --git a/include/eve/module/core/regular/impl/minmag.hpp b/include/eve/module/core/regular/impl/minmag.hpp index 0310cf564d..e7ed544bcf 100644 --- a/include/eve/module/core/regular/impl/minmag.hpp +++ b/include/eve/module/core/regular/impl/minmag.hpp @@ -21,85 +21,46 @@ namespace eve::detail { -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept --> common_value_t -{ - return arithmetic_call(minmag, a, b); -} -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept -{ - auto aa = eve::abs(a); - auto bb = eve::abs(b); - if constexpr( simd_value ) + template + EVE_FORCEINLINE constexpr common_value_t + minmag_(EVE_REQUIRES(cpu_), O const & o, T0 a, T1 b, Ts... cs) noexcept { - auto tmp = if_else(is_not_greater_equal(bb, aa), b, eve::min(a, b)); - return if_else(is_not_greater_equal(aa, bb), a, tmp); + using r_t = common_value_t; + auto mino = min[o.drop(saturated2)]; + auto abso = abs[saturated]; + if constexpr(sizeof...(Ts) == 0) // 2 parameters + { + if constexpr(O::contains(numeric2)) + { + auto aaa = if_else(is_nan(a), b, a); + auto bbb = if_else(is_nan(b), a, b); + return eve::minmag[pedantic2](aaa, bbb); + } + if constexpr( has_native_abi_v ) + { + auto ra = r_t(a); + auto rb = r_t(b); + constexpr bool is_scalar = scalar_value; + auto aa = abso(ra); + auto bb = abso(rb); + if constexpr(is_scalar) + { + return aa < bb ? ra : bb < aa ? rb : mino(ra, rb); + } + else + { + auto tmp = if_else(is_not_less_equal(aa, bb), rb, mino(ra, rb)); + return if_else(is_not_less_equal(bb, aa), ra, tmp); + } + } + else return arithmetic_call(minmag[o], r_t(a), r_t(b)); + } + else // N > 2 parameters + { + r_t that(minmag[o](r_t(a), r_t(b))); + ((that = eve::minmag[o](that, r_t(cs))), ...); + return that; + } } - else { return aa < bb ? a : bb < aa ? b : eve::min(a, b); } -} - -//================================================================================================ -// Masked case -//================================================================================================ -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), - C const& cond, - U t, - V ...f) noexcept -{ - return mask_op(cond, eve::minmag, t, f...); -} - - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -minmag_(EVE_SUPPORTS(cpu_), D const&, T0 a0, T1 a1, Ts... args) noexcept --> common_value_t -{ - using r_t = common_value_t; - r_t that(D()(minmag)(r_t(a0), r_t(a1))); - ((that = D()(minmag)(that, r_t(args))), ...); - return that; -} - -template -auto -minmag_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args) noexcept --> common_value_t -{ - using r_t = common_value_t; - r_t that(minmag(r_t(a0), r_t(a1))); - ((that = minmag(that, r_t(args))), ...); - return that; -} - - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -minmag_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return minmag(m...); }, tup); -} - -template -auto -minmag_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return get<0>(tup); - else return kumi::apply( [&](auto... m) { return d(minmag)(m...); }, tup); -} - } diff --git a/include/eve/module/core/regular/impl/minmax.hpp b/include/eve/module/core/regular/impl/minmax.hpp deleted file mode 100644 index cc796c424e..0000000000 --- a/include/eve/module/core/regular/impl/minmax.hpp +++ /dev/null @@ -1,92 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -constexpr bool prefer_min_max() noexcept -{ - if constexpr( scalar_value ) return true; - else - { - constexpr bool is_ints64 = match(categorize(), - category::int64x4, category::uint64x4, - category::int64x2, category::uint64x2); - - // AVX is fine for non-64 bits as its min/max on other types has been fixed - if constexpr( x86_tag ) return current_api == avx512 || !is_ints64; - else if constexpr( arm_tag ) return !is_ints64; - else return true; - } -} - -// ----- Regular -template -EVE_FORCEINLINE auto -minmax_(EVE_SUPPORTS(cpu_), T0 v0, T1 v1, Ts... vs) noexcept - -> decltype(kumi::tuple {eve::min(v0, v1, vs...), eve::max(v0, v1, vs...)}) -{ - if constexpr( prefer_min_max>() ) - { - return kumi::tuple {eve::min(v0, v1, vs...), eve::max(v0, v1, vs...)}; - } - else - { - // If there is no native min/max, we compute the check once - // We use > cause it is more often optimized than < - auto check = v0 > v1; - return kumi::tuple {if_else(check, v1, v0, vs...), if_else(check, v0, v1, vs...)}; - } -} - -// ----- Masked case -template -EVE_FORCEINLINE auto -minmax_(EVE_SUPPORTS(cpu_), C const& c, T0 v0, T1 v1, Ts... vs) noexcept - -> decltype(kumi::tuple {eve::min[c](v0, v1, vs...), eve::max[c](v0, v1, vs...)}) -{ - return kumi::tuple {eve::min[c](v0, v1, vs...), eve::max[c](v0, v1, vs...)}; -} - -// ----- Tuple case -template -EVE_FORCEINLINE auto -minmax_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -> decltype(kumi::tuple {eve::min(tup), eve::max(tup)}) -{ - return kumi::apply([&](auto... m) { return minmax(m...); }, tup); -} - -// ----- Predicate case -template -EVE_FORCEINLINE auto -minmax_(EVE_SUPPORTS(cpu_), Callable f) -{ - if constexpr( std::same_as ) return eve::minmax; - else if constexpr( std::same_as ) - { - return [](auto x, auto y) { return kumi::reorder<1,0>(minmax(x,y)); }; - } - else - { - return [f](auto x, auto y) - { - auto check = f(y, x); - return kumi::tuple {if_else(check, y, x), if_else(check, x, y)}; - }; - } -} -} diff --git a/include/eve/module/core/regular/impl/negabsmax.hpp b/include/eve/module/core/regular/impl/negabsmax.hpp index c424d42af9..b44b36a4c9 100644 --- a/include/eve/module/core/regular/impl/negabsmax.hpp +++ b/include/eve/module/core/regular/impl/negabsmax.hpp @@ -7,57 +7,24 @@ //================================================================================================== #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include -#include - namespace eve::detail { - -template -EVE_FORCEINLINE auto -negabsmax_(EVE_SUPPORTS(cpu_), Ts... args) noexcept --> decltype(absmax(args...)) -{ - return minus(absmax(args...)); -} - -template -EVE_FORCEINLINE auto -negabsmax_(EVE_SUPPORTS(cpu_), C const & c, T0 t0, Ts... args) noexcept --> decltype(if_else(c, negabsmax(t0, args...), t0)) -{ - return minus[c](absmax[c](t0, args...)); -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -negabsmax_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return minus(abs(get<0>(tup))); - else return kumi::apply( [&](auto... m) { return negabsmax(m...); }, tup); -} - -template -auto -negabsmax_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return -d(eve::abs)(get<0>(tup)); - else return minus(kumi::apply( [&](auto... m) { return d(absmax)(m...); }, tup)); -} - + template + EVE_FORCEINLINE constexpr common_value_t + negabsmax_(EVE_REQUIRES(cpu_), O const & o, T0 r0, T1 r1, Ts... rs) noexcept + { + if constexpr(O::contains(saturated2)) + { + auto tmp1 = rbr::drop(saturated2, o); + auto omax = options{tmp1}; + + return minus(absmax[omax](r0, r1, rs...)); + } + else + return minus(absmax[o](r0, r1, rs...)); + } } diff --git a/include/eve/module/core/regular/impl/negabsmin.hpp b/include/eve/module/core/regular/impl/negabsmin.hpp index 502ae27c07..25a4a26f33 100644 --- a/include/eve/module/core/regular/impl/negabsmin.hpp +++ b/include/eve/module/core/regular/impl/negabsmin.hpp @@ -7,56 +7,26 @@ //================================================================================================== #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include #include namespace eve::detail { - -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), Ts... args) noexcept --> decltype(absmax(args...)) -{ - return minus(absmin(args...)); -} - -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), C const & c, T0 t0, Ts... args) noexcept --> decltype(if_else(c, negabsmin(t0, args...), t0)) -{ - return minus[c](absmin[c](t0, args...)); -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -negabsmin_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return minus(get<0>(tup)); - else return kumi::apply( [&](auto... m) { return negabsmin(m...); }, tup); -} - -template -auto -negabsmin_(EVE_SUPPORTS(cpu_), D const & d, Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return -d(eve::abs)(get<0>(tup)); - else return minus(kumi::apply( [&](auto... m) { return d(absmin)(m...); }, tup)); -} - + template + EVE_FORCEINLINE constexpr common_value_t + negabsmin_(EVE_REQUIRES(cpu_), O const & o, T0 r0, T1 r1, Ts... rs) noexcept + { + if constexpr(O::contains(saturated2)) + { + auto tmp1 = rbr::drop(saturated2, o); + auto omin = options{tmp1}; + + return minus(absmin[omin](r0, r1, rs...)); + } + else + return minus(absmin[o](r0, r1, rs...)); + } } diff --git a/include/eve/module/core/regular/impl/negmaxabs.hpp b/include/eve/module/core/regular/impl/negmaxabs.hpp index 2a727712fa..dd88b04f41 100644 --- a/include/eve/module/core/regular/impl/negmaxabs.hpp +++ b/include/eve/module/core/regular/impl/negmaxabs.hpp @@ -7,47 +7,16 @@ //================================================================================================== #pragma once -#include #include #include +#include namespace eve::detail { - -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), Ts... args) noexcept --> decltype(minus(maxabs(args...))) -{ - return minus(maxabs(args...)); -} - -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), C const & c, T0 t0, Ts... args) noexcept --> decltype(if_else(c, negmaxabs(t0, args...), t0)) -{ - return minus[c](maxabs[c](t0, args...)); -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -negmaxabs_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return minus(abs(get<0>(tup))); - else return kumi::apply( [&](auto... m) { return negmaxabs(m...); }, tup); -} - - -template -auto -negmaxabs_(EVE_SUPPORTS(cpu_), D const & d , Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return minus(abs(get<0>(tup))); - else return minus(kumi::apply( [&](auto... m) { return d(maxabs)(m...); }, tup)); -} - + template + EVE_FORCEINLINE constexpr common_value_t + negmaxabs_(EVE_REQUIRES(cpu_), O const & o, T0 a0, T1 a1, Ts... as) noexcept + { + return eve::minus(maxabs[o](a0, a1, as...)); + } } diff --git a/include/eve/module/core/regular/impl/negminabs.hpp b/include/eve/module/core/regular/impl/negminabs.hpp index 5c71755097..5571117ed1 100644 --- a/include/eve/module/core/regular/impl/negminabs.hpp +++ b/include/eve/module/core/regular/impl/negminabs.hpp @@ -8,46 +8,15 @@ #pragma once #include -#include #include +#include namespace eve::detail { - -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), Ts... args) noexcept --> decltype(minus(minabs(args...))) -{ - return minus(minabs(args...)); -} - -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), C const & c, T0 t0, Ts... args) noexcept --> decltype(if_else(c, negminabs(t0, args...), t0)) -{ - return minus[c](minabs[c](t0, args...)); -} - -//================================================================================================ -// tuples -//================================================================================================ -template -auto -negminabs_(EVE_SUPPORTS(cpu_), Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return minus(abs(get<0>(tup))); - else return kumi::apply( [&](auto... m) { return negminabs(m...); }, tup); -} - - -template -auto -negminabs_(EVE_SUPPORTS(cpu_), D const & d , Ts tup) noexcept -{ - if constexpr( kumi::size_v == 1) return minus(abs(get<0>(tup))); - else return minus(kumi::apply( [&](auto... m) { return d(minabs)(m...); }, tup)); -} - + template + EVE_FORCEINLINE constexpr common_value_t + negminabs_(EVE_REQUIRES(cpu_), O const & o, T0 a0, T1 a1, Ts... as) noexcept + { + return eve::minus(minabs[o](a0, a1, as...)); + } } diff --git a/include/eve/module/core/regular/impl/reduce.hpp b/include/eve/module/core/regular/impl/reduce.hpp index 4f23491021..65c9d12adb 100644 --- a/include/eve/module/core/regular/impl/reduce.hpp +++ b/include/eve/module/core/regular/impl/reduce.hpp @@ -32,8 +32,8 @@ find_reduction(Callable f, Option = 0) noexcept { if constexpr( std::same_as ) return eve::detail::sum; else if constexpr( std::same_as ) return eve::detail::sum; - else if constexpr( std::same_as ) return eve::minimum; - else if constexpr( std::same_as ) return eve::maximum; + else if constexpr( std::same_as ) return eve::minimum; + else if constexpr( std::same_as ) return eve::maximum; else if constexpr( std::same_as ) return eve::all; else if constexpr( std::same_as ) return eve::any; else if constexpr( std::same_as ) diff --git a/include/eve/module/core/regular/impl/simd/arm/neon/max.hpp b/include/eve/module/core/regular/impl/simd/arm/neon/max.hpp index f055bd342d..b2f1975e57 100644 --- a/include/eve/module/core/regular/impl/simd/arm/neon/max.hpp +++ b/include/eve/module/core/regular/impl/simd/arm/neon/max.hpp @@ -13,34 +13,42 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - max_(EVE_SUPPORTS(neon128_), - wide const &v0, - wide const &v1) noexcept requires arm_abi> -{ - constexpr auto cat = categorize>(); - - if constexpr( cat == category::int32x4 ) return vmaxq_s32(v0, v1); - else if constexpr( cat == category::int16x8 ) return vmaxq_s16(v0, v1); - else if constexpr( cat == category::int8x16 ) return vmaxq_s8(v0, v1); - else if constexpr( cat == category::uint32x4 ) return vmaxq_u32(v0, v1); - else if constexpr( cat == category::uint16x8 ) return vmaxq_u16(v0, v1); - else if constexpr( cat == category::uint8x16 ) return vmaxq_u8(v0, v1); - else if constexpr( cat == category::float32x4 ) return vmaxq_f32(v0, v1); - else if constexpr( cat == category::int32x2 ) return vmax_s32(v0, v1); - else if constexpr( cat == category::int16x4 ) return vmax_s16(v0, v1); - else if constexpr( cat == category::int8x8 ) return vmax_s8(v0, v1); - else if constexpr( cat == category::uint32x2 ) return vmax_u32(v0, v1); - else if constexpr( cat == category::uint16x4 ) return vmax_u16(v0, v1); - else if constexpr( cat == category::uint8x8 ) return vmax_u8(v0, v1); - else if constexpr( cat == category::float32x2 ) return vmax_f32(v0, v1); - else if constexpr( current_api >= asimd ) + template + EVE_FORCEINLINE wide max_(EVE_SUPPORTS(neon128_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires arm_abi> { - if constexpr( cat == category::float64x1 ) return vmax_f64(v0, v1); - else if constexpr( cat == category::float64x2 ) return vmaxq_f64(v0, v1); - else if constexpr( sizeof(T) == 8 ) return map(max, v0, v1); + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + { + return max_(EVE_TARGETS(cpu_), opts, v0, v1); + } + else + { + constexpr auto cat = categorize>(); + + if constexpr( cat == category::int32x4 ) return vmaxq_s32(v0, v1); + else if constexpr( cat == category::int16x8 ) return vmaxq_s16(v0, v1); + else if constexpr( cat == category::int8x16 ) return vmaxq_s8(v0, v1); + else if constexpr( cat == category::uint32x4 ) return vmaxq_u32(v0, v1); + else if constexpr( cat == category::uint16x8 ) return vmaxq_u16(v0, v1); + else if constexpr( cat == category::uint8x16 ) return vmaxq_u8(v0, v1); + else if constexpr( cat == category::float32x4 ) return vmaxq_f32(v0, v1); + else if constexpr( cat == category::int32x2 ) return vmax_s32(v0, v1); + else if constexpr( cat == category::int16x4 ) return vmax_s16(v0, v1); + else if constexpr( cat == category::int8x8 ) return vmax_s8(v0, v1); + else if constexpr( cat == category::uint32x2 ) return vmax_u32(v0, v1); + else if constexpr( cat == category::uint16x4 ) return vmax_u16(v0, v1); + else if constexpr( cat == category::uint8x8 ) return vmax_u8(v0, v1); + else if constexpr( cat == category::float32x2 ) return vmax_f32(v0, v1); + else if constexpr( current_api >= asimd ) + { + if constexpr( cat == category::float64x1 ) return vmax_f64(v0, v1); + else if constexpr( cat == category::float64x2 ) return vmaxq_f64(v0, v1); + else if constexpr( sizeof(T) == 8 ) return map(max, v0, v1); + } + else if constexpr( sizeof(T) == 8 ) return map(max, v0, v1); + } } - else if constexpr( sizeof(T) == 8 ) return map(max, v0, v1); -} } diff --git a/include/eve/module/core/regular/impl/simd/arm/neon/min.hpp b/include/eve/module/core/regular/impl/simd/arm/neon/min.hpp index 537d78a8a4..b2442268bb 100644 --- a/include/eve/module/core/regular/impl/simd/arm/neon/min.hpp +++ b/include/eve/module/core/regular/impl/simd/arm/neon/min.hpp @@ -13,34 +13,40 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - min_(EVE_SUPPORTS(neon128_), - wide const &v0, - wide const &v1) noexcept requires arm_abi> -{ - constexpr auto cat = categorize>(); - - if constexpr( cat == category::int32x4 ) return vminq_s32(v0, v1); - else if constexpr( cat == category::int16x8 ) return vminq_s16(v0, v1); - else if constexpr( cat == category::int8x16 ) return vminq_s8(v0, v1); - else if constexpr( cat == category::uint32x4 ) return vminq_u32(v0, v1); - else if constexpr( cat == category::uint16x8 ) return vminq_u16(v0, v1); - else if constexpr( cat == category::uint8x16 ) return vminq_u8(v0, v1); - else if constexpr( cat == category::float32x4 ) return vminq_f32(v0, v1); - else if constexpr( cat == category::int32x2 ) return vmin_s32(v0, v1); - else if constexpr( cat == category::int16x4 ) return vmin_s16(v0, v1); - else if constexpr( cat == category::int8x8 ) return vmin_s8(v0, v1); - else if constexpr( cat == category::uint32x2 ) return vmin_u32(v0, v1); - else if constexpr( cat == category::uint16x4 ) return vmin_u16(v0, v1); - else if constexpr( cat == category::uint8x8 ) return vmin_u8(v0, v1); - else if constexpr( cat == category::float32x2 ) return vmin_f32(v0, v1); - else if constexpr( current_api >= asimd ) + template + EVE_FORCEINLINE wide min_(EVE_REQUIRES(neon128_), + O const& opts, + wide const &v0, + wide const &v1) noexcept + requires arm_abi> { - if constexpr( cat == category::float64x1 ) return vmin_f64(v0, v1); - else if constexpr( cat == category::float64x2 ) return vminq_f64(v0, v1); - else if constexpr( sizeof(T) == 8 ) return map(min, v0, v1); + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return min_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + + if constexpr( cat == category::int32x4 ) return vminq_s32(v0, v1); + else if constexpr( cat == category::int16x8 ) return vminq_s16(v0, v1); + else if constexpr( cat == category::int8x16 ) return vminq_s8(v0, v1); + else if constexpr( cat == category::uint32x4 ) return vminq_u32(v0, v1); + else if constexpr( cat == category::uint16x8 ) return vminq_u16(v0, v1); + else if constexpr( cat == category::uint8x16 ) return vminq_u8(v0, v1); + else if constexpr( cat == category::float32x4 ) return vminq_f32(v0, v1); + else if constexpr( cat == category::int32x2 ) return vmin_s32(v0, v1); + else if constexpr( cat == category::int16x4 ) return vmin_s16(v0, v1); + else if constexpr( cat == category::int8x8 ) return vmin_s8(v0, v1); + else if constexpr( cat == category::uint32x2 ) return vmin_u32(v0, v1); + else if constexpr( cat == category::uint16x4 ) return vmin_u16(v0, v1); + else if constexpr( cat == category::uint8x8 ) return vmin_u8(v0, v1); + else if constexpr( cat == category::float32x2 ) return vmin_f32(v0, v1); + else if constexpr( current_api >= asimd ) + { + if constexpr( cat == category::float64x1 ) return vmin_f64(v0, v1); + else if constexpr( cat == category::float64x2 ) return vminq_f64(v0, v1); + else if constexpr( sizeof(T) == 8 ) return map(min, v0, v1); + } + else if constexpr( sizeof(T) == 8 ) return map(min, v0, v1); + } } - else if constexpr( sizeof(T) == 8 ) return map(min, v0, v1); -} } diff --git a/include/eve/module/core/regular/impl/simd/arm/sve/max.hpp b/include/eve/module/core/regular/impl/simd/arm/sve/max.hpp index 2ee27c9330..49f265c4cb 100644 --- a/include/eve/module/core/regular/impl/simd/arm/sve/max.hpp +++ b/include/eve/module/core/regular/impl/simd/arm/sve/max.hpp @@ -9,16 +9,20 @@ #include #include +#include #include -#include +#include namespace eve::detail { -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(sve_), wide const& a, wide const& b) noexcept -> wide -requires sve_abi> -{ - return svmax_z(sve_true(),a,b); -} + template + EVE_FORCEINLINE wide + max_(EVE_SUPPORTS(sve_), O const& opts, wide const& a, wide const& b) noexcept + requires sve_abi> + { + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return max_(EVE_TARGETS(cpu_), opts, a, b); + else + return svmax_z(sve_true(),a,b); + } } diff --git a/include/eve/module/core/regular/impl/simd/arm/sve/min.hpp b/include/eve/module/core/regular/impl/simd/arm/sve/min.hpp index ea4ce7cfcf..ae09565c5d 100644 --- a/include/eve/module/core/regular/impl/simd/arm/sve/min.hpp +++ b/include/eve/module/core/regular/impl/simd/arm/sve/min.hpp @@ -9,16 +9,20 @@ #include #include +#include #include -#include +#include namespace eve::detail { -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(sve_), wide const& a, wide const& b) noexcept -> wide -requires sve_abi> -{ - return svmin_z(sve_true(),a,b); -} + template + EVE_FORCEINLINE wide + min_(EVE_REQUIRES(sve_), O const& opts, wide const& a, wide const& b) noexcept + requires sve_abi> + { + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return min_(EVE_TARGETS(cpu_), opts, a, b); + else + return svmin_z(sve_true(),a,b); + } } diff --git a/include/eve/module/core/regular/impl/simd/ppc/max.hpp b/include/eve/module/core/regular/impl/simd/ppc/max.hpp index 5128c9292b..84021a8029 100644 --- a/include/eve/module/core/regular/impl/simd/ppc/max.hpp +++ b/include/eve/module/core/regular/impl/simd/ppc/max.hpp @@ -14,12 +14,15 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - max_(EVE_SUPPORTS(vmx_), - wide const &v0, - wide const &v1) noexcept requires ppc_abi> +template +EVE_FORCEINLINE wide max_(EVE_REQUIRES(vmx_), + O const &opts, + wide const &v0, + wide const &v1) noexcept requires ppc_abi> { - return vec_max(v0.storage(), v1.storage()); + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return max_(EVE_TARGETS(cpu_), opts, v0, v1); + else + return vec_max(v0.storage(), v1.storage()); } } diff --git a/include/eve/module/core/regular/impl/simd/ppc/min.hpp b/include/eve/module/core/regular/impl/simd/ppc/min.hpp index 86d3b08e46..990a966cdb 100644 --- a/include/eve/module/core/regular/impl/simd/ppc/min.hpp +++ b/include/eve/module/core/regular/impl/simd/ppc/min.hpp @@ -14,12 +14,15 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - min_(EVE_SUPPORTS(vmx_), - wide const &v0, - wide const &v1) noexcept requires ppc_abi> +template +EVE_FORCEINLINE wide min_(EVE_REQUIRES(vmx_), + O const &opts, + wide const &v0, + wide const &v1) noexcept requires ppc_abi> { - return vec_min(v0.storage(), v1.storage()); + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return min_(EVE_TARGETS(cpu_), opts, v0, v1); + else + return vec_min(v0.storage(), v1.storage()); } } diff --git a/include/eve/module/core/regular/impl/simd/x86/absmax.hpp b/include/eve/module/core/regular/impl/simd/x86/absmax.hpp index 8a023846f1..ae1fae674d 100644 --- a/include/eve/module/core/regular/impl/simd/x86/absmax.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/absmax.hpp @@ -14,53 +14,59 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - absmax_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_clear; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return absmax_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - absmax_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide absmax_(EVE_REQUIRES(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + { + return absmax_(EVE_TARGETS(cpu_), opts, v0, v1); + } + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_clear; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return absmax_(EVE_RETARGET(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide absmax_(EVE_REQUIRES(avx512_), + C const &cx, + O const &opts, + wide const &v, + wide const &w) noexcept + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_clear; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return absmax_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_clear; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return absmax_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return absmax_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/absmin.hpp b/include/eve/module/core/regular/impl/simd/x86/absmin.hpp index 63157bd549..ac7c772b95 100644 --- a/include/eve/module/core/regular/impl/simd/x86/absmin.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/absmin.hpp @@ -14,53 +14,57 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - absmin_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_clear; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return absmin_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - absmin_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide absmin_(EVE_REQUIRES(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return absmin_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_clear; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return absmin_(EVE_RETARGET(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide absmin_(EVE_REQUIRES(avx512_), + C const &cx, + O const &opts, + wide const &v, + wide const &w) noexcept + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_clear; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return absmin_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_clear; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return absmin_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return absmin_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/max.hpp b/include/eve/module/core/regular/impl/simd/x86/max.hpp index c98a661260..bd84fc6e58 100644 --- a/include/eve/module/core/regular/impl/simd/x86/max.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/max.hpp @@ -17,125 +17,131 @@ namespace eve::detail { -template -EVE_FORCEINLINE Wide -if_else_max(Wide x, Wide y) -{ - return eve::if_else(y > x, y, x); -} - -template -EVE_FORCEINLINE auto -max_(EVE_SUPPORTS(sse2_), wide v0, wide v1) noexcept -> wide -requires x86_abi> -{ - constexpr auto c = categorize>(); - - // 512 - if constexpr( c == category::float64x8 ) return _mm512_max_pd(v0, v1); - else if constexpr( c == category::float32x16 ) return _mm512_max_ps(v0, v1); - else if constexpr( c == category::int64x8 ) return _mm512_max_epi64(v0, v1); - else if constexpr( c == category::uint64x8 ) return _mm512_max_epu64(v0, v1); - else if constexpr( c == category::int32x16 ) return _mm512_max_epi32(v0, v1); - else if constexpr( c == category::uint32x16 ) return _mm512_max_epu32(v0, v1); - else if constexpr( c == category::int16x32 ) return _mm512_max_epi16(v0, v1); - else if constexpr( c == category::uint16x32 ) return _mm512_max_epu16(v0, v1); - else if constexpr( c == category::int8x64 ) return _mm512_max_epi8(v0, v1); - else if constexpr( c == category::uint8x64 ) return _mm512_max_epu8(v0, v1); + template + EVE_FORCEINLINE Wide + if_else_max(Wide x, Wide y) + { + return eve::if_else(y > x, y, x); + } - // 256 - else if constexpr( c == category::float64x4 ) return _mm256_max_pd(v0, v1); - else if constexpr( c == category::float32x8 ) return _mm256_max_ps(v0, v1); - // 256 - 64 bit ints - else if constexpr( current_api >= avx512 && c == category::int64x4 ) - return _mm256_max_epi64(v0, v1); - else if constexpr( current_api >= avx512 && c == category::uint64x4 ) - return _mm256_max_epu64(v0, v1); - else if constexpr( match(c, category::int64x4, category::uint64x4) ) - return detail::if_else_max(v0, v1); - // 256 - 32 bit ints - else if constexpr( current_api >= avx2 && c == category::int32x8 ) - return _mm256_max_epi32(v0, v1); - else if constexpr( current_api >= avx2 && c == category::uint32x8 ) - return _mm256_max_epu32(v0, v1); - else if constexpr( match(c, category::int32x8, category::uint32x8) ) - return aggregate(max, v0, v1); - // 256 - 16 bit ints - else if constexpr( current_api >= avx2 && c == category::int16x16 ) - return _mm256_max_epi16(v0, v1); - else if constexpr( current_api >= avx2 && c == category::uint16x16 ) - return _mm256_max_epu16(v0, v1); - else if constexpr( match(c, category::int16x16, category::uint16x16) ) - return aggregate(max, v0, v1); - // 256 - 8 bit ints - else if constexpr( current_api >= avx2 && c == category::int8x32 ) return _mm256_max_epi8(v0, v1); - else if constexpr( current_api >= avx2 && c == category::uint8x32 ) - return _mm256_max_epu8(v0, v1); - else if constexpr( match(c, category::int8x32, category::uint8x32) ) - return aggregate(max, v0, v1); + template + EVE_FORCEINLINE wide + max_(EVE_REQUIRES(sse2_), O const& opts, wide v0, wide v1) noexcept + requires x86_abi> + { + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return max_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto c = categorize>(); - // 128 - else if constexpr( c == category::float64x2 ) return _mm_max_pd(v0, v1); - else if constexpr( c == category::float32x4 ) return _mm_max_ps(v0, v1); - // 128 - 64 bit ints - else if constexpr( current_api >= avx512 && c == category::int64x2 ) return _mm_max_epi64(v0, v1); - else if constexpr( current_api >= avx512 && c == category::uint64x2 ) - return _mm_max_epu64(v0, v1); - else if constexpr( current_api >= sse4_2 && c == category::int64x2 ) - return detail::if_else_max(v0, v1); - else if constexpr( current_api >= sse4_2 && c == category::uint64x2 ) - return detail::if_else_max(v0, v1); - else if constexpr( match(c, category::int64x2, category::uint64x2) ) return map(max, v0, v1); - // 128 - 32 bit ints - else if constexpr( current_api >= sse4_1 && c == category::int32x4 ) return _mm_max_epi32(v0, v1); - else if constexpr( current_api >= sse4_1 && c == category::uint32x4 ) - return _mm_max_epu32(v0, v1); - else if constexpr( match(c, category::int32x4, category::uint32x4) ) - return detail::if_else_max(v0, v1); - // 128 - 16 bit ints - else if constexpr( c == category::int16x8 ) return _mm_max_epi16(v0, v1); - else if constexpr( current_api >= sse4_1 && c == category::uint16x8 ) - return _mm_max_epu16(v0, v1); - else if constexpr( c == category::uint16x8 ) return detail::if_else_max(v0, v1); - // 128 - 8 bit ints - else if constexpr( current_api >= sse4_1 && c == category::int8x16 ) return _mm_max_epi8(v0, v1); - else if constexpr( c == category::int8x16 ) return detail::if_else_max(v0, v1); - else if constexpr( c == category::uint8x16 ) return _mm_max_epu8(v0, v1); -} + // 512 + if constexpr( c == category::float64x8 ) return _mm512_max_pd(v0, v1); + else if constexpr( c == category::float32x16 ) return _mm512_max_ps(v0, v1); + else if constexpr( c == category::int64x8 ) return _mm512_max_epi64(v0, v1); + else if constexpr( c == category::uint64x8 ) return _mm512_max_epu64(v0, v1); + else if constexpr( c == category::int32x16 ) return _mm512_max_epi32(v0, v1); + else if constexpr( c == category::uint32x16 ) return _mm512_max_epu32(v0, v1); + else if constexpr( c == category::int16x32 ) return _mm512_max_epi16(v0, v1); + else if constexpr( c == category::uint16x32 ) return _mm512_max_epu16(v0, v1); + else if constexpr( c == category::int8x64 ) return _mm512_max_epi8(v0, v1); + else if constexpr( c == category::uint8x64 ) return _mm512_max_epu8(v0, v1); -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide -max_(EVE_SUPPORTS(sse2_), C const& cx, wide const& v, wide const& w) noexcept -requires x86_abi> -{ - constexpr auto c = categorize>(); + // 256 + else if constexpr( c == category::float64x4 ) return _mm256_max_pd(v0, v1); + else if constexpr( c == category::float32x8 ) return _mm256_max_ps(v0, v1); + // 256 - 64 bit ints + else if constexpr( current_api >= avx512 && c == category::int64x4 ) + return _mm256_max_epi64(v0, v1); + else if constexpr( current_api >= avx512 && c == category::uint64x4 ) + return _mm256_max_epu64(v0, v1); + else if constexpr( match(c, category::int64x4, category::uint64x4) ) + return detail::if_else_max(v0, v1); + // 256 - 32 bit ints + else if constexpr( current_api >= avx2 && c == category::int32x8 ) + return _mm256_max_epi32(v0, v1); + else if constexpr( current_api >= avx2 && c == category::uint32x8 ) + return _mm256_max_epu32(v0, v1); + else if constexpr( match(c, category::int32x8, category::uint32x8) ) + return aggregate(max, v0, v1); + // 256 - 16 bit ints + else if constexpr( current_api >= avx2 && c == category::int16x16 ) + return _mm256_max_epi16(v0, v1); + else if constexpr( current_api >= avx2 && c == category::uint16x16 ) + return _mm256_max_epu16(v0, v1); + else if constexpr( match(c, category::int16x16, category::uint16x16) ) + return aggregate(max, v0, v1); + // 256 - 8 bit ints + else if constexpr( current_api >= avx2 && c == category::int8x32 ) return _mm256_max_epi8(v0, v1); + else if constexpr( current_api >= avx2 && c == category::uint8x32 ) + return _mm256_max_epu8(v0, v1); + else if constexpr( match(c, category::int8x32, category::uint8x32) ) + return aggregate(max, v0, v1); - if constexpr( C::is_complete || abi_t::is_wide_logical ) - { - return max_(EVE_RETARGET(cpu_), cx, v, w); + // 128 + else if constexpr( c == category::float64x2 ) return _mm_max_pd(v0, v1); + else if constexpr( c == category::float32x4 ) return _mm_max_ps(v0, v1); + // 128 - 64 bit ints + else if constexpr( current_api >= avx512 && c == category::int64x2 ) return _mm_max_epi64(v0, v1); + else if constexpr( current_api >= avx512 && c == category::uint64x2 ) + return _mm_max_epu64(v0, v1); + else if constexpr( current_api >= sse4_2 && c == category::int64x2 ) + return detail::if_else_max(v0, v1); + else if constexpr( current_api >= sse4_2 && c == category::uint64x2 ) + return detail::if_else_max(v0, v1); + else if constexpr( match(c, category::int64x2, category::uint64x2) ) return map(max, v0, v1); + // 128 - 32 bit ints + else if constexpr( current_api >= sse4_1 && c == category::int32x4 ) return _mm_max_epi32(v0, v1); + else if constexpr( current_api >= sse4_1 && c == category::uint32x4 ) + return _mm_max_epu32(v0, v1); + else if constexpr( match(c, category::int32x4, category::uint32x4) ) + return detail::if_else_max(v0, v1); + // 128 - 16 bit ints + else if constexpr( c == category::int16x8 ) return _mm_max_epi16(v0, v1); + else if constexpr( current_api >= sse4_1 && c == category::uint16x8 ) + return _mm_max_epu16(v0, v1); + else if constexpr( c == category::uint16x8 ) return detail::if_else_max(v0, v1); + // 128 - 8 bit ints + else if constexpr( current_api >= sse4_1 && c == category::int8x16 ) return _mm_max_epi8(v0, v1); + else if constexpr( c == category::int8x16 ) return detail::if_else_max(v0, v1); + else if constexpr( c == category::uint8x16 ) return _mm_max_epu8(v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide + max_(EVE_SUPPORTS(avx512_), C const& cx, O const& opts, wide const& v, wide const& w) noexcept + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return max_(EVE_TARGETS(cpu_), cx, opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; - if constexpr( c == category::float32x16 ) return _mm512_mask_max_ps(src, m, v, w); - else if constexpr( c == category::float64x8 ) return _mm512_mask_max_pd(src, m, v, w); - else if constexpr( c == category::int8x64 ) return _mm512_mask_max_epi8(src, m, v, w); - else if constexpr( c == category::int8x32 ) return _mm256_mask_max_epi8(src, m, v, w); - else if constexpr( c == category::int8x16 ) return _mm_mask_max_epi8(src, m, v, w); - else if constexpr( c == category::int16x32 ) return _mm512_mask_max_epi16(src, m, v, w); - else if constexpr( c == category::int16x16 ) return _mm256_mask_max_epi16(src, m, v, w); - else if constexpr( c == category::int16x8 ) return _mm_mask_max_epi16(src, m, v, w); - else if constexpr( c == category::int32x16 ) return _mm512_mask_max_epi32(src, m, v, w); - else if constexpr( c == category::int32x8 ) return _mm256_mask_max_epi32(src, m, v, w); - else if constexpr( c == category::int32x4 ) return _mm_mask_max_epi32(src, m, v, w); - else if constexpr( c == category::int64x8 ) return _mm512_mask_max_epi64(src, m, v, w); - else if constexpr( c == category::int64x4 ) return _mm256_mask_max_epi64(src, m, v, w); - else if constexpr( c == category::int64x2 ) return _mm_mask_max_epi64(src, m, v, w); - else return max_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16) return _mm512_mask_max_ps (src, m, v, w); + if constexpr( c == category::float32x8 ) return _mm256_mask_max_ps (src, m, v, w); + if constexpr( c == category::float32x4 ) return _mm_mask_max_ps (src, m, v, w); + else if constexpr( c == category::float64x8 ) return _mm512_mask_max_pd (src, m, v, w); + else if constexpr( c == category::float64x4 ) return _mm256_mask_max_pd (src, m, v, w); + else if constexpr( c == category::float64x2 ) return _mm_mask_max_pd (src, m, v, w); + else if constexpr( c == category::int8x64 ) return _mm512_mask_max_epi8 (src, m, v, w); + else if constexpr( c == category::int8x32 ) return _mm256_mask_max_epi8 (src, m, v, w); + else if constexpr( c == category::int8x16 ) return _mm_mask_max_epi8 (src, m, v, w); + else if constexpr( c == category::int16x32 ) return _mm512_mask_max_epi16(src, m, v, w); + else if constexpr( c == category::int16x16 ) return _mm256_mask_max_epi16(src, m, v, w); + else if constexpr( c == category::int16x8 ) return _mm_mask_max_epi16 (src, m, v, w); + else if constexpr( c == category::int32x16 ) return _mm512_mask_max_epi32(src, m, v, w); + else if constexpr( c == category::int32x8 ) return _mm256_mask_max_epi32(src, m, v, w); + else if constexpr( c == category::int32x4 ) return _mm_mask_max_epi32 (src, m, v, w); + else if constexpr( c == category::int64x8 ) return _mm512_mask_max_epi64(src, m, v, w); + else if constexpr( c == category::int64x4 ) return _mm256_mask_max_epi64(src, m, v, w); + else if constexpr( c == category::int64x2 ) return _mm_mask_max_epi64 (src, m, v, w); + else return max_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/maxabs.hpp b/include/eve/module/core/regular/impl/simd/x86/maxabs.hpp index 80221537b4..d7cad74697 100644 --- a/include/eve/module/core/regular/impl/simd/x86/maxabs.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/maxabs.hpp @@ -14,53 +14,57 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - maxabs_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_clear; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return maxabs_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - maxabs_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide maxabs_(EVE_REQUIRES(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return maxabs_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_clear; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return maxabs_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide maxabs_(EVE_REQUIRES(avx512_), + C const &cx, + O const &opts, + wide const &v, + wide const &w) noexcept + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_clear; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return maxabs_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_clear; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return maxabs_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return maxabs_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/maxmag.hpp b/include/eve/module/core/regular/impl/simd/x86/maxmag.hpp index e7ea7a9d46..e053de08b1 100644 --- a/include/eve/module/core/regular/impl/simd/x86/maxmag.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/maxmag.hpp @@ -14,53 +14,56 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - maxmag_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_from_cmp; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return maxmag_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - maxmag_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide maxmag_(EVE_SUPPORTS(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return maxmag_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_from_cmp; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return maxmag_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide maxmag_(EVE_SUPPORTS(avx512_), + C const &cx, + O const &opts, + wide const &v, + wide const &w) noexcept + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_from_cmp; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return maxmag_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_from_cmp; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return maxmag_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return maxmag_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/min.hpp b/include/eve/module/core/regular/impl/simd/x86/min.hpp index fd5a861db9..d606d89cf3 100644 --- a/include/eve/module/core/regular/impl/simd/x86/min.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/min.hpp @@ -17,127 +17,132 @@ namespace eve::detail { -template -EVE_FORCEINLINE Wide -if_else_min(Wide x, Wide y) -{ - return eve::if_else(x > y, y, x); -} - -template -EVE_FORCEINLINE wide - min_(EVE_SUPPORTS(sse2_), wide v0, wide v1) -requires x86_abi> -{ - constexpr auto c = categorize>(); - - // 512 - if constexpr( c == category::float64x8 ) return _mm512_min_pd(v0, v1); - else if constexpr( c == category::float32x16 ) return _mm512_min_ps(v0, v1); - else if constexpr( c == category::int64x8 ) return _mm512_min_epi64(v0, v1); - else if constexpr( c == category::uint64x8 ) return _mm512_min_epu64(v0, v1); - else if constexpr( c == category::int32x16 ) return _mm512_min_epi32(v0, v1); - else if constexpr( c == category::uint32x16 ) return _mm512_min_epu32(v0, v1); - else if constexpr( c == category::int16x32 ) return _mm512_min_epi16(v0, v1); - else if constexpr( c == category::uint16x32 ) return _mm512_min_epu16(v0, v1); - else if constexpr( c == category::int8x64 ) return _mm512_min_epi8(v0, v1); - else if constexpr( c == category::uint8x64 ) return _mm512_min_epu8(v0, v1); + template + EVE_FORCEINLINE Wide + if_else_min(Wide x, Wide y) + { + return eve::if_else(x > y, y, x); + } - // 256 - else if constexpr( c == category::float64x4 ) return _mm256_min_pd(v0, v1); - else if constexpr( c == category::float32x8 ) return _mm256_min_ps(v0, v1); - // 256 - 64 bit ints - else if constexpr( current_api >= avx512 && c == category::int64x4 ) - return _mm256_min_epi64(v0, v1); - else if constexpr( current_api >= avx512 && c == category::uint64x4 ) - return _mm256_min_epu64(v0, v1); - else if constexpr( match(c, category::int64x4, category::uint64x4) ) - return detail::if_else_min(v0, v1); - // 256 - 32 bit ints - else if constexpr( current_api >= avx2 && c == category::int32x8 ) - return _mm256_min_epi32(v0, v1); - else if constexpr( current_api >= avx2 && c == category::uint32x8 ) - return _mm256_min_epu32(v0, v1); - else if constexpr( match(c, category::int32x8, category::uint32x8) ) - return aggregate(min, v0, v1); - // 256 - 16 bit ints - else if constexpr( current_api >= avx2 && c == category::int16x16 ) - return _mm256_min_epi16(v0, v1); - else if constexpr( current_api >= avx2 && c == category::uint16x16 ) - return _mm256_min_epu16(v0, v1); - else if constexpr( match(c, category::int16x16, category::uint16x16) ) - return aggregate(eve::min, v0, v1); - // 256 - 8 bit ints - else if constexpr( current_api >= avx2 && c == category::int8x32 ) return _mm256_min_epi8(v0, v1); - else if constexpr( current_api >= avx2 && c == category::uint8x32 ) - return _mm256_min_epu8(v0, v1); - else if constexpr( match(c, category::int8x32, category::uint8x32) ) - return aggregate(eve::min, v0, v1); + template + EVE_FORCEINLINE wide + min_(EVE_REQUIRES(sse2_), O const& opts, wide v0, wide v1) noexcept + requires x86_abi> + { + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return min_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto c = categorize>(); - // 128 - else if constexpr( c == category::float64x2 ) return _mm_min_pd(v0, v1); - else if constexpr( c == category::float32x4 ) return _mm_min_ps(v0, v1); - // 128 - 64 bit ints - else if constexpr( current_api >= avx512 && c == category::int64x2 ) return _mm_min_epi64(v0, v1); - else if constexpr( current_api >= avx512 && c == category::uint64x2 ) - return _mm_min_epu64(v0, v1); - else if constexpr( current_api >= sse4_2 && c == category::int64x2 ) - return detail::if_else_min(v0, v1); - else if constexpr( current_api >= sse4_2 && c == category::uint64x2 ) - return detail::if_else_min(v0, v1); - else if constexpr( match(c, category::int64x2, category::uint64x2) ) return map(min, v0, v1); - // 128 - 32 bit ints - else if constexpr( current_api >= sse4_1 && c == category::int32x4 ) return _mm_min_epi32(v0, v1); - else if constexpr( current_api >= sse4_1 && c == category::uint32x4 ) - return _mm_min_epu32(v0, v1); - else if constexpr( match(c, category::int32x4, category::uint32x4) ) - return detail::if_else_min(v0, v1); - // 128 - 16 bit ints - else if constexpr( c == category::int16x8 ) return _mm_min_epi16(v0, v1); - else if constexpr( current_api >= sse4_1 && c == category::uint16x8 ) - return _mm_min_epu16(v0, v1); - else if constexpr( c == category::uint16x8 ) return detail::if_else_min(v0, v1); - // 128 - 8 bit ints - else if constexpr( current_api >= sse4_1 && c == category::int8x16 ) return _mm_min_epi8(v0, v1); - else if constexpr( c == category::int8x16 ) return detail::if_else_min(v0, v1); - else if constexpr( c == category::uint8x16 ) return _mm_min_epu8(v0, v1); -} + // 512 + if constexpr( c == category::float64x8 ) return _mm512_min_pd(v0, v1); + else if constexpr( c == category::float32x16 ) return _mm512_min_ps(v0, v1); + else if constexpr( c == category::int64x8 ) return _mm512_min_epi64(v0, v1); + else if constexpr( c == category::uint64x8 ) return _mm512_min_epu64(v0, v1); + else if constexpr( c == category::int32x16 ) return _mm512_min_epi32(v0, v1); + else if constexpr( c == category::uint32x16 ) return _mm512_min_epu32(v0, v1); + else if constexpr( c == category::int16x32 ) return _mm512_min_epi16(v0, v1); + else if constexpr( c == category::uint16x32 ) return _mm512_min_epu16(v0, v1); + else if constexpr( c == category::int8x64 ) return _mm512_min_epi8(v0, v1); + else if constexpr( c == category::uint8x64 ) return _mm512_min_epu8(v0, v1); -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE auto -min_(EVE_SUPPORTS(sse2_), C const& cx, wide const& v, wide const& w) noexcept - -> wide -requires x86_abi> -{ - constexpr auto c = categorize>(); + // 256 + else if constexpr( c == category::float64x4 ) return _mm256_min_pd(v0, v1); + else if constexpr( c == category::float32x8 ) return _mm256_min_ps(v0, v1); + // 256 - 64 bit ints + else if constexpr( current_api >= avx512 && c == category::int64x4 ) + return _mm256_min_epi64(v0, v1); + else if constexpr( current_api >= avx512 && c == category::uint64x4 ) + return _mm256_min_epu64(v0, v1); + else if constexpr( match(c, category::int64x4, category::uint64x4) ) + return detail::if_else_min(v0, v1); + // 256 - 32 bit ints + else if constexpr( current_api >= avx2 && c == category::int32x8 ) + return _mm256_min_epi32(v0, v1); + else if constexpr( current_api >= avx2 && c == category::uint32x8 ) + return _mm256_min_epu32(v0, v1); + else if constexpr( match(c, category::int32x8, category::uint32x8) ) + return aggregate(min, v0, v1); + // 256 - 16 bit ints + else if constexpr( current_api >= avx2 && c == category::int16x16 ) + return _mm256_min_epi16(v0, v1); + else if constexpr( current_api >= avx2 && c == category::uint16x16 ) + return _mm256_min_epu16(v0, v1); + else if constexpr( match(c, category::int16x16, category::uint16x16) ) + return aggregate(eve::min, v0, v1); + // 256 - 8 bit ints + else if constexpr( current_api >= avx2 && c == category::int8x32 ) return _mm256_min_epi8(v0, v1); + else if constexpr( current_api >= avx2 && c == category::uint8x32 ) + return _mm256_min_epu8(v0, v1); + else if constexpr( match(c, category::int8x32, category::uint8x32) ) + return aggregate(eve::min, v0, v1); - if constexpr( C::is_complete || abi_t::is_wide_logical ) - { - return min_(EVE_RETARGET(cpu_), cx, v, w); + // 128 + else if constexpr( c == category::float64x2 ) return _mm_min_pd(v0, v1); + else if constexpr( c == category::float32x4 ) return _mm_min_ps(v0, v1); + // 128 - 64 bit ints + else if constexpr( current_api >= avx512 && c == category::int64x2 ) return _mm_min_epi64(v0, v1); + else if constexpr( current_api >= avx512 && c == category::uint64x2 ) + return _mm_min_epu64(v0, v1); + else if constexpr( current_api >= sse4_2 && c == category::int64x2 ) + return detail::if_else_min(v0, v1); + else if constexpr( current_api >= sse4_2 && c == category::uint64x2 ) + return detail::if_else_min(v0, v1); + else if constexpr( match(c, category::int64x2, category::uint64x2) ) return map(min, v0, v1); + // 128 - 32 bit ints + else if constexpr( current_api >= sse4_1 && c == category::int32x4 ) return _mm_min_epi32(v0, v1); + else if constexpr( current_api >= sse4_1 && c == category::uint32x4 ) + return _mm_min_epu32(v0, v1); + else if constexpr( match(c, category::int32x4, category::uint32x4) ) + return detail::if_else_min(v0, v1); + // 128 - 16 bit ints + else if constexpr( c == category::int16x8 ) return _mm_min_epi16(v0, v1); + else if constexpr( current_api >= sse4_1 && c == category::uint16x8 ) + return _mm_min_epu16(v0, v1); + else if constexpr( c == category::uint16x8 ) return detail::if_else_min(v0, v1); + // 128 - 8 bit ints + else if constexpr( current_api >= sse4_1 && c == category::int8x16 ) return _mm_min_epi8(v0, v1); + else if constexpr( c == category::int8x16 ) return detail::if_else_min(v0, v1); + else if constexpr( c == category::uint8x16 ) return _mm_min_epu8(v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE auto + min_(EVE_REQUIRES(avx512_), C const& cx, O const& opts, wide const& v, wide const& w) noexcept + -> wide + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return min_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; - if constexpr( c == category::float32x16 ) return _mm512_mask_min_ps(src, m, v, w); - else if constexpr( c == category::float64x8 ) return _mm512_mask_min_pd(src, m, v, w); - else if constexpr( c == category::int8x64 ) return _mm512_mask_min_epi8(src, m, v, w); - else if constexpr( c == category::int8x32 ) return _mm256_mask_min_epi8(src, m, v, w); - else if constexpr( c == category::int8x16 ) return _mm_mask_min_epi8(src, m, v, w); - else if constexpr( c == category::int16x32 ) return _mm512_mask_min_epi16(src, m, v, w); - else if constexpr( c == category::int16x16 ) return _mm256_mask_min_epi16(src, m, v, w); - else if constexpr( c == category::int16x8 ) return _mm_mask_min_epi16(src, m, v, w); - else if constexpr( c == category::int32x16 ) return _mm512_mask_min_epi32(src, m, v, w); - else if constexpr( c == category::int32x8 ) return _mm256_mask_min_epi32(src, m, v, w); - else if constexpr( c == category::int32x4 ) return _mm_mask_min_epi32(src, m, v, w); - else if constexpr( c == category::int64x8 ) return _mm512_mask_min_epi64(src, m, v, w); - else if constexpr( c == category::int64x4 ) return _mm256_mask_min_epi64(src, m, v, w); - else if constexpr( c == category::int64x2 ) return _mm_mask_min_epi64(src, m, v, w); - else return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16) return _mm512_mask_min_ps (src, m, v, w); + if constexpr( c == category::float32x8 ) return _mm256_mask_min_ps (src, m, v, w); + if constexpr( c == category::float32x4 ) return _mm_mask_min_ps (src, m, v, w); + else if constexpr( c == category::float64x8 ) return _mm512_mask_min_pd (src, m, v, w); + else if constexpr( c == category::float64x4 ) return _mm256_mask_min_pd (src, m, v, w); + else if constexpr( c == category::float64x2 ) return _mm_mask_min_pd (src, m, v, w); + else if constexpr( c == category::int8x64 ) return _mm512_mask_min_epi8 (src, m, v, w); + else if constexpr( c == category::int8x32 ) return _mm256_mask_min_epi8 (src, m, v, w); + else if constexpr( c == category::int8x16 ) return _mm_mask_min_epi8 (src, m, v, w); + else if constexpr( c == category::int16x32 ) return _mm512_mask_min_epi16(src, m, v, w); + else if constexpr( c == category::int16x16 ) return _mm256_mask_min_epi16(src, m, v, w); + else if constexpr( c == category::int16x8 ) return _mm_mask_min_epi16 (src, m, v, w); + else if constexpr( c == category::int32x16 ) return _mm512_mask_min_epi32(src, m, v, w); + else if constexpr( c == category::int32x8 ) return _mm256_mask_min_epi32(src, m, v, w); + else if constexpr( c == category::int32x4 ) return _mm_mask_min_epi32 (src, m, v, w); + else if constexpr( c == category::int64x8 ) return _mm512_mask_min_epi64(src, m, v, w); + else if constexpr( c == category::int64x4 ) return _mm256_mask_min_epi64(src, m, v, w); + else if constexpr( c == category::int64x2 ) return _mm_mask_min_epi64 (src, m, v, w); + else return min_(EVE_TARGETS(cpu_), opts, v, w); + } } } - -} diff --git a/include/eve/module/core/regular/impl/simd/x86/minabs.hpp b/include/eve/module/core/regular/impl/simd/x86/minabs.hpp index 9dbdf9e7d9..39dec305b0 100644 --- a/include/eve/module/core/regular/impl/simd/x86/minabs.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/minabs.hpp @@ -14,53 +14,56 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - minabs_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_clear; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return minabs_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - minabs_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide minabs_(EVE_REQUIRES(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return minabs_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_clear; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return minabs_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide minabs_(EVE_REQUIRES(avx512_), + C const & cx, + O const & opts, + wide const & v, + wide const & w) noexcept requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_clear; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return minabs_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_clear; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return minabs_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return minabs_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/minmag.hpp b/include/eve/module/core/regular/impl/simd/x86/minmag.hpp index 788fd3fa9c..40f35bdcae 100644 --- a/include/eve/module/core/regular/impl/simd/x86/minmag.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/minmag.hpp @@ -13,49 +13,58 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - minmag_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_from_cmp; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return minmag_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - minmag_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide minmag_(EVE_REQUIRES(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return minmag_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_from_cmp; + + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return minmag_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide minmag_(EVE_REQUIRES(avx512_), + C const &cx, + O const &opts, + wide const &v, + wide const &w) noexcept + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_from_cmp; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return minmag_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_from_cmp; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else return minmag_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4) return _mm_mask_range_ps (src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd (src, m, v, w, ctrl); + else return minmag_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/negabsmax.hpp b/include/eve/module/core/regular/impl/simd/x86/negabsmax.hpp index 8878d615ff..1816177f9c 100644 --- a/include/eve/module/core/regular/impl/simd/x86/negabsmax.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/negabsmax.hpp @@ -14,53 +14,57 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - negabsmax_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_set; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return negabsmax_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - negabsmax_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide negabsmax_(EVE_SUPPORTS(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return negabsmax_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_set; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return negabsmax_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide + negabsmax_(EVE_SUPPORTS(avx512_), + C const & cx, + O const & opts, + wide const & v, + wide const & w) noexcept requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_set; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return negabsmax_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::max | range_ctrl::sign_set; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return negabsmax_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return negabsmax_(EVE_TARGETS(cpu_), cx, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/negabsmin.hpp b/include/eve/module/core/regular/impl/simd/x86/negabsmin.hpp index 544bdcce4a..d547a02c4b 100644 --- a/include/eve/module/core/regular/impl/simd/x86/negabsmin.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/negabsmin.hpp @@ -14,53 +14,58 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - negabsmin_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_set; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return negabsmin_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - negabsmin_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide negabsmin_(EVE_REQUIRES(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return negabsmin_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_set; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return negabsmin_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide + negabsmin_(EVE_REQUIRES(avx512_), + C const & cx, + O const & opts, + wide const & v, + wide const & w) noexcept + requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_set; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return negabsmin_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::min | range_ctrl::sign_set; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return negabsmin_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return negabsmin_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/negmaxabs.hpp b/include/eve/module/core/regular/impl/simd/x86/negmaxabs.hpp index b31ec4f755..c63b5f2c2b 100644 --- a/include/eve/module/core/regular/impl/simd/x86/negmaxabs.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/negmaxabs.hpp @@ -14,53 +14,56 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - negmaxabs_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_set; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return negmaxabs_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - negmaxabs_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide negmaxabs_(EVE_SUPPORTS(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept + requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return maxabs_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_set; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return negmaxabs_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide negmaxabs_(EVE_SUPPORTS(avx512_), + C const & cx, + O const & opts, + wide const & v, + wide const & w) noexcept requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_set; + if constexpr(O::contains(numeric2) || O::contains(pedantic2) || O::contains(saturated2)) + return negmaxabs_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::absolute_max | range_ctrl::sign_set; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return negmaxabs_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return negmaxabs_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/impl/simd/x86/negminabs.hpp b/include/eve/module/core/regular/impl/simd/x86/negminabs.hpp index 5a35a5f09e..0994b63273 100644 --- a/include/eve/module/core/regular/impl/simd/x86/negminabs.hpp +++ b/include/eve/module/core/regular/impl/simd/x86/negminabs.hpp @@ -14,53 +14,55 @@ namespace eve::detail { -template -EVE_FORCEINLINE wide - negminabs_(EVE_SUPPORTS(avx512_), - wide const &v0, - wide const &v1) noexcept requires x86_abi> -{ - constexpr auto cat = categorize>(); - constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_set; - // float - if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); - else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); - // double - else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); - else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); - else return negminabs_(EVE_RETARGET(cpu_), v0, v1); -} - -// ----------------------------------------------------------------------------------------------- -// Masked case -template -EVE_FORCEINLINE wide - negminabs_(EVE_SUPPORTS(avx512_), - C const &cx, - wide const &v, - wide const &w) noexcept requires x86_abi> -{ - constexpr auto c = categorize>(); - - if constexpr( C::is_complete || abi_t::is_wide_logical ) + template + EVE_FORCEINLINE wide negminabs_(EVE_REQUIRES(avx512_), + O const & opts, + wide const & v0, + wide const & v1) noexcept requires x86_abi> { - return min_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return negminabs_(EVE_TARGETS(cpu_), opts, v0, v1); + else + { + constexpr auto cat = categorize>(); + constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_set; + // float + if constexpr( cat == category::float32x4 ) return _mm_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x8 ) return _mm256_range_ps(v0, v1, ctrl); + else if constexpr( cat == category::float32x16 ) return _mm512_range_ps(v0, v1, ctrl); + // double + else if constexpr( cat == category::float64x2 ) return _mm_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x4 ) return _mm256_range_pd(v0, v1, ctrl); + else if constexpr( cat == category::float64x8 ) return _mm512_range_pd(v0, v1, ctrl); + else return negminabs_(EVE_TARGETS(cpu_), v0, v1); + } } - else + + // ----------------------------------------------------------------------------------------------- + // Masked case + template + EVE_FORCEINLINE wide negminabs_(EVE_REQUIRES(avx512_), + C const & cx, + O const & opts, + wide const & v, + wide const &w) noexcept requires x86_abi> { - auto src = alternative(cx, v, as> {}); - auto m = expand_mask(cx, as> {}).storage().value; - constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_set; + if constexpr(O::contains(numeric2) || O::contains(pedantic2)) + return negminabs_(EVE_TARGETS(cpu_), opts, v, w); + else + { + constexpr auto c = categorize>(); + auto src = alternative(cx, v, as> {}); + auto m = expand_mask(cx, as> {}).storage().value; + constexpr auto ctrl = range_ctrl::absolute_min | range_ctrl::sign_set; - if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); - else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); - else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); - else return negminabs_(EVE_RETARGET(cpu_), cx, v, w); + if constexpr( c == category::float32x16 ) return _mm512_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x8 ) return _mm512_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x8 ) return _mm256_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x4 ) return _mm256_mask_range_pd(src, m, v, w, ctrl); + else if constexpr( c == category::float32x4 ) return _mm_mask_range_ps(src, m, v, w, ctrl); + else if constexpr( c == category::float64x2 ) return _mm_mask_range_pd(src, m, v, w, ctrl); + else return negminabs_(EVE_TARGETS(cpu_), opts, v, w); + } } } -} diff --git a/include/eve/module/core/regular/max.hpp b/include/eve/module/core/regular/max.hpp index 4aaf99968d..b013af0c42 100644 --- a/include/eve/module/core/regular/max.hpp +++ b/include/eve/module/core/regular/max.hpp @@ -8,10 +8,34 @@ #pragma once #include -#include +#include +#include namespace eve { + template + struct max_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T t, U u) const noexcept { return EVE_DISPATCH_CALL(t, u); } + + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr kumi::apply_traits_t + operator()(Tup const & t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + template + requires(!kumi::product_type && !eve::ordered_value) + EVE_FORCEINLINE constexpr auto operator()(Callable const & f) const noexcept { return EVE_DISPATCH_CALL(f); } + + EVE_CALLABLE_OBJECT(max_t, max_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -82,7 +106,7 @@ namespace eve //! @godbolt{doc/core/pedantic/max.cpp} //! @} //================================================================================================ -EVE_MAKE_CALLABLE(max_, max); +inline constexpr auto max = functor; } #include diff --git a/include/eve/module/core/regular/maxabs.hpp b/include/eve/module/core/regular/maxabs.hpp index 18293c8764..c1dc871ebb 100644 --- a/include/eve/module/core/regular/maxabs.hpp +++ b/include/eve/module/core/regular/maxabs.hpp @@ -8,10 +8,28 @@ #pragma once #include -#include +#include +#include namespace eve { + + template + struct maxabs_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr kumi::apply_traits_t + operator()(Tup t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(maxabs_t, maxabs_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -81,7 +99,7 @@ namespace eve //! @godbolt{doc/core/pedantic/maxabs.cpp} //! @} //================================================================================================ -EVE_MAKE_CALLABLE(maxabs_, maxabs); +inline constexpr auto maxabs = functor; } #include diff --git a/include/eve/module/core/regular/maxmag.hpp b/include/eve/module/core/regular/maxmag.hpp index effe228887..0e57530d24 100644 --- a/include/eve/module/core/regular/maxmag.hpp +++ b/include/eve/module/core/regular/maxmag.hpp @@ -8,10 +8,29 @@ #pragma once #include -#include +#include +#include namespace eve { + + template + struct maxmag_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr + kumi::apply_traits_t + operator()(Tup t) const noexcept { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(maxmag_t, maxmag_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -82,7 +101,7 @@ namespace eve //! @godbolt{doc/core/pedantic/maxmag.cpp} //! @} //================================================================================================ -EVE_MAKE_CALLABLE(maxmag_, maxmag); +inline constexpr auto maxmag = functor; } #include diff --git a/include/eve/module/core/regular/min.hpp b/include/eve/module/core/regular/min.hpp index 311ad83f92..5bbc789241 100644 --- a/include/eve/module/core/regular/min.hpp +++ b/include/eve/module/core/regular/min.hpp @@ -8,10 +8,35 @@ #pragma once #include -#include +#include +#include namespace eve { + template + struct min_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T t, U u) const noexcept { return EVE_DISPATCH_CALL(t, u); } + + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr kumi::apply_traits_t + operator()(Tup const & t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + template + requires(!kumi::product_type && !eve::ordered_value) + EVE_FORCEINLINE constexpr auto operator()(Callable const & f) const noexcept { return EVE_DISPATCH_CALL(f); } + + EVE_CALLABLE_OBJECT(min_t, min_); + }; + + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -81,7 +106,7 @@ namespace eve //! @godbolt{doc/core/pedantic/min.cpp} //! @} //================================================================================================ -EVE_MAKE_CALLABLE(min_, min); +inline constexpr auto min = functor; } #include @@ -101,4 +126,3 @@ EVE_MAKE_CALLABLE(min_, min); #if defined(EVE_INCLUDE_SVE_HEADER) # include #endif - diff --git a/include/eve/module/core/regular/minabs.hpp b/include/eve/module/core/regular/minabs.hpp index 1671860fa0..d8c80b66cc 100644 --- a/include/eve/module/core/regular/minabs.hpp +++ b/include/eve/module/core/regular/minabs.hpp @@ -8,10 +8,28 @@ #pragma once #include -#include +#include +#include namespace eve { + + template + struct minabs_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr kumi::apply_traits_t + operator()(Tup t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(minabs_t, minabs_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -81,7 +99,7 @@ namespace eve //! @godbolt{doc/core/pedantic/minabs.cpp} //! @} //================================================================================================ -EVE_MAKE_CALLABLE(minabs_, minabs); +inline constexpr auto minabs = functor; } #include diff --git a/include/eve/module/core/regular/minmag.hpp b/include/eve/module/core/regular/minmag.hpp index 7bb165c6fd..87b335065c 100644 --- a/include/eve/module/core/regular/minmag.hpp +++ b/include/eve/module/core/regular/minmag.hpp @@ -8,10 +8,28 @@ #pragma once #include -#include +#include +#include namespace eve { + template + struct minmag_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr + kumi::apply_traits_t + operator()(Tup t) const noexcept { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(minmag_t, minmag_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -82,7 +100,7 @@ namespace eve //! @godbolt{doc/core/pedantic/minmag.cpp} //! @} //================================================================================================ -EVE_MAKE_CALLABLE(minmag_, minmag); +inline constexpr auto minmag = functor; } #include diff --git a/include/eve/module/core/regular/minmax.hpp b/include/eve/module/core/regular/minmax.hpp index fae61930c7..c49fecf034 100644 --- a/include/eve/module/core/regular/minmax.hpp +++ b/include/eve/module/core/regular/minmax.hpp @@ -8,10 +8,41 @@ #pragma once #include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace eve { + template + struct minmax_t : tuple_callable + { + + template + EVE_FORCEINLINE constexpr kumi::tuple,common_value_t> + operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr + kumi::tuple, kumi::apply_traits_t> + operator()(Tup const & t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + + template + requires(!kumi::product_type && !eve::ordered_value) + EVE_FORCEINLINE constexpr auto operator()(Callable const & f) const noexcept { return EVE_DISPATCH_CALL(f); } + + EVE_CALLABLE_OBJECT(minmax_t, minmax_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -63,7 +94,72 @@ namespace eve //! //! @} //================================================================================================ -EVE_MAKE_CALLABLE(minmax_, minmax); -} +inline constexpr auto minmax = functor; -#include + namespace detail + { + template + constexpr bool prefer_min_max() noexcept + { + if constexpr( scalar_value ) return true; + else + { + constexpr bool is_ints64 = match(categorize(), + category::int64x4, category::uint64x4, + category::int64x2, category::uint64x2); + + // AVX is fine for non-64 bits as its min/max on other types has been fixed + if constexpr( x86_tag ) return current_api == avx512 || !is_ints64; + else if constexpr( arm_tag ) return !is_ints64; + else return true; + } + } + + + template + EVE_FORCEINLINE auto + minmax_(EVE_REQUIRES(cpu_), O const & , T0 v0, T1 v1, Ts... vs) noexcept + -> decltype(kumi::tuple {eve::min(v0, v1, vs...), eve::max(v0, v1, vs...)}) + { + if constexpr( prefer_min_max>() || sizeof...(Ts) > 0) + { + return kumi::tuple {eve::min(v0, v1, vs...), eve::max(v0, v1, vs...)}; + } + else + { + // If there is no native min/max, we compute the check once + // We use > cause it is more often optimized than < + auto check = v0 > v1; + return kumi::tuple {if_else(check, v1, v0), if_else(check, v0, v1)}; + } + } + + // ----- Predicate case + template + EVE_FORCEINLINE auto + minmax_(EVE_REQUIRES(cpu_), O const &, Callable f) + { + if constexpr( std::same_as ) return eve::minmax; + else if constexpr( std::same_as ) + { + return [](auto x, auto y) { return kumi::reorder<1,0>(minmax(x,y)); }; + } + else + { + return [f](auto x, auto y) + { + auto check = f(y, x); + return kumi::tuple {if_else(check, y, x), if_else(check, x, y)}; + }; + } + } + + template + EVE_FORCEINLINE auto + minmax_(EVE_REQUIRES(cpu_), C const& c, O const &, T0 v0, T1 v1, Ts... vs) noexcept + -> decltype(kumi::tuple {eve::min[c](v0, v1, vs...), eve::max[c](v0, v1, vs...)}) + { + return kumi::tuple {eve::min[c](v0, v1, vs...), eve::max[c](v0, v1, vs...)}; + } + } +} diff --git a/include/eve/module/core/regular/negabsmax.hpp b/include/eve/module/core/regular/negabsmax.hpp index 4accdb0bbb..e365d5520d 100644 --- a/include/eve/module/core/regular/negabsmax.hpp +++ b/include/eve/module/core/regular/negabsmax.hpp @@ -7,10 +7,30 @@ //================================================================================================== #pragma once -#include +#include +#include +#include namespace eve { + + template + struct negabsmax_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr + kumi::apply_traits_t + operator()(Tup t) const noexcept { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(negabsmax_t, negabsmax_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -70,7 +90,7 @@ namespace eve //! //! @} //================================================================================================ -EVE_MAKE_CALLABLE(negabsmax_, negabsmax); +inline constexpr auto negabsmax = functor; } #include diff --git a/include/eve/module/core/regular/negabsmin.hpp b/include/eve/module/core/regular/negabsmin.hpp index f8b340943f..1165d1ad35 100644 --- a/include/eve/module/core/regular/negabsmin.hpp +++ b/include/eve/module/core/regular/negabsmin.hpp @@ -7,10 +7,30 @@ //================================================================================================== #pragma once -#include +#include +#include +#include namespace eve { + + template + struct negabsmin_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr + kumi::apply_traits_t + operator()(Tup t) const noexcept { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(negabsmin_t, negabsmin_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -70,7 +90,7 @@ namespace eve //! //! @} //================================================================================================ -EVE_MAKE_CALLABLE(negabsmin_, negabsmin); +inline constexpr auto negabsmin = functor; } #include diff --git a/include/eve/module/core/regular/negmaxabs.hpp b/include/eve/module/core/regular/negmaxabs.hpp index c755c55703..e3d67479d5 100644 --- a/include/eve/module/core/regular/negmaxabs.hpp +++ b/include/eve/module/core/regular/negmaxabs.hpp @@ -7,10 +7,29 @@ //================================================================================================== #pragma once -#include +#include +#include +#include namespace eve { + + template + struct negmaxabs_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr kumi::apply_traits_t + operator()(Tup t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(negmaxabs_t, negmaxabs_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -68,7 +87,7 @@ namespace eve //! //! @} //================================================================================================ -EVE_MAKE_CALLABLE(negmaxabs_, negmaxabs); +inline constexpr auto negmaxabs = functor; } #include diff --git a/include/eve/module/core/regular/negminabs.hpp b/include/eve/module/core/regular/negminabs.hpp index 2c80e64878..a8c0b565a5 100644 --- a/include/eve/module/core/regular/negminabs.hpp +++ b/include/eve/module/core/regular/negminabs.hpp @@ -7,10 +7,28 @@ //================================================================================================== #pragma once -#include +#include +#include +#include namespace eve { + template + struct negminabs_t : tuple_callable + { + template + EVE_FORCEINLINE constexpr common_value_t operator()(T0 t0, T1 t1, Ts...ts) const noexcept + { + return EVE_DISPATCH_CALL(t0, t1, ts...); + } + + template + EVE_FORCEINLINE constexpr kumi::apply_traits_t + operator()(Tup t) const noexcept requires(kumi::size_v >= 2) { return EVE_DISPATCH_CALL(t); } + + EVE_CALLABLE_OBJECT(negminabs_t, negminabs_); + }; + //================================================================================================ //! @addtogroup core_arithmetic //! @{ @@ -68,7 +86,7 @@ namespace eve //! //! @} //================================================================================================ -EVE_MAKE_CALLABLE(negminabs_, negminabs); +inline constexpr auto negminabs = functor; } #include diff --git a/include/eve/module/core/saturated/absmax.hpp b/include/eve/module/core/saturated/absmax.hpp deleted file mode 100644 index a7fda529a6..0000000000 --- a/include/eve/module/core/saturated/absmax.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/absmin.hpp b/include/eve/module/core/saturated/absmin.hpp deleted file mode 100644 index 2001ddfaeb..0000000000 --- a/include/eve/module/core/saturated/absmin.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/core.hpp b/include/eve/module/core/saturated/core.hpp index c4cb032ac2..45c704165f 100644 --- a/include/eve/module/core/saturated/core.hpp +++ b/include/eve/module/core/saturated/core.hpp @@ -7,24 +7,15 @@ //================================================================================================== #pragma once -#include -#include + #include #include #include #include #include #include -#include -#include -#include -#include #include #include -#include -#include -#include -#include #include #include #include diff --git a/include/eve/module/core/saturated/impl/absmax.hpp b/include/eve/module/core/saturated/impl/absmax.hpp deleted file mode 100644 index 5eec4e7728..0000000000 --- a/include/eve/module/core/saturated/impl/absmax.hpp +++ /dev/null @@ -1,50 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(absmax(a, b)) -{ - return arithmetic_call(saturated(absmax), a, b); -} - -template -EVE_FORCEINLINE auto -absmax_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return eve::abs[saturated](eve::max(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmax_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(absmax(a0, a1, args...)) -{ - return eve::abs[saturated](eve::max(a0, a1, args...)); -} -} diff --git a/include/eve/module/core/saturated/impl/absmin.hpp b/include/eve/module/core/saturated/impl/absmin.hpp deleted file mode 100644 index b3ada95612..0000000000 --- a/include/eve/module/core/saturated/impl/absmin.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(absmin(a, b)) -{ - return arithmetic_call(saturated(absmin), a, b); -} - -template -EVE_FORCEINLINE auto -absmin_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return eve::abs[saturated](eve::min(a, b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -absmin_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(absmin(a0, a1, args...)) -{ - return eve::abs[saturated](eve::min(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/saturated/impl/maxabs.hpp b/include/eve/module/core/saturated/impl/maxabs.hpp deleted file mode 100644 index 5738361d32..0000000000 --- a/include/eve/module/core/saturated/impl/maxabs.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(maxabs(a, b)) -{ - return arithmetic_call(saturated(maxabs), a, b); -} - -template -EVE_FORCEINLINE auto -maxabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return eve::max(eve::abs[saturated](a), eve::abs[saturated](b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -maxabs_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(maxabs(a0, a1, args...)) -{ - auto sa = eve::abs[saturated]; - return eve::max(sa(a0), sa(a1), sa(args)...); -} -} diff --git a/include/eve/module/core/saturated/impl/maxmag.hpp b/include/eve/module/core/saturated/impl/maxmag.hpp deleted file mode 100644 index 107c5038ee..0000000000 --- a/include/eve/module/core/saturated/impl/maxmag.hpp +++ /dev/null @@ -1,47 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(maxmag(a, b)) -{ - return arithmetic_call(saturated(maxmag), a, b); -} - -template -EVE_FORCEINLINE auto -maxmag_(EVE_SUPPORTS(cpu_), saturated_type const&, T const& a, T const& b) noexcept -{ - auto aa = eve::abs[saturated](a); - auto bb = eve::abs[saturated](b); - if constexpr( simd_value ) - { - auto tmp = if_else(is_not_greater_equal(aa, bb), b, eve::max(a, b)); - return if_else(is_not_greater_equal(bb, aa), a, tmp); - } - else { return aa < bb ? b : bb < aa ? a : saturated(eve::max)(a, b); } -} -} diff --git a/include/eve/module/core/saturated/impl/minabs.hpp b/include/eve/module/core/saturated/impl/minabs.hpp deleted file mode 100644 index 4a9af11e72..0000000000 --- a/include/eve/module/core/saturated/impl/minabs.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(minabs(a, b)) -{ - return arithmetic_call(saturated(minabs), a, b); -} - -template -EVE_FORCEINLINE auto -minabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return eve::min(eve::abs[saturated](a), eve::abs[saturated](b)); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -minabs_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(minabs(a0, a1, args...)) -{ - auto sa = eve::abs[saturated]; - return eve::min(sa(a0), sa(a1), sa(args)...); -} -} diff --git a/include/eve/module/core/saturated/impl/minmag.hpp b/include/eve/module/core/saturated/impl/minmag.hpp deleted file mode 100644 index 43e7095cca..0000000000 --- a/include/eve/module/core/saturated/impl/minmag.hpp +++ /dev/null @@ -1,48 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(maxabs(a, b)) -{ - return arithmetic_call(saturated(minmag), a, b); -} - -template -EVE_FORCEINLINE auto -minmag_(EVE_SUPPORTS(cpu_), saturated_type const&, T const& a, T const& b) noexcept -{ - auto aa = eve::abs[saturated](a); - auto bb = eve::abs[saturated](b); - if constexpr( simd_value ) - { - auto tmp = if_else(is_not_greater_equal(bb, aa), b, eve::min(a, b)); - return if_else(is_not_greater_equal(aa, bb), a, tmp); - } - else { return aa < bb ? a : bb < aa ? b : eve::min(a, b); } -} -} diff --git a/include/eve/module/core/saturated/impl/negabsmax.hpp b/include/eve/module/core/saturated/impl/negabsmax.hpp deleted file mode 100644 index 5785ac395c..0000000000 --- a/include/eve/module/core/saturated/impl/negabsmax.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negabsmax_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(negabsmax(a, b)) -{ - return arithmetic_call(saturated(negabsmax), a, b); -} - -template -EVE_FORCEINLINE auto -negabsmax_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return saturated(minus)(eve::abs[saturated](eve::max(a, b))); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negabsmax_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(negabsmax(a0, a1, args...)) -{ - return saturated(minus)(eve::abs[saturated](eve::max(a0, a1, args...))); -} - -} diff --git a/include/eve/module/core/saturated/impl/negabsmin.hpp b/include/eve/module/core/saturated/impl/negabsmin.hpp deleted file mode 100644 index efd783c6bd..0000000000 --- a/include/eve/module/core/saturated/impl/negabsmin.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(negabsmin(a, b)) -{ - return arithmetic_call(saturated(negabsmin), a, b); -} - -template -EVE_FORCEINLINE auto -negabsmin_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return saturated(minus)(eve::abs[saturated](eve::min(a, b))); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negabsmin_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) noexcept --> decltype(mul(a0, a1, args...)) -{ - return saturated(minus)(eve::abs[saturated](eve::min(a0, a1, args...))); -} - -} diff --git a/include/eve/module/core/saturated/impl/negmaxabs.hpp b/include/eve/module/core/saturated/impl/negmaxabs.hpp deleted file mode 100644 index fae2766177..0000000000 --- a/include/eve/module/core/saturated/impl/negmaxabs.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(negmaxabs(a, b)) -{ - return arithmetic_call(saturated(negmaxabs), a, b); -} - -template -EVE_FORCEINLINE auto -negmaxabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return saturated(minus)(saturated(maxabs(a, b))); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negmaxabs_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) --> decltype(negmaxabs(a0, a1, args...)) -{ - return saturated(minus)(saturated(eve::maxabs)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/saturated/impl/negminabs.hpp b/include/eve/module/core/saturated/impl/negminabs.hpp deleted file mode 100644 index 3fe7e63e6c..0000000000 --- a/include/eve/module/core/saturated/impl/negminabs.hpp +++ /dev/null @@ -1,51 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - U const& b) noexcept --> decltype(negminabs(a, b)) -{ - return arithmetic_call(saturated(negminabs), a, b); -} - -template -EVE_FORCEINLINE auto -negminabs_(EVE_SUPPORTS(cpu_), - saturated_type const&, - T const& a, - T const& b) noexcept requires has_native_abi_v -{ - return saturated(minus)(saturated(minabs(a, b))); -} - -//================================================================================================ -// N parameters -//================================================================================================ -template -auto -negminabs_(EVE_SUPPORTS(cpu_), saturated_type const&, T0 a0, T1 a1, Ts... args) --> decltype(negminabs(a0, a1, args...)) -{ - return saturated(minus)(saturated(eve::minabs)(a0, a1, args...)); -} - -} diff --git a/include/eve/module/core/saturated/maxabs.hpp b/include/eve/module/core/saturated/maxabs.hpp deleted file mode 100644 index 5ccc77c2ed..0000000000 --- a/include/eve/module/core/saturated/maxabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/maxmag.hpp b/include/eve/module/core/saturated/maxmag.hpp deleted file mode 100644 index e4ed199c8e..0000000000 --- a/include/eve/module/core/saturated/maxmag.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/minabs.hpp b/include/eve/module/core/saturated/minabs.hpp deleted file mode 100644 index 230a882350..0000000000 --- a/include/eve/module/core/saturated/minabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/minmag.hpp b/include/eve/module/core/saturated/minmag.hpp deleted file mode 100644 index 365e9b690a..0000000000 --- a/include/eve/module/core/saturated/minmag.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/negabsmax.hpp b/include/eve/module/core/saturated/negabsmax.hpp deleted file mode 100644 index 632de967b0..0000000000 --- a/include/eve/module/core/saturated/negabsmax.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/negabsmin.hpp b/include/eve/module/core/saturated/negabsmin.hpp deleted file mode 100644 index 94046f0c7c..0000000000 --- a/include/eve/module/core/saturated/negabsmin.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/negmaxabs.hpp b/include/eve/module/core/saturated/negmaxabs.hpp deleted file mode 100644 index 0096dfd850..0000000000 --- a/include/eve/module/core/saturated/negmaxabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/core/saturated/negminabs.hpp b/include/eve/module/core/saturated/negminabs.hpp deleted file mode 100644 index bf9e05e9ae..0000000000 --- a/include/eve/module/core/saturated/negminabs.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/math/pedantic/impl/lpnorm.hpp b/include/eve/module/math/pedantic/impl/lpnorm.hpp index 4ba6fdc77d..3d1ee25fae 100644 --- a/include/eve/module/math/pedantic/impl/lpnorm.hpp +++ b/include/eve/module/math/pedantic/impl/lpnorm.hpp @@ -30,7 +30,7 @@ lpnorm_(EVE_SUPPORTS(cpu_), pedantic_type const&, const P& p, T0 a0, T1 a1, Ts.. { if( eve::all(p == P(2)) ) return pedantic(hypot)(a0, a1, args...); else if( eve::all(p == P(1)) ) return pedantic(manhattan)(a0, a1, args...); - else if( eve::all(p == eve::inf(as(p))) ) return numeric(maxabs)(a0, a1, args...); + else if( eve::all(p == eve::inf(as(p))) ) return maxabs[numeric2](a0, a1, args...); else { auto rp = r_t(p); @@ -39,7 +39,7 @@ lpnorm_(EVE_SUPPORTS(cpu_), pedantic_type const&, const P& p, T0 a0, T1 a1, Ts.. r_t that = add(f(a0), f(a1), f(args)...); auto r = ldexp[pedantic](pow_abs(that, rec(rp)), -e); auto isinfp = is_infinite(rp); - auto rinf = numeric(maxabs)(a0, a1, args...); + auto rinf = maxabs[numeric](a0, a1, args...); return if_else(isinfp || is_infinite(rinf), rinf, r); } } diff --git a/include/eve/traits/overload/default_behaviors.hpp b/include/eve/traits/overload/default_behaviors.hpp index 402ad8f0e9..95b88a3c94 100644 --- a/include/eve/traits/overload/default_behaviors.hpp +++ b/include/eve/traits/overload/default_behaviors.hpp @@ -131,6 +131,30 @@ namespace eve } }; + + //==================================================================================================================== + //==================================================================================================================== + template< template class Func + , typename OptionsValues + , typename... Options + > + struct tuple_callable : elementwise_callable + { + using base_t = elementwise_callable; + + template + constexpr auto behavior(auto arch, O const& opts, T const& x) const + { + return kumi::apply( [&](auto... a) { return static_cast(*this).behavior(arch,opts,a...); }, x); + } + + template + constexpr auto behavior(auto arch, O const& opts, T const& x0, Ts const&... xs) const + { + return base_t::behavior(arch,opts,x0,xs...); + } + }; + //==================================================================================================================== //! @addtogroup extensions //! @{ diff --git a/include/eve/traits/overload/supports.hpp b/include/eve/traits/overload/supports.hpp index 32591e166c..97a17b5b4a 100644 --- a/include/eve/traits/overload/supports.hpp +++ b/include/eve/traits/overload/supports.hpp @@ -41,6 +41,20 @@ namespace eve template constexpr EVE_FORCEINLINE explicit options(rbr::settings const& opts) : Settings(opts) {} + + template + constexpr EVE_FORCEINLINE auto drop(K const& k) const noexcept + { + auto dropped = rbr::drop(k, *this); + return options{dropped}; + } + + template + constexpr EVE_FORCEINLINE auto drop(K0 const& k0, Ks const&... ks) const noexcept + { + auto dropped = rbr::drop(k0, *this); + return options{dropped}.drop(ks...); + } }; template diff --git a/test/doc/core/pedantic/max.cpp b/test/doc/core/pedantic/max.cpp index 152352732c..bc90e778e5 100644 --- a/test/doc/core/pedantic/max.cpp +++ b/test/doc/core/pedantic/max.cpp @@ -16,7 +16,7 @@ int main() std::cout << "---- simd" << '\n' << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' - << "-> pedantic(max)(pf, qf) = " << eve::pedantic(eve::max)(pf, qf) << '\n' - << "-> numeric(max)(pf, qf) = " << eve::numeric(eve::max)(pf, qf) << '\n'; + << "-> max[pedantic](pf, qf) = " << eve::max[eve::pedantic](pf, qf) << '\n' + << "-> max[numeric](pf, qf) = " << eve::max[eve::numeric](pf, qf) << '\n'; return 0; } diff --git a/test/doc/core/pedantic/maxabs.cpp b/test/doc/core/pedantic/maxabs.cpp index f580576ff0..173a123249 100644 --- a/test/doc/core/pedantic/maxabs.cpp +++ b/test/doc/core/pedantic/maxabs.cpp @@ -14,7 +14,7 @@ int main() std::cout << "---- simd" << '\n' << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' - << "-> pedantic(maxabs)(pf, qf) = " << eve::pedantic(eve::maxabs)(pf, qf) << '\n' - << "-> numeric(maxabs)(pf, qf) = " << eve::numeric(eve::maxabs)(pf, qf) << '\n'; + << "-> maxabs[pedantic}(pf, qf) = " << eve::maxabs[eve::pedantic](pf, qf) << '\n' + << "-> maxabs[numeric](pf, qf) = " << eve::maxabs[eve::numeric](pf, qf) << '\n'; return 0; } diff --git a/test/doc/core/pedantic/maxmag.cpp b/test/doc/core/pedantic/maxmag.cpp index 41ede81c81..9bec62d73e 100644 --- a/test/doc/core/pedantic/maxmag.cpp +++ b/test/doc/core/pedantic/maxmag.cpp @@ -14,7 +14,8 @@ int main() std::cout << "---- simd" << '\n' << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' - << "-> pedantic(maxmag)(pf, qf) = " << eve::pedantic(eve::maxmag)(pf, qf) << '\n' - << "-> numeric(maxmag)(pf, qf) = " << eve::numeric(eve::maxmag)(pf, qf) << '\n'; + << "-> maxmag[pedantic}(pf, qf) = " << eve::maxmag[eve::pedantic](pf, qf) << '\n' + << "-> maxmag[numeric](pf, qf) = " << eve::maxmag[eve::numeric](pf, qf) << '\n'; + return 0; } diff --git a/test/doc/core/pedantic/min.cpp b/test/doc/core/pedantic/min.cpp index 6cacc52ea0..3f54c34f41 100644 --- a/test/doc/core/pedantic/min.cpp +++ b/test/doc/core/pedantic/min.cpp @@ -16,7 +16,7 @@ int main() std::cout << "---- simd" << '\n' << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' - << "-> pedantic(min)(pf, qf) = " << eve::pedantic(eve::min)(pf, qf) << '\n' - << "-> numeric(min)(pf, qf) = " << eve::numeric(eve::min)(pf, qf) << '\n'; + << "-> min[pedantic](pf, qf) = " << eve::min[eve::pedantic](pf, qf) << '\n' + << "-> min[numeric](pf, qf) = " << eve::min[eve::numeric](pf, qf) << '\n'; return 0; } diff --git a/test/doc/core/pedantic/minabs.cpp b/test/doc/core/pedantic/minabs.cpp index 859e43dd98..175ece3852 100644 --- a/test/doc/core/pedantic/minabs.cpp +++ b/test/doc/core/pedantic/minabs.cpp @@ -14,7 +14,8 @@ int main() std::cout << "---- simd" << '\n' << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' - << "-> pedantic(minabs)(pf, qf) = " << eve::pedantic(eve::minabs)(pf, qf) << '\n' - << "-> numeric(minabs)(pf, qf) = " << eve::numeric(eve::minabs)(pf, qf) << '\n'; + << "-> minabs[pedantic}(pf, qf) = " << eve::minabs[eve::pedantic](pf, qf) << '\n' + << "-> minabs[numeric](pf, qf) = " << eve::minabs[eve::numeric](pf, qf) << '\n'; + return 0; } diff --git a/test/doc/core/pedantic/minmag.cpp b/test/doc/core/pedantic/minmag.cpp index 7c3be606df..747019eae6 100644 --- a/test/doc/core/pedantic/minmag.cpp +++ b/test/doc/core/pedantic/minmag.cpp @@ -14,7 +14,8 @@ int main() std::cout << "---- simd" << '\n' << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' - << "-> pedantic(minmag)(pf, qf) = " << eve::pedantic(eve::minmag)(pf, qf) << '\n' - << "-> numeric(minmag)(pf, qf) = " << eve::numeric(eve::minmag)(pf, qf) << '\n'; + << "-> minmag[pedantic}(pf, qf) = " << eve::minmag[eve::pedantic](pf, qf) << '\n' + << "-> minmag[numeric](pf, qf) = " << eve::minmag[eve::numeric](pf, qf) << '\n'; + return 0; } diff --git a/test/doc/core/regular/absmax.cpp b/test/doc/core/regular/absmax.cpp index 5fad80e2f2..f14d2f0244 100644 --- a/test/doc/core/regular/absmax.cpp +++ b/test/doc/core/regular/absmax.cpp @@ -15,9 +15,8 @@ int main() << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' << "-> absmax(pf, qf) = " << eve::absmax(pf, qf) << '\n' - - << "-> pedantic(absmax)(pf, qf) = " << eve::pedantic(eve::absmax)(pf, qf) << '\n' - << "-> numeric(absmax)(pf, qf) = " << eve::numeric(eve::absmax)(pf, qf) << '\n'; + << "-> absmax[pedantic](pf, qf) = " << eve::absmax[eve::pedantic](pf, qf) << '\n' + << "-> absmax[numeric](pf, qf) = " << eve::absmax[eve::numeric](pf, qf) << '\n'; float xf = -4.0f; float yf = 1.0f; @@ -26,7 +25,7 @@ int main() << "<- xf = " << xf << '\n' << "<- yf = " << yf << '\n' << "-> absmax(xf, yf) = " << eve::absmax(xf, yf) << '\n' - << "-> pedantic(absmax)(xf, yf) = " << eve::pedantic(eve::absmax)(xf, yf) << '\n' - << "-> numeric(absmax)(xf, yf) = " << eve::numeric(eve::absmax)(xf, yf) << '\n'; + << "-> absmax[pedantic](xf, yf) = " << eve::absmax[eve::pedantic](xf, yf) << '\n' + << "-> absmax[numeric](xf, yf) = " << eve::absmax[eve::numeric](xf, yf) << '\n'; return 0; } diff --git a/test/doc/core/regular/absmin.cpp b/test/doc/core/regular/absmin.cpp index 1abee4d6fd..d79a2143d4 100644 --- a/test/doc/core/regular/absmin.cpp +++ b/test/doc/core/regular/absmin.cpp @@ -15,9 +15,8 @@ int main() << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' << "-> absmin(pf, qf) = " << eve::absmin(pf, qf) << '\n' - << "-> pedantic(absmin)(pf, qf) = " << eve::pedantic(eve::absmin)(pf, qf) << '\n' - - << "-> numeric(absmin)(pf, qf) = " << eve::numeric(eve::absmin)(pf, qf) << '\n'; + << "-> absmin[pedantic](pf, qf) = " << eve::absmin[eve::pedantic](pf, qf) << '\n' + << "-> absmin[numeric](pf, qf) = " << eve::absmin[eve::numeric](pf, qf) << '\n'; float xf = -4.0f; float yf = 1.0f; @@ -26,7 +25,7 @@ int main() << "<- xf = " << xf << '\n' << "<- yf = " << yf << '\n' << "-> absmin(xf, yf) = " << eve::absmin(xf, yf) << '\n' - << "-> pedantic(absmin)(xf, yf) = " << eve::pedantic(eve::absmin)(xf, yf) << '\n' - << "-> numeric(absmin)(xf, yf) = " << eve::numeric(eve::absmin)(xf, yf) << '\n'; + << "-> absmin[pedantic](xf, yf) = " << eve::absmin[eve::pedantic](xf, yf) << '\n' + << "-> absmin[numeric](xf, yf) = " << eve::absmin[eve::numeric](xf, yf) << '\n'; return 0; } diff --git a/test/doc/core/regular/max.cpp b/test/doc/core/regular/max.cpp index c82d203bd7..780b458ff1 100644 --- a/test/doc/core/regular/max.cpp +++ b/test/doc/core/regular/max.cpp @@ -14,9 +14,12 @@ int main() std::cout << "---- simd" << '\n' - << "<- pf = " << pf << '\n' - << "<- qf = " << qf << '\n' - << "-> max(pf, qf) = " << eve::max(pf, qf) << '\n'; + << "<- pf = " << pf << '\n' + << "<- qf = " << qf << '\n' + << "-> max(pf, qf) = " << eve::max(pf, qf) << '\n' + << "-> max[eve::numeric](pf, qf) = " << eve::max[eve::numeric2](pf, qf) << '\n' + << "-> max[eve::pedantic](pf, qf) = " << eve::max[eve::pedantic](pf, qf) << '\n' + << "-> max[eve::pedantic](qf, pf) = " << eve::max[eve::pedantic](qf, pf) << '\n'; float xf = 1.0f; float yf = eve::nan(eve::as()); @@ -26,14 +29,15 @@ int main() << "<- yf = " << yf << '\n' << "-> max(xf, yf) = = " << eve::max(xf, yf) << '\n'; - auto k = kumi::tuple{pf, qf, pf+qf, 1}; - std::cout << "---- multi parameters" << '\n' - << " -> max(k) = " << eve::max(k) << '\n' - << " -> max(kumi::tuple{pf, pf, 1}) = " << eve::max( kumi::tuple{pf, qf, 1}) << '\n' - << " -> max(kumi::tuple{1, pf, pf}) = " << eve::max( kumi::tuple{1, pf, qf}) << '\n' - << " -> numeric(max(kumi::tuple{1.0f, pf, qf) = " << eve::numeric(eve::max)( kumi::tuple{1.0f, pf,qf}) << '\n' - << " -> max(kumi::tuple{pf, 1.0f) = " << eve::max( kumi::tuple{pf, 1.0f}) << '\n' - << " -> max(kumi::tuple{1.0f, pf) = " << eve::max( kumi::tuple{1.0f, pf}) << '\n' - << " -> numeric(max(kumi::tuple{1.0f, pf) = " << eve::numeric(eve::max)( kumi::tuple{1.0f, pf}) << '\n'; +// auto k = kumi::tuple{pf, qf, pf+qf, 1.0f}; +// std::cout << "---- multi parameters" << '\n' +// << " -> max(k) = " << eve::max(k) << '\n' +// << " -> max(kumi::tuple{pf, pf, 1.0f}) = " << eve::max( kumi::tuple{pf, qf, 1.0f}) << '\n' +// << " -> max(kumi::tuple{1.0f, pf, pf}) = " << eve::max( kumi::tuple{1.0f, pf, qf}) << '\n' +// << " -> max[numeric](kumi::tuple{1.0f, pf, qf)= " << eve::max[eve::numeric2]( kumi::tuple{1.0f, pf,qf}) << '\n' +// << " -> max(kumi::tuple{pf, 1.0f) = " << eve::max( kumi::tuple{pf, 1.0f}) << '\n' +// << " -> max(kumi::tuple{1.0f, pf) = " << eve::max( kumi::tuple{1.0f, pf}) << '\n' +// << " -> max[numeric](kumi::tuple{1.0f, pf) = " << eve::max[eve::numeric2]( kumi::tuple{1.0f, pf}) << '\n' +// << " -> max(eve::is_greater)(pf, qf) = " << eve::max(eve::is_greater)(pf, qf) << '\n'; return 0; } diff --git a/test/doc/core/regular/min.cpp b/test/doc/core/regular/min.cpp index d041d70868..4bbab665a5 100644 --- a/test/doc/core/regular/min.cpp +++ b/test/doc/core/regular/min.cpp @@ -25,14 +25,15 @@ int main() << "<- xf = " << xf << '\n' << "<- yf = " << yf << '\n' << "-> min(xf, yf) = = " << eve::min(xf, yf) << '\n'; - auto k = kumi::tuple{pf, qf, pf+qf, 1}; - std::cout << "---- multi parameters" << '\n' - << " -> min(k) = " << eve::min(k) << '\n' - << " -> min(kumi::tuple{pf, pf, 1}) = " << eve::min( kumi::tuple{pf, qf, 1}) << '\n' - << " -> min(kumi::tuple{1, pf, pf}) = " << eve::min( kumi::tuple{1, pf, qf}) << '\n' - << " -> numeric(min(kumi::tuple{1.0f, pf, qf) = " << eve::numeric(eve::min)( kumi::tuple{1.0f, pf,qf}) << '\n' - << " -> min(kumi::tuple{pf, 1.0f) = " << eve::min( kumi::tuple{pf, 1.0f}) << '\n' - << " -> min(kumi::tuple{1.0f, pf) = " << eve::min( kumi::tuple{1.0f, pf}) << '\n' - << " -> numeric(min(kumi::tuple{1.0f, pf) = " << eve::numeric(eve::min)( kumi::tuple{1.0f, pf}) << '\n'; +// auto k = kumi::tuple{pf, qf, pf+qf, 1}; +// std::cout << "---- multi parameters" << '\n' +// << " -> min(k) = " << eve::min(k) << '\n' +// << " -> min(kumi::tuple{pf, pf, 1}) = " << eve::min( kumi::tuple{pf, qf, 1}) << '\n' +// << " -> min(kumi::tuple{1, pf, pf}) = " << eve::min( kumi::tuple{1, pf, qf}) << '\n' +// << " -> numeric(min(kumi::tuple{1.0f, pf, qf) = " << eve::numeric(eve::min)( kumi::tuple{1.0f, pf,qf}) << '\n' +// << " -> min(kumi::tuple{pf, 1.0f) = " << eve::min( kumi::tuple{pf, 1.0f}) << '\n' +// << " -> min(kumi::tuple{1.0f, pf) = " << eve::min( kumi::tuple{1.0f, pf}) << '\n' +// << " -> numeric(min(kumi::tuple{1.0f, pf) = " << eve::numeric(eve::min)( kumi::tuple{1.0f, pf}) << '\n' +// ; return 0; } diff --git a/test/doc/core/regular/negabsmax.cpp b/test/doc/core/regular/negabsmax.cpp index b43483adbf..36bf0917be 100644 --- a/test/doc/core/regular/negabsmax.cpp +++ b/test/doc/core/regular/negabsmax.cpp @@ -15,8 +15,8 @@ int main() << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' << "-> negabsmax(pf, qf) = " << eve::negabsmax(pf, qf) << '\n' - << "-> pedantic(negabsmax)(pf, qf) = " << eve::pedantic(eve::negabsmax)(pf, qf) << '\n' - << "-> numeric(negabsmax)(pf, qf) = " << eve::numeric(eve::negabsmax)(pf, qf) << '\n'; + << "-> negabsmax[pedantic](pf, qf) = " << eve::negabsmax[eve::pedantic](pf, qf) << '\n' + << "-> negabsmax[numeric](pf, qf) = " << eve::negabsmax[eve::numeric](pf, qf) << '\n'; float xf = -4.0f; float yf = 1.0f; @@ -25,7 +25,8 @@ int main() << "<- xf = " << xf << '\n' << "<- yf = " << yf << '\n' << "-> negabsmax(xf, yf) = " << eve::negabsmax(xf, yf) << '\n' - << "-> pedantic(negabsmax)(xf, yf) = " << eve::pedantic(eve::negabsmax)(xf, yf) << '\n' - << "-> numeric(negabsmax)(xf, yf) = " << eve::numeric(eve::negabsmax)(xf, yf) << '\n'; + << "-> negabsmax[pedantic](xf, yf) = " << eve::negabsmax[eve::pedantic](xf, yf) << '\n' + << "-> negabsmax[numeric](xf, yf) = " << eve::negabsmax[eve::numeric](xf, yf) << '\n'; + return 0; } diff --git a/test/doc/core/regular/negabsmin.cpp b/test/doc/core/regular/negabsmin.cpp index 46a7469aef..1970fcc43a 100644 --- a/test/doc/core/regular/negabsmin.cpp +++ b/test/doc/core/regular/negabsmin.cpp @@ -15,8 +15,8 @@ int main() << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' << "-> negabsmin(pf, qf) = " << eve::negabsmin(pf, qf) << '\n' - << "-> pedantic(negabsmin)(pf, qf) = " << eve::pedantic(eve::negabsmin)(pf, qf) << '\n' - << "-> numeric(negabsmin)(pf, qf) = " << eve::numeric(eve::negabsmin)(pf, qf) << '\n'; + << "-> negabsmin[pedantic](pf, qf) = " << eve::negabsmin[eve::pedantic](pf, qf) << '\n' + << "-> negabsmin[numeric](pf, qf) = " << eve::negabsmin[eve::numeric](pf, qf) << '\n'; float xf = -4.0f; float yf = 1.0f; @@ -25,7 +25,8 @@ int main() << "<- xf = " << xf << '\n' << "<- yf = " << yf << '\n' << "-> negabsmin(xf, yf) = " << eve::negabsmin(xf, yf) << '\n' - << "-> pedantic(negabsmin)(xf, yf) = " << eve::pedantic(eve::negabsmin)(xf, yf) << '\n' - << "-> numeric(negabsmin)(xf, yf) = " << eve::numeric(eve::negabsmin)(xf, yf) << '\n'; + << "-> negabsmin[pedantic](xf, yf) = " << eve::negabsmin[eve::pedantic](xf, yf) << '\n' + << "-> negabsmin[numeric](xf, yf) = " << eve::negabsmin[eve::numeric](xf, yf) << '\n'; + return 0; } diff --git a/test/doc/core/regular/negmaxabs.cpp b/test/doc/core/regular/negmaxabs.cpp index d2386c428f..48a3476a93 100644 --- a/test/doc/core/regular/negmaxabs.cpp +++ b/test/doc/core/regular/negmaxabs.cpp @@ -15,8 +15,9 @@ int main() << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' << "-> negmaxabs(pf, qf) = " << eve::negmaxabs(pf, qf) << '\n' - << "-> pedantic(negmaxabs)(pf, qf) = " << eve::pedantic(eve::negmaxabs)(pf, qf) << '\n' - << "-> numeric(negmaxabs)(pf, qf) = " << eve::numeric(eve::negmaxabs)(pf, qf) << '\n'; + << "-> negmaxabs[pedantic}(pf, qf) = " << eve::negmaxabs[eve::pedantic](pf, qf) << '\n' + << "-> negmaxabs[numeric](pf, qf) = " << eve::negmaxabs[eve::numeric](pf, qf) << '\n'; + float xf = -4.0f; float yf = 1.0f; @@ -25,7 +26,8 @@ int main() << "<- xf = " << xf << '\n' << "<- yf = " << yf << '\n' << "-> negmaxabs(xf, yf) = " << eve::negmaxabs(xf, yf) << '\n' - << "-> pedantic(negmaxabs)(xf, yf) = " << eve::pedantic(eve::negmaxabs)(xf, yf) << '\n' - << "-> numeric(negmaxabs)(xf, yf) = " << eve::numeric(eve::negmaxabs)(xf, yf) << '\n'; + << "-> negmaxabs[pedantic}(xf, yf) = " << eve::negmaxabs[eve::pedantic](xf, yf) << '\n' + << "-> negmaxabs[numeric](xf, yf) = " << eve::negmaxabs[eve::numeric](xf, yf) << '\n'; + return 0; } diff --git a/test/doc/core/regular/negminabs.cpp b/test/doc/core/regular/negminabs.cpp index bb3b9b899a..d01361ce4f 100644 --- a/test/doc/core/regular/negminabs.cpp +++ b/test/doc/core/regular/negminabs.cpp @@ -15,8 +15,9 @@ int main() << "<- pf = " << pf << '\n' << "<- qf = " << qf << '\n' << "-> negminabs(pf, qf) = " << eve::negminabs(pf, qf) << '\n' - << "-> pedantic(negminabs)(pf, qf) = " << eve::pedantic(eve::negminabs)(pf, qf) << '\n' - << "-> numeric(negminabs)(pf, qf) = " << eve::numeric(eve::negminabs)(pf, qf) << '\n'; + << "-> negminabs[pedantic}(pf, qf) = " << eve::negminabs[eve::pedantic](pf, qf) << '\n' + << "-> negminabs[numeric](pf, qf) = " << eve::negminabs[eve::numeric](pf, qf) << '\n'; + float xf = -4.0f; float yf = 1.0f; @@ -25,7 +26,8 @@ int main() << "<- xf = " << xf << '\n' << "<- yf = " << yf << '\n' << "-> negminabs(xf, yf) = " << eve::negminabs(xf, yf) << '\n' - << "-> pedantic(negminabs)(xf, yf) = " << eve::pedantic(eve::negminabs)(xf, yf) << '\n' - << "-> numeric(negminabs)(xf, yf) = " << eve::numeric(eve::negminabs)(xf, yf) << '\n'; + << "-> negminabs[pedantic}(xf, yf) = " << eve::negminabs[eve::pedantic](xf, yf) << '\n' + << "-> negminabs[numeric](xf, yf) = " << eve::negminabs[eve::numeric](xf, yf) << '\n'; + return 0; } diff --git a/test/unit/module/core/absmax.cpp b/test/unit/module/core/absmax.cpp index c1fa864718..0e3250bf7a 100644 --- a/test/unit/module/core/absmax.cpp +++ b/test/unit/module/core/absmax.cpp @@ -53,14 +53,14 @@ TTS_CASE_WITH("Check behavior of absmax on all types full range", using v_t = eve::element_type_t; auto m = [](auto a, auto b, auto c) -> v_t { return eve::abs(eve::max(a, b, c)); }; - TTS_ULP_EQUAL(absmax((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(absmax)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(absmax)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(absmax)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(absmax(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(absmax)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(absmax)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(absmax)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax(a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax[eve::pedantic](a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax[eve::numeric](a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax[eve::saturated](a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax(kumi::tuple{a0, a1, a2}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax[eve::pedantic](kumi::tuple{a0, a1, a2}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax[eve::numeric](kumi::tuple{a0, a1, a2}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmax[eve::saturated](kumi::tuple{a0, a1, a2}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(absmax[t](a0, a1), eve::if_else(t, absmax(a0, a1), a0)); }; @@ -69,34 +69,41 @@ TTS_CASE_TPL("Check values of absmax", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::absmax)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmax)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::absmax[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::absmax[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmax)(eve::nan(eve::as()), v_t(1)), + TTS_IEEE_EQUAL(eve::absmax[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmax)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmax)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmax)(T(1), eve::nan(eve::as())), T(1)); - - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::absmax)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::absmax)(T(0), T(-0.))))); - - TTS_IEEE_EQUAL(eve::numeric(eve::absmax)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmax)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmax)((eve::nan(eve::as())), v_t(1)), T(1)); - - TTS_IEEE_EQUAL(eve::numeric(eve::absmax)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmax)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmax)(T(1), eve::nan(eve::as())), T(1)); - - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::absmax)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::absmax)(T(0), T(-0.))))); + TTS_IEEE_EQUAL(eve::absmax[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmax[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmax[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + + TTS_EXPECT(eve::all(eve::is_positive(eve::absmax[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::absmax[eve::pedantic](T(0), T(-0.))))); + + TTS_IEEE_EQUAL(eve::absmax[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::absmax[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::absmax[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); + + TTS_IEEE_EQUAL(eve::absmax[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmax[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmax[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + + TTS_EXPECT(eve::all(eve::is_positive(eve::absmax[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::absmax[eve::numeric](T(0), T(-0.))))); + if constexpr( eve::integral_value) + { + TTS_IEEE_EQUAL(eve::absmax[eve::saturated](eve::valmin(eve::as()), eve::valmin(eve::as())), eve::valmax(eve::as())); + TTS_IEEE_EQUAL(eve::absmax(eve::valmin(eve::as()), eve::valmin(eve::as())), eve::valmin(eve::as())); + TTS_IEEE_EQUAL(eve::absmax[eve::numeric][eve::saturated](eve::valmin(eve::as()), eve::valmin(eve::as())), eve::valmax(eve::as())); + TTS_IEEE_EQUAL(eve::absmax[eve::numeric](eve::valmin(eve::as()), eve::valmin(eve::as())), eve::valmin(eve::as())); + } }; //================================================================================================== -// Tests for masked absmax +//=== Tests for masked absmax //================================================================================================== TTS_CASE_WITH("Check behavior of eve::masked(eve::absmax)(eve::wide)", eve::test::simd::ieee_reals, @@ -107,6 +114,6 @@ TTS_CASE_WITH("Check behavior of eve::masked(eve::absmax)(eve::wide)", T const& a1, M const& mask) { - TTS_IEEE_EQUAL(eve::absmax[mask](a0, a1), - eve::if_else(mask, eve::absmax(a0, a1), a0)); + TTS_IEEE_EQUAL(eve::absmax[mask](a0, a1), eve::if_else(mask, eve::absmax(a0, a1), a0)); + TTS_IEEE_EQUAL(eve::absmax[mask][eve::saturated][eve::pedantic](a0, a1), eve::if_else(mask, eve::absmax[eve::saturated](a0, a1), a0)); }; diff --git a/test/unit/module/core/absmin.cpp b/test/unit/module/core/absmin.cpp index 78e7271d83..3bdf3d87e6 100644 --- a/test/unit/module/core/absmin.cpp +++ b/test/unit/module/core/absmin.cpp @@ -61,14 +61,14 @@ TTS_CASE_WITH("Check behavior of absmin on all types full range", using v_t = eve::element_type_t; auto m = [](auto a, auto b, auto c) -> v_t { return eve::abs(eve::min(a, b, c)); }; - TTS_ULP_EQUAL(absmin((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(absmin)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(absmin)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(absmin)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(absmin(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(absmin)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(absmin)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(absmin)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(absmin((a0), (a1), (a2)), map(m, a0, a1, a2), 2) << a0 << " --- " << a1 << " --- " << a2 << '\n'; + TTS_ULP_EQUAL(eve::absmin[eve::pedantic]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::absmin[eve::numeric]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::absmin[eve::saturated]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::absmin(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::absmin[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::absmin[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::absmin[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(absmin[t](a0, a1), eve::if_else(t, absmin(a0, a1), a0)); }; @@ -77,34 +77,34 @@ TTS_CASE_TPL("Check values of absmin", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::absmin)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmin)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::absmin[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::absmin[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmin)(eve::nan(eve::as()), v_t(1)), + TTS_IEEE_EQUAL(eve::absmin[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmin)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmin)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::absmin)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::absmin)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::absmin)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::absmin[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::absmin[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::absmin)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmin)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmin)((eve::nan(eve::as())), v_t(1)), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmin)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmin)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::absmin)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::absmin[eve::numeric](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::absmin)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::absmin)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::absmin[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::absmin[eve::numeric](T(0), T(-0.))))); }; //================================================================================================== -// Tests for masked absmin +//== Tests for masked absmin //================================================================================================== TTS_CASE_WITH("Check behavior of eve::masked(eve::absmin)(eve::wide)", eve::test::simd::ieee_reals, diff --git a/test/unit/module/core/max.cpp b/test/unit/module/core/max.cpp index f9175bfef0..f78115b09a 100644 --- a/test/unit/module/core/max.cpp +++ b/test/unit/module/core/max.cpp @@ -43,59 +43,61 @@ TTS_CASE_WITH("Check behavior of max on all types full range", eve::test::simd::all_types, tts::generate(tts::randoms(eve::valmin, eve::valmax), tts::randoms(eve::valmin, eve::valmax), - tts::randoms(eve::valmin, eve::valmax), - tts::logicals(0, 3))) -(T const& a0, T const& a1, T const& a2, M const& t) + tts::randoms(eve::valmin, eve::valmax) + )) +(T const& a0, T const& a1, T const& a2) { using eve::abs; using eve::max; using eve::detail::map; using v_t = eve::element_type_t; auto m = [](auto a, auto b, auto c) -> v_t { return std::max(std::max(a, b), c); }; - TTS_ULP_EQUAL(max((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(max)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(max)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(max(a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(max[eve::pedantic](a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(max[eve::numeric](a0, a1, a2), map(m, a0, a1, a2), 2); - TTS_IEEE_EQUAL(max[t](a0, a1), eve::if_else(t, max(a0, a1), a0)); + TTS_ULP_EQUAL(max(kumi::tuple{a0, a1, a2}), max(a0, a1, a2), 2); + TTS_ULP_EQUAL(max[eve::numeric](kumi::tuple{a0, a1, a2}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(max[eve::pedantic](kumi::tuple{a0, a1, a2}), map(m, a0, a1, a2), 2); }; TTS_CASE_TPL("Check values of max", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::max)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::max)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::max)(eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::max[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::max[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::max[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::max)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::max)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::max)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::max)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::max)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::max[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::max[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::max)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::max)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::max)((eve::nan(eve::as())), v_t(1)), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::max)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::max)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::max)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::max[eve::numeric](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::max)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::max)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::max[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::max[eve::numeric](T(0), T(-0.))))); }; TTS_CASE_WITH("Check predicate version of max", - eve::test::simd::all_types, + eve::test::simd::ieee_reals, tts::generate(tts::randoms(eve::valmin, eve::valmin), tts::randoms(eve::valmin, eve::valmin))) (T const& a0, T const& a1) { - TTS_EXPR_IS(eve::max(eve::is_less), eve::callable_max_); + TTS_EXPR_IS(eve::max(eve::is_less), std::remove_cvref_t); TTS_EQUAL(eve::max(eve::is_less)(a0, a1), eve::max(a0, a1)); - TTS_EXPR_IS(eve::max(eve::is_greater), eve::callable_min_); + TTS_EXPR_IS(eve::max(eve::is_greater), std::remove_cvref_t); TTS_EQUAL(eve::max(eve::is_greater)(a0, a1), eve::min(a0, a1)); auto pred = [](auto a, auto b) { return eve::abs(a) < eve::abs(b); }; @@ -128,6 +130,6 @@ TTS_CASE_WITH("Check behavior of eve::masked(eve::max)(eve::wide)", T const& a1, M const& mask) { - TTS_IEEE_EQUAL(eve::max[mask](a0, a1), - eve::if_else(mask, eve::max(a0, a1), a0)); + TTS_IEEE_EQUAL(eve::max[mask](a0, a1), eve::if_else(mask, eve::max(a0, a1), a0)); + TTS_IEEE_EQUAL(eve::max[mask][eve::pedantic](a0, a1), eve::if_else(mask, eve::max[eve::pedantic](a0, a1), a0)); }; diff --git a/test/unit/module/core/maxabs.cpp b/test/unit/module/core/maxabs.cpp index 38bb28124c..41ae5bd6f0 100644 --- a/test/unit/module/core/maxabs.cpp +++ b/test/unit/module/core/maxabs.cpp @@ -62,13 +62,13 @@ TTS_CASE_WITH("Check behavior of maxabs on all types full range", auto m = [](auto a, auto b, auto c) -> v_t { return eve::max(eve::abs(a), eve::abs(b), eve::abs(c)); }; TTS_ULP_EQUAL(maxabs((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(maxabs)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(maxabs)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(maxabs)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxabs[eve::pedantic]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxabs[eve::numeric]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxabs[eve::saturated]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); TTS_ULP_EQUAL(maxabs(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(maxabs)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(maxabs)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(maxabs)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxabs[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxabs[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxabs[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(maxabs[t](a0, a1), eve::if_else(t, maxabs(a0, a1), a0)); }; @@ -77,29 +77,27 @@ TTS_CASE_TPL("Check values of maxabs", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::maxabs)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxabs)(eve::nan(eve::as()), T(1)), - eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxabs)(eve::nan(eve::as()), v_t(1)), - eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::maxabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::maxabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::maxabs[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxabs)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxabs)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxabs)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::maxabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::maxabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxabs[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxabs[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::maxabs)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxabs)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxabs)((eve::nan(eve::as())), v_t(1)), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxabs)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxabs)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxabs)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxabs[eve::numeric](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::maxabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::maxabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxabs[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxabs[eve::numeric](T(0), T(-0.))))); }; diff --git a/test/unit/module/core/maxmag.cpp b/test/unit/module/core/maxmag.cpp index dbbb747f5e..71d20b20b3 100644 --- a/test/unit/module/core/maxmag.cpp +++ b/test/unit/module/core/maxmag.cpp @@ -61,13 +61,13 @@ TTS_CASE_WITH("Check behavior of maxmag on all types full range", using v_t = eve::element_type_t; auto m = [](auto a, auto b, auto c) -> v_t { return maxmag(maxmag(b, c), a); }; TTS_ULP_EQUAL(maxmag((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(maxmag)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(maxmag)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(maxmag)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(maxmag(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(maxmag)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(maxmag)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(maxmag)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxmag[eve::pedantic]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxmag[eve::numeric]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxmag[eve::saturated]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(maxmag(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxmag[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxmag[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::maxmag[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(maxmag[t](a0, a1), eve::if_else(t, maxmag(a0, a1), a0)); }; @@ -76,34 +76,34 @@ TTS_CASE_TPL("Check values of maxmag", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::maxmag)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxmag)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::maxmag[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::maxmag[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxmag)(eve::nan(eve::as()), v_t(1)), + TTS_IEEE_EQUAL(eve::maxmag[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxmag)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxmag)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::maxmag)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::maxmag)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::maxmag)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxmag[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxmag[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::maxmag)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxmag)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxmag)((eve::nan(eve::as())), v_t(1)), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxmag)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxmag)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::maxmag)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::maxmag[eve::numeric](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::maxmag)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::maxmag)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxmag[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::maxmag[eve::numeric](T(0), T(-0.))))); }; //================================================================================================== -// Tests for masked maxmag +//== Tests for masked maxmag //================================================================================================== TTS_CASE_WITH("Check behavior of eve::masked(eve::maxmag)(eve::wide)", eve::test::simd::ieee_reals, diff --git a/test/unit/module/core/min.cpp b/test/unit/module/core/min.cpp index 5af71d316e..2902359073 100644 --- a/test/unit/module/core/min.cpp +++ b/test/unit/module/core/min.cpp @@ -38,51 +38,50 @@ TTS_CASE_TPL("Check return types of min", eve::test::simd::all_types) //================================================================================================== // min tests //================================================================================================== -TTS_CASE_WITH("Check behavior of min on all types full range", - eve::test::simd::all_types, - tts::generate(tts::randoms(eve::valmin, eve::valmin), - tts::randoms(eve::valmin, eve::valmin), - tts::randoms(eve::valmin, eve::valmin), - tts::logicals(0, 3))) -(T const& a0, T const& a1, T const& a2, M const& t) +TTS_CASE_WITH ( "Check behavior of min on all types full range" + , eve::test::simd::all_types + , tts::generate ( tts::randoms(eve::valmin, eve::valmin) + , tts::randoms(eve::valmin, eve::valmin) + , tts::randoms(eve::valmin, eve::valmin) + ) + ) +(T const& a0, T const& a1, T const& a2) { using eve::abs; using eve::min; using eve::detail::map; using v_t = eve::element_type_t; auto m = [](auto a, auto b, auto c) -> v_t { return std::min(std::min(a, b), c); }; - TTS_ULP_EQUAL(min((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(min)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(min)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - - TTS_IEEE_EQUAL(min[t](a0, a1), eve::if_else(t, min(a0, a1), a0)); + TTS_ULP_EQUAL(min(a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(min[eve::pedantic](a0, a1, a2), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(min[eve::numeric](a0, a1, a2), map(m, a0, a1, a2), 2); }; TTS_CASE_TPL("Check values of min", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::min)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::min)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::min)(eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::min[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::min[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::min[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::min)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::min)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::min)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::min)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::min)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::min[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::min[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::min)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::min)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::min)((eve::nan(eve::as())), v_t(1)), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::min)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::min)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::min)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::min[eve::numeric](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::min)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::min)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::min[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::min[eve::numeric](T(0), T(-0.))))); }; TTS_CASE_WITH("Check predicate version of min", @@ -91,10 +90,10 @@ TTS_CASE_WITH("Check predicate version of min", tts::randoms(eve::valmin, eve::valmin))) (T const& a0, T const& a1) { - TTS_EXPR_IS(eve::min(eve::is_less), eve::callable_min_); + TTS_EXPR_IS(eve::min(eve::is_less), std::remove_cvref_t); TTS_EQUAL(eve::min(eve::is_less)(a0, a1), eve::min(a0, a1)); - TTS_EXPR_IS(eve::min(eve::is_greater), eve::callable_max_); + TTS_EXPR_IS(eve::min(eve::is_greater), std::remove_cvref_t); TTS_EQUAL(eve::min(eve::is_greater)(a0, a1), eve::max(a0, a1)); auto pred = [](auto a, auto b) { return eve::abs(a) < eve::abs(b); }; @@ -123,10 +122,7 @@ TTS_CASE_WITH("Check behavior of eve::masked(eve::min)(eve::wide)", tts::generate(tts::randoms(eve::valmin, eve::valmax), tts::randoms(eve::valmin, eve::valmax), tts::logicals(0, 3))) -(T const& a0, - T const& a1, - M const& mask) +(T const& a0,T const& a1,M const& mask) { - TTS_IEEE_EQUAL(eve::min[mask](a0, a1), - eve::if_else(mask, eve::min(a0, a1), a0)); + TTS_IEEE_EQUAL(eve::min[mask](a0, a1), eve::if_else(mask, eve::min(a0, a1), a0)); }; diff --git a/test/unit/module/core/minabs.cpp b/test/unit/module/core/minabs.cpp index 1d4edd9bd1..40d0f27a69 100644 --- a/test/unit/module/core/minabs.cpp +++ b/test/unit/module/core/minabs.cpp @@ -62,13 +62,13 @@ TTS_CASE_WITH("Check behavior of minabs on all types full range", auto m = [](auto a, auto b, auto c) -> v_t { return eve::min(eve::abs(a), eve::abs(b), eve::abs(c)); }; TTS_ULP_EQUAL(minabs((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(minabs)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(minabs)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(minabs)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minabs[eve::pedantic]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minabs[eve::numeric]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minabs[eve::saturated]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); TTS_ULP_EQUAL(minabs(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(minabs)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(minabs)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(minabs)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minabs[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minabs[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minabs[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(minabs[t](a0, a1), eve::if_else(t, minabs(a0, a1), a0)); }; @@ -77,29 +77,29 @@ TTS_CASE_TPL("Check values of minabs", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::minabs)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::minabs)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::minabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::minabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::minabs)(eve::nan(eve::as()), v_t(1)), + TTS_IEEE_EQUAL(eve::minabs[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::minabs)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::minabs)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::minabs)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::minabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::pedantic(eve::minabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::minabs[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::minabs[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::minabs)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minabs)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minabs)((eve::nan(eve::as())), v_t(1)), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minabs)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minabs)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minabs)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minabs[eve::numeric](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::minabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_positive(eve::numeric(eve::minabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::minabs[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_positive(eve::minabs[eve::numeric](T(0), T(-0.))))); }; diff --git a/test/unit/module/core/minmag.cpp b/test/unit/module/core/minmag.cpp index 49dc2d181b..6113344269 100644 --- a/test/unit/module/core/minmag.cpp +++ b/test/unit/module/core/minmag.cpp @@ -60,17 +60,14 @@ TTS_CASE_WITH("Check behavior of minmag on all types full range", using eve::detail::map; using v_t = eve::element_type_t; auto m = [](auto a, auto b, auto c) -> v_t { return minmag(minmag(a, b), c); }; - std::cout << "a0 " << a0 << std::endl; - std::cout << "a1 " << a1 << std::endl; - std::cout << "a2 " << a2 << std::endl; TTS_ULP_EQUAL(minmag((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(minmag)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(minmag)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(minmag)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minmag[eve::pedantic]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minmag[eve::numeric]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minmag[eve::saturated]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); TTS_ULP_EQUAL(minmag(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(minmag)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(minmag)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(minmag)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minmag[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minmag[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::minmag[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(minmag[t](a0, a1), eve::if_else(t, minmag(a0, a1), a0)); }; @@ -79,29 +76,27 @@ TTS_CASE_TPL("Check values of minmag", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::minmag)(eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::minmag)(eve::nan(eve::as()), T(1)), - eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::minmag)(eve::nan(eve::as()), v_t(1)), - eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::minmag[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::minmag[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::minmag[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::minmag)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::minmag)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::minmag)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::pedantic](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::pedantic](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::minmag)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::minmag)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::minmag[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::minmag[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::minmag)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minmag)((eve::nan(eve::as())), T(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minmag)((eve::nan(eve::as())), v_t(1)), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::numeric]((eve::nan(eve::as())), T(1)), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minmag)(T(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minmag)(v_t(1), eve::nan(eve::as())), T(1)); - TTS_IEEE_EQUAL(eve::numeric(eve::minmag)(T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::numeric](T(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::numeric](v_t(1), eve::nan(eve::as())), T(1)); + TTS_IEEE_EQUAL(eve::minmag[eve::numeric](T(1), eve::nan(eve::as())), T(1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::minmag)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::minmag)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::minmag[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::minmag[eve::numeric](T(0), T(-0.))))); }; diff --git a/test/unit/module/core/minmax.cpp b/test/unit/module/core/minmax.cpp index dfa32e32bf..db41a28755 100644 --- a/test/unit/module/core/minmax.cpp +++ b/test/unit/module/core/minmax.cpp @@ -19,7 +19,6 @@ TTS_CASE_TPL("Check return types of minmax", eve::test::simd::all_types) TTS_EXPR_IS(eve::minmax(v_t(), T() ), (kumi::tuple) ); TTS_EXPR_IS(eve::minmax(v_t(), v_t()), (kumi::tuple) ); }; - //================================================================================================== // minmax tests //================================================================================================== @@ -31,11 +30,12 @@ TTS_CASE_WITH("Check behavior of minmax on all types full range", (T const& a0, T const& a1, M const& m) { auto[mn , mx] = eve::minmax(a0,a1); + TTS_EQUAL(mn, eve::min(a0,a1)); + TTS_EQUAL(mx, eve::max(a0,a1)); + auto[mmn,mmx] = eve::minmax[m](a0,a1); - TTS_IEEE_EQUAL (mn , eve::min(a0,a1) ); - TTS_IEEE_EQUAL (mx , eve::max(a0,a1) ); - TTS_IEEE_EQUAL (mmn, eve::min[m](a0,a1) ); - TTS_IEEE_EQUAL (mmx, eve::max[m](a0,a1) ); + TTS_EQUAL(mmn, eve::min[m](a0,a1) ); + TTS_EQUAL(mmx, eve::max[m](a0,a1) ); }; TTS_CASE_WITH ( "Check predicate version of minmax", @@ -46,7 +46,7 @@ TTS_CASE_WITH ( "Check predicate version of minmax", ) (T const& a0, T const& a1) { - TTS_EXPR_IS(eve::minmax(eve::is_less), eve::callable_minmax_); +// TTS_EXPR_IS(eve::minmax(eve::is_less), eve::callable_minmax_); auto[mn,mx] = eve::minmax(a0, a1); diff --git a/test/unit/module/core/negabsmax.cpp b/test/unit/module/core/negabsmax.cpp index e6fe16f3ec..0c41376bc6 100644 --- a/test/unit/module/core/negabsmax.cpp +++ b/test/unit/module/core/negabsmax.cpp @@ -58,13 +58,13 @@ TTS_CASE_WITH("Check behavior of negabsmax on all types full range", auto m = [](auto a, auto b, auto c) -> v_t { return -eve::abs(eve::max(a, b, c)); }; TTS_ULP_EQUAL(negabsmax((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negabsmax)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negabsmax)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negabsmax)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmax[eve::pedantic]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmax[eve::numeric]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmax[eve::saturated]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); TTS_ULP_EQUAL(negabsmax(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negabsmax)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negabsmax)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negabsmax)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmax[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmax[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmax[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(negabsmax[t](a0, a1), eve::if_else(t, negabsmax(a0, a1), a0)); }; @@ -73,28 +73,28 @@ TTS_CASE_TPL("Check values of negabsmax", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmax)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::negabsmax[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmax)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::negabsmax[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmax)(eve::nan(eve::as()), v_t(1)), + TTS_IEEE_EQUAL(eve::negabsmax[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmax)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmax)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmax)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::pedantic](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negabsmax)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negabsmax)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmax[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmax[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmax)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmax)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmax)((eve::nan(eve::as())), v_t(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmax)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmax)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmax)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::numeric](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmax[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negabsmax)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negabsmax)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmax[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmax[eve::numeric](T(0), T(-0.))))); }; diff --git a/test/unit/module/core/negabsmin.cpp b/test/unit/module/core/negabsmin.cpp index bcb8548697..7361b3bc5b 100644 --- a/test/unit/module/core/negabsmin.cpp +++ b/test/unit/module/core/negabsmin.cpp @@ -54,13 +54,13 @@ TTS_CASE_WITH("Check behavior of negabsmin on all types full range", auto m = [](auto a, auto b, auto c) -> v_t { return eve::saturated(eve::minus)(eve::abs[eve::saturated](eve::min(a, b, c))); }; TTS_ULP_EQUAL(negabsmin((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negabsmin)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negabsmin)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negabsmin)((a0), (a1), (a2)), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(negabsmin(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negabsmin)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negabsmin)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negabsmin)(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmin[eve::pedantic]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmin[eve::numeric]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negabsmin[eve::saturated]((a0), (a1), (a2)), map(m, a0, a1, a2), 2); +// TTS_ULP_EQUAL(negabsmin(kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); +// TTS_ULP_EQUAL(eve::negabsmin[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); +// TTS_ULP_EQUAL(eve::negabsmin[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); +// TTS_ULP_EQUAL(eve::negabsmin[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), map(m, a0, a1, a2), 2); TTS_IEEE_EQUAL(negabsmin[t](a0, a1), eve::if_else(t, negabsmin(a0, a1), a0)); }; @@ -69,28 +69,28 @@ TTS_CASE_TPL("Check values of negabsmin", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmin)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::negabsmin[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmin)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::negabsmin[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmin)(eve::nan(eve::as()), v_t(1)), + TTS_IEEE_EQUAL(eve::negabsmin[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmin)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmin)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negabsmin)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::pedantic](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negabsmin)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negabsmin)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmin[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmin[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmin)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmin)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmin)((eve::nan(eve::as())), v_t(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmin)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmin)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negabsmin)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::numeric](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negabsmin[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negabsmin)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negabsmin)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmin[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negabsmin[eve::numeric](T(0), T(-0.))))); }; diff --git a/test/unit/module/core/negmaxabs.cpp b/test/unit/module/core/negmaxabs.cpp index e02deb79e0..12308fbcd1 100644 --- a/test/unit/module/core/negmaxabs.cpp +++ b/test/unit/module/core/negmaxabs.cpp @@ -52,13 +52,13 @@ TTS_CASE_WITH("Check behavior of negmaxabs on all types full range", using eve::detail::map; TTS_ULP_EQUAL(negmaxabs(a0, a1, a2), -eve::maxabs(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negmaxabs)(a0, a1, a2), -eve::pedantic(eve::maxabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negmaxabs)(a0, a1, a2), -eve::numeric(eve::maxabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negmaxabs)(a0, a1, a2), -eve::saturated(eve::maxabs)(a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negmaxabs[eve::pedantic](a0, a1, a2), -eve::maxabs[eve::pedantic](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negmaxabs[eve::numeric](a0, a1, a2), -eve::maxabs[eve::numeric ](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negmaxabs[eve::saturated](a0, a1, a2), -eve::maxabs[eve::saturated](a0, a1, a2), 2); TTS_ULP_EQUAL(negmaxabs(kumi::tuple{(a0), (a1), (a2)}), negmaxabs(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negmaxabs)(kumi::tuple{(a0), (a1), (a2)}), eve::pedantic(negmaxabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negmaxabs)(kumi::tuple{(a0), (a1), (a2)}), eve::numeric(negmaxabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negmaxabs)(kumi::tuple{(a0), (a1), (a2)}), eve::saturated(negmaxabs)(a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negmaxabs[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), eve::negmaxabs[eve::pedantic](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negmaxabs[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), eve::negmaxabs[eve::numeric](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negmaxabs[eve::saturated](kumi::tuple{(a0), (a1), (a2)}),eve::negmaxabs[eve::saturated](a0, a1, a2), 2); TTS_IEEE_EQUAL(negmaxabs[t](a0, a1), eve::if_else(t, negmaxabs(a0, a1), a0)); }; @@ -67,28 +67,25 @@ TTS_CASE_TPL("Check values of negmaxabs", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::negmaxabs)(eve::nan(eve::as()), T(1)), - eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negmaxabs)(eve::nan(eve::as()), T(1)), - eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negmaxabs)(eve::nan(eve::as()), v_t(1)), - eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negmaxabs)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negmaxabs)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negmaxabs)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::pedantic](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negmaxabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negmaxabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negmaxabs[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negmaxabs[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::negmaxabs)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negmaxabs)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negmaxabs)((eve::nan(eve::as())), v_t(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negmaxabs)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negmaxabs)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negmaxabs)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::numeric](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negmaxabs[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negmaxabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negmaxabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negmaxabs[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negmaxabs[eve::numeric](T(0), T(-0.))))); }; diff --git a/test/unit/module/core/negminabs.cpp b/test/unit/module/core/negminabs.cpp index 5c063d8b2e..34d70be5ca 100644 --- a/test/unit/module/core/negminabs.cpp +++ b/test/unit/module/core/negminabs.cpp @@ -52,13 +52,13 @@ TTS_CASE_WITH("Check behavior of negminabs on all types full range", using eve::detail::map; TTS_ULP_EQUAL(negminabs(a0, a1, a2), -eve::minabs(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negminabs)(a0, a1, a2), -eve::pedantic(eve::minabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negminabs)(a0, a1, a2), -eve::numeric(eve::minabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negminabs)(a0, a1, a2), -eve::saturated(eve::minabs)(a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negminabs[eve::pedantic](a0, a1, a2), -eve::minabs[eve::pedantic](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negminabs[eve::numeric](a0, a1, a2), -eve::minabs[eve::numeric ](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negminabs[eve::saturated](a0, a1, a2), -eve::minabs[eve::saturated](a0, a1, a2), 2); TTS_ULP_EQUAL(negminabs(kumi::tuple{(a0), (a1), (a2)}), -eve::minabs(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::pedantic(negminabs)(kumi::tuple{(a0), (a1), (a2)}), -eve::pedantic(eve::minabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::numeric(negminabs)(kumi::tuple{(a0), (a1), (a2)}), -eve::numeric (eve::minabs)(a0, a1, a2), 2); - TTS_ULP_EQUAL(eve::saturated(negminabs)(kumi::tuple{(a0), (a1), (a2)}), -eve::saturated(eve::minabs)(a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negminabs[eve::pedantic](kumi::tuple{(a0), (a1), (a2)}), -eve::minabs[eve::pedantic](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negminabs[eve::numeric](kumi::tuple{(a0), (a1), (a2)}), -eve::minabs[eve::numeric](a0, a1, a2), 2); + TTS_ULP_EQUAL(eve::negminabs[eve::saturated](kumi::tuple{(a0), (a1), (a2)}), -eve::minabs[eve::saturated](a0, a1, a2), 2); TTS_IEEE_EQUAL(negminabs[t](a0, a1), eve::if_else(t, negminabs(a0, a1), a0)); }; @@ -67,28 +67,28 @@ TTS_CASE_TPL("Check values of negminabs", eve::test::simd::ieee_reals) (tts::type) { using v_t = eve::element_type_t; - TTS_IEEE_EQUAL(eve::pedantic(eve::negminabs)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::negminabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negminabs)(eve::nan(eve::as()), T(1)), + TTS_IEEE_EQUAL(eve::negminabs[eve::pedantic](eve::nan(eve::as()), T(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negminabs)(eve::nan(eve::as()), v_t(1)), + TTS_IEEE_EQUAL(eve::negminabs[eve::pedantic](eve::nan(eve::as()), v_t(1)), eve::nan(eve::as())); - TTS_IEEE_EQUAL(eve::pedantic(eve::negminabs)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negminabs)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::pedantic(eve::negminabs)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::pedantic](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::pedantic](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negminabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::pedantic(eve::negminabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negminabs[eve::pedantic](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negminabs[eve::pedantic](T(0), T(-0.))))); - TTS_IEEE_EQUAL(eve::numeric(eve::negminabs)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negminabs)((eve::nan(eve::as())), T(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negminabs)((eve::nan(eve::as())), v_t(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::numeric]((eve::nan(eve::as())), T(1)), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::numeric]((eve::nan(eve::as())), v_t(1)), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negminabs)(T(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negminabs)(v_t(1), eve::nan(eve::as())), T(-1)); - TTS_IEEE_EQUAL(eve::numeric(eve::negminabs)(T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::numeric](v_t(1), eve::nan(eve::as())), T(-1)); + TTS_IEEE_EQUAL(eve::negminabs[eve::numeric](T(1), eve::nan(eve::as())), T(-1)); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negminabs)(T(-0.), T(0))))); - TTS_EXPECT(eve::all(eve::is_negative(eve::numeric(eve::negminabs)(T(0), T(-0.))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negminabs[eve::numeric](T(-0.), T(0))))); + TTS_EXPECT(eve::all(eve::is_negative(eve::negminabs[eve::numeric](T(0), T(-0.))))); };