-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move self_greater to the is_greater callable
- Loading branch information
1 parent
08cc362
commit ba039b2
Showing
15 changed files
with
348 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/module/core/regular/abs.hpp> | ||
#include <eve/module/core/regular/if_else.hpp> | ||
#include <eve/module/core/regular/fam.hpp> | ||
#include <eve/module/core/regular/next.hpp> | ||
#include <eve/module/core/regular/max.hpp> | ||
#include <eve/traits/as_logical.hpp> | ||
#include <eve/module/core/detail/tolerance.hpp> | ||
|
||
namespace eve::detail | ||
{ | ||
template<callable_options O, value T> | ||
EVE_FORCEINLINE constexpr as_logical_t<T> is_greater_(EVE_REQUIRES(cpu_), O const & o, T a, T b) noexcept | ||
{ | ||
if constexpr(O::contains(definitely)) | ||
{ | ||
auto tol = o[definitely].value(T{}); | ||
if constexpr(integral_value<decltype(tol)>) return a > eve::next(b, tol); | ||
else return a > fam(b, tol, eve::max(eve::abs(a), eve::abs(b))); | ||
} | ||
else if constexpr (product_type<T>) | ||
{ | ||
return kumi::to_tuple(a) > kumi::to_tuple(b); | ||
} | ||
else | ||
{ | ||
if constexpr (scalar_value<T>) return as_logical_t<T>(a > b); | ||
else return map([]<typename E>(E e, E f){ return as_logical_t<E>(e > f); }, a, b); | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
include/eve/module/core/regular/impl/simd/arm/neon/is_greater.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/concept/value.hpp> | ||
#include <eve/detail/abi.hpp> | ||
#include <eve/detail/category.hpp> | ||
#include <eve/forward.hpp> | ||
|
||
namespace eve::detail | ||
{ | ||
template<callable_options O, arithmetic_scalar_value T, typename N> | ||
EVE_FORCEINLINE logical<wide<T, N>> is_greater_(EVE_REQUIRES(neon128_), O const& opts, wide<T, N> a, wide<T, N> b) noexcept | ||
requires arm_abi<abi_t<T, N>> | ||
{ | ||
if constexpr (O::contains(definitely)) | ||
{ | ||
return is_greater.behavior(cpu_{}, opts, a, b); | ||
} | ||
else | ||
{ | ||
constexpr auto cat = categorize<wide<T, N>>(); | ||
|
||
if constexpr (cat == category::int32x4) return vcgtq_s32(a, b); | ||
else if constexpr (cat == category::int16x8) return vcgtq_s16(a, b); | ||
else if constexpr (cat == category::int8x16) return vcgtq_s8(a, b); | ||
else if constexpr (cat == category::uint32x4) return vcgtq_u32(a, b); | ||
else if constexpr (cat == category::uint16x8) return vcgtq_u16(a, b); | ||
else if constexpr (cat == category::uint8x16) return vcgtq_u8(a, b); | ||
else if constexpr (cat == category::float32x4) return vcgtq_f32(a, b); | ||
else if constexpr (cat == category::int32x2) return vcgt_s32(a, b); | ||
else if constexpr (cat == category::int16x4) return vcgt_s16(a, b); | ||
else if constexpr (cat == category::int8x8) return vcgt_s8(a, b); | ||
else if constexpr (cat == category::uint32x2) return vcgt_u32(a, b); | ||
else if constexpr (cat == category::uint16x4) return vcgt_u16(a, b); | ||
else if constexpr (cat == category::uint8x8) return vcgt_u8(a, b); | ||
else if constexpr (cat == category::float32x2) return vcgt_f32(a, b); | ||
else if constexpr (current_api >= asimd) | ||
{ | ||
if constexpr (cat == category::float64x1) return vcgt_f64(a, b); | ||
else if constexpr (cat == category::int64x1) return vcgt_s64(a, b); | ||
else if constexpr (cat == category::uint64x1) return vcgt_u64(a, b); | ||
else if constexpr (cat == category::float64x2) return vcgtq_f64(a, b); | ||
else if constexpr (cat == category::int64x2) return vcgtq_s64(a, b); | ||
else if constexpr (cat == category::uint64x2) return vcgtq_u64(a, b); | ||
} | ||
else return map([]<typename E>(E e, E f){ return as_logical_t<E>(e > f); }, a, b); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
include/eve/module/core/regular/impl/simd/arm/sve/is_greater.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/concept/value.hpp> | ||
#include <eve/detail/implementation.hpp> | ||
|
||
namespace eve::detail | ||
{ | ||
template<callable_options O, typename T, typename N> | ||
EVE_FORCEINLINE logical<wide<T, N>> is_greater_(EVE_REQUIRES(sve_), O const& opts, wide<T, N> a, wide<T, N> b) noexcept | ||
requires sve_abi<abi_t<T, N>> | ||
{ | ||
if constexpr (O::contains(definitely)) return is_greater.behavior(cpu_{}, opts, a, b); | ||
else return svcmpgt(sve_true<T>(), a, b); | ||
} | ||
} |
Oops, something went wrong.