-
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.
- Loading branch information
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
include/eve/module/core/regular/impl/simd/arm/sve/sqrt.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,44 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/arch/arm/sve/sve_true.hpp> | ||
#include <eve/concept/value.hpp> | ||
#include <eve/detail/category.hpp> | ||
#include <eve/detail/implementation.hpp> | ||
|
||
namespace eve::detail | ||
{ | ||
template<floating_real_scalar_value T, typename N> | ||
EVE_FORCEINLINE auto | ||
sqrt_(EVE_SUPPORTS(sve_), wide<T, N> const& v) noexcept -> wide<T, N> | ||
requires sve_abi<abi_t<T, N>> | ||
{ | ||
return svsqrt_x(sve_true<T>(), v); | ||
} | ||
|
||
// ----------------------------------------------------------------------------------------------- | ||
// Masked case | ||
template<conditional_expr C, value V> | ||
EVE_FORCEINLINE auto | ||
sqrt_(EVE_SUPPORTS(sve_), C const& cond, V const& v) noexcept -> V | ||
requires sve_abi<typename V::abi_type> | ||
{ | ||
if constexpr(C::is_complete) | ||
{ | ||
if constexpr(C::is_inverted) return alternative(cond, v, as<V> {}); | ||
else return sqrt(v); | ||
} | ||
else | ||
{ | ||
auto src = alternative(cond, v, as<V> {}); | ||
auto m = expand_mask(cond, as<V> {}); | ||
return svsqrt_m(src, m, v); | ||
} | ||
} | ||
} |
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