Skip to content

Commit

Permalink
fix impls
Browse files Browse the repository at this point in the history
  • Loading branch information
SadiinsoSnowfall committed Dec 12, 2024
1 parent 75ec64f commit c9b000c
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

namespace eve::detail
{
template<callable_options O, typename T, typename U, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_and_(EVE_REQUIRES(sve_), O const&, logical<wide<T, N>> v, logical<wide<U, N>> w) noexcept
requires(sve_abi<abi_t<T, N>> || sve_abi<abi_t<U, N>>)
template<callable_options O, typename T, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_and_(EVE_REQUIRES(sve_), O const&, logical<wide<T, N>> v, logical<wide<T, N>> w) noexcept
requires(sve_abi<abi_t<T, N>>)
{
return svmov_z(v, convert(w, as<logical<T>>{}));
return svmov_z(v, w);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

namespace eve::detail
{
template<callable_options O, typename T, typename U, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_or_(EVE_REQUIRES(sve_), O const&, logical<wide<T, N>> v, logical<wide<U, N>> w) noexcept
requires(sve_abi<abi_t<T, N>> || sve_abi<abi_t<U, N>>)
template<callable_options O, typename T, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_or_(EVE_REQUIRES(sve_), O const&, logical<wide<T, N>> v, logical<wide<T, N>> w) noexcept
requires(sve_abi<abi_t<T, N>>)
{
return svorr_z(sve_true<T>(), v, convert(w, as<logical<T>>{}));
return svorr_z(sve_true<T>(), v, w);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

namespace eve::detail
{
template<callable_options O, typename T, typename U, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_and_(EVE_REQUIRES(rvv_), O const&, logical<wide<T, N>> a, logical<wide<U, N>> b) noexcept
requires(rvv_abi<abi_t<T, N>> || rvv_abi<abi_t<U, N>>)
template<callable_options O, typename T, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_and_(EVE_REQUIRES(rvv_), O const&, logical<wide<T, N>> a, logical<wide<T, N>> b) noexcept
requires (rvv_abi<abi_t<T, N>>)
{
return __riscv_vmand(a, bit_cast(b, as<logical<wide<T, N>>>{}), N::value);
return __riscv_vmand(a, b, N::value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

namespace eve::detail
{
template<callable_options O, typename T, typename U, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_or_(EVE_REQUIRES(rvv_), O const&, logical<wide<T, N>> a, logical<wide<U, N>> b) noexcept
requires(rvv_abi<abi_t<T, N>> || rvv_abi<abi_t<U, N>>)
template<callable_options O, typename T, typename N>
EVE_FORCEINLINE logical<wide<T, N>> logical_or_(EVE_REQUIRES(rvv_), O const&, logical<wide<T, N>> a, logical<wide<T, N>> b) noexcept
requires (rvv_abi<abi_t<T, N>>)
{
return __riscv_vmor(a, bit_cast(b, as<logical<wide<T, N>>>{}), N::value);
return __riscv_vmor(a, b, N::value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace eve::detail
}
else
{
typename logical<wide<T, N>>::storage_type dst;
typename common_logical_t<wide<T, N>, wide<U, N>>::storage_type dst;
dst.value = a.storage().value & b.storage().value;
return dst;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace eve::detail
}
else
{
typename logical<wide<T, N>>::storage_type dst;
typename common_logical_t<wide<T, N>, wide<U, N>>::storage_type dst;
dst.value = a.storage().value | b.storage().value;
return dst;
}
Expand Down
17 changes: 4 additions & 13 deletions include/eve/module/core/regular/impl/simd/x86/logical_xor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,10 @@

namespace eve::detail
{
template<arithmetic_scalar_value T, typename N, scalar_value U, callable_options O>
EVE_FORCEINLINE auto logical_xor_(EVE_REQUIRES(avx512_),
O const& ,
logical<wide<T,N>> const& a,
logical<wide<U,N>> const& b) noexcept
requires ( x86_abi<abi_t<T,N>> || x86_abi<abi_t<U,N>>)
template<arithmetic_scalar_value T, typename N, callable_options O>
EVE_FORCEINLINE auto logical_xor_(EVE_REQUIRES(avx512_), O const&, logical<wide<T, N>> a, logical<wide<T, N>> b) noexcept
requires (x86_abi<abi_t<T, N>>)
{
if constexpr(std::same_as<T,U>)
{
return logical<wide<T,N>>(a.storage() ^ b.storage());
}
else
{
return logical_xor(a, convert(b,as<logical<T>>{})); }
return logical<wide<T, N>>{a.storage() ^ b.storage()};
}
}
3 changes: 1 addition & 2 deletions include/eve/module/core/regular/logical_andnot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ namespace eve
EVE_FORCEINLINE constexpr common_logical_t<T, U> logical_andnot_(EVE_REQUIRES(cpu_), O const&, T a, U b) noexcept
requires (bool_or_scalar<T> && bool_or_scalar<U>) || (std::same_as<T, U>)
{
if constexpr (bool_or_scalar<T>) return a && !b;
else return bit_cast(a.bits() & (!b).bits(), as<T>{});
return a && !b;
}
}
}
3 changes: 1 addition & 2 deletions include/eve/module/core/regular/logical_notand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ namespace eve
EVE_FORCEINLINE constexpr common_logical_t<T, U> logical_notand_(EVE_REQUIRES(cpu_), O const&, T a, U b) noexcept
requires (bool_or_scalar<T> && bool_or_scalar<U>) || (std::same_as<T, U>)
{
if constexpr (bool_or_scalar<T>) return !a && b;
else return bit_cast((!a).bits() & b.bits(), as<T>{});
return !a && b;
}
}
}
3 changes: 1 addition & 2 deletions include/eve/module/core/regular/logical_notor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ namespace eve
EVE_FORCEINLINE constexpr common_logical_t<T, U> logical_notor_(EVE_REQUIRES(cpu_), O const&, T a, U b) noexcept
requires (bool_or_scalar<T> && bool_or_scalar<U>) || (std::same_as<T, U>)
{
if constexpr (bool_or_scalar<T>) return !a || b;
else return bit_cast((!a).bits() | b.bits(), as<T>{});
return !a || b;
}
}
}
3 changes: 1 addition & 2 deletions include/eve/module/core/regular/logical_ornot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ namespace eve
EVE_FORCEINLINE constexpr common_logical_t<T, U> logical_ornot_(EVE_REQUIRES(cpu_), O const&, T a, U b) noexcept
requires (bool_or_scalar<T> && bool_or_scalar<U>) || (std::same_as<T, U>)
{
if constexpr (bool_or_scalar<T>) return a || !b;
else return bit_cast(a.bits() | (!b).bits(), as<T>{});
return a || !b;
}
}
}

0 comments on commit c9b000c

Please sign in to comment.