Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made combine into a new format callable #2059

Merged
merged 4 commits into from
Feb 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions include/eve/module/core/regular/combine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,55 @@

#include <eve/concept/value.hpp>
#include <eve/detail/overload.hpp>
#include <eve/traits/as_wide.hpp>
#include <eve/traits/cardinal.hpp>

namespace eve
{
//TODO DOC
//================================================================================================
//! @addtogroup core_simd
//! @{
//! @var combine
//! @brief Computes the TODO
//!
//! **Defined in Header**
//!
//! @code
//! #include <eve/module/core.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace eve
//! {
//! TODO
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x`: An instance of an [SIMD value](@ref eve::simd_value)
//!
//! **Return value**
//!
//! * TODO
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/combine.cpp}
//! @}
//================================================================================================
EVE_MAKE_CALLABLE(combine_, combine);
}
template<typename Options>
struct combine_t : callable<combine_t, Options>
{
template<simd_value T>
constexpr EVE_FORCEINLINE typename T::combined_type operator()(T a, T b) const noexcept
{
return typename T::combined_type{a, b};
}
};

namespace eve::detail
{
template<value T>
EVE_FORCEINLINE auto
combine_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept
{
return as_wide_t<T, typename cardinal_t<T>::combined_type>(a, b);
}
//================================================================================================
//! @addtogroup core_simd
//! @{
//! @var combine
//! @brief Combines two SIMD values in a larger one
//!
//! **Defined in Header**
//!
//! @code
//! #include <eve/module/core.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace eve
//! {
//! template<simd_value W>
//! typename W::combined_type combine(W a, W b) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `a`, `b`: two SIMD values of the same type and cardinal
//!
//! **Return value**
//!
//! * A [SIMD value](@ref eve::simd_value) contains the parameters concatenation, thus
//! producing a register of twice as many elements.
//!
//! @groupheader{Example}
//! @godbolt{doc/core/combine.cpp}
//================================================================================================
inline constexpr auto combine = functor<combine_t>;
//================================================================================================
//! @}
//================================================================================================
}