Skip to content

Commit

Permalink
marked constexpr-only function as consteval
Browse files Browse the repository at this point in the history
  • Loading branch information
SadiinsoSnowfall committed Nov 24, 2024
1 parent b05416f commit c8ed87f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions include/eve/arch/cpu/top_bits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ namespace detail
else return movemask(logical_type{}).first;
}

EVE_FORCEINLINE static constexpr std::ptrdiff_t bits_per_element_impl()
EVE_FORCEINLINE static consteval std::ptrdiff_t bits_per_element_impl()
{
if constexpr ( is_aggregated ) return top_bits<half_logical>::bits_per_element;
else return decltype(movemask(logical_type{}).second){}();
}

static constexpr bool is_cheap_impl()
static consteval bool is_cheap_impl()
{
if constexpr ( has_emulated_abi_v<logical_type> ) return true;
else if constexpr ( is_aggregated ) return top_bits<half_logical>::is_cheap;
Expand Down
8 changes: 4 additions & 4 deletions include/eve/module/core/named_shuffles/blend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace eve
struct blend_t
{
template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t... I>
static constexpr auto pattern(eve::as<T>, eve::as<T>, eve::fixed<G>, pattern_t<I...>)
static consteval auto pattern(eve::as<T>, eve::as<T>, eve::fixed<G>, pattern_t<I...>)
{
static_assert(((0 <= I && I <= 1) && ...), "pattern for blend has to only contain 0 and 1");
static_assert(pattern_t<I...>::size() * G == T::size(), "pattern has wrong number of elements");
Expand All @@ -82,7 +82,7 @@ struct blend_t
}

template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t... I>
static constexpr std::ptrdiff_t level(eve::as<T>, eve::as<T>, eve::fixed<G> g, pattern_t<I...> p)
static consteval std::ptrdiff_t level(eve::as<T>, eve::as<T>, eve::fixed<G> g, pattern_t<I...> p)
{
if constexpr( sizeof...(I) == 1 ) return 0;
else if constexpr( eve::has_aggregated_abi_v<T> )
Expand Down Expand Up @@ -142,14 +142,14 @@ struct blend_t
}

template<simd_value T, std::ptrdiff_t G>
static constexpr auto
static consteval auto
pattern(eve::as<T> tgt, eve::as<T>, eve::fixed<G> g, pattern_formula auto gen)
{
return pattern(tgt, tgt, g, fix_pattern<T::size() / G>(gen));
}

template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t... I>
static constexpr auto level(eve::as<T> tgt, eve::as<T>, eve::fixed<G> g, pattern_formula auto gen)
static consteval auto level(eve::as<T> tgt, eve::as<T>, eve::fixed<G> g, pattern_formula auto gen)
{
return level(tgt, tgt, g, fix_pattern<T::size() / G>(gen));
}
Expand Down
4 changes: 2 additions & 2 deletions include/eve/module/core/named_shuffles/broadcast_lane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ namespace eve
struct broadcast_lane_t
{
template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t I>
static constexpr auto pattern(eve::as<T>, eve::fixed<G>, eve::index_t<I>)
static consteval auto pattern(eve::as<T>, eve::fixed<G>, eve::index_t<I>)
{
static_assert(I < T::size() / G);
return eve::fix_pattern<T::size() / G>([](int, int) { return I; });
}

template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t I>
static constexpr std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g, eve::index_t<I> i)
static consteval std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g, eve::index_t<I> i)
{
constexpr std::size_t reg_size = sizeof(element_type_t<T>) * T::size();
constexpr std::ptrdiff_t g_size = sizeof(element_type_t<T>) * G;
Expand Down
4 changes: 2 additions & 2 deletions include/eve/module/core/named_shuffles/reverse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ namespace eve
//================================================================================================
struct reverse_t
{
template<simd_value T, std::ptrdiff_t G> static constexpr auto pattern(eve::as<T>, eve::fixed<G>)
template<simd_value T, std::ptrdiff_t G> static consteval auto pattern(eve::as<T>, eve::fixed<G>)
{
return eve::fix_pattern<T::size() / G>([](int i, int size) { return size - i - 1; });
}

template<simd_value T, std::ptrdiff_t G>
static constexpr std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g)
static consteval std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g)
{
if constexpr( eve::has_aggregated_abi_v<T> )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace eve
struct reverse_in_subgroups_t
{
template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t SubG>
static constexpr auto pattern(eve::as<T>, eve::fixed<G>, eve::fixed<SubG>)
static consteval auto pattern(eve::as<T>, eve::fixed<G>, eve::fixed<SubG>)
{
static_assert(SubG <= T::size() / G);
static_assert(SubG >= 1);
Expand All @@ -77,7 +77,7 @@ struct reverse_in_subgroups_t
}

template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t SubG>
static constexpr std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g, eve::fixed<SubG> sub_g)
static consteval std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g, eve::fixed<SubG> sub_g)
{
constexpr std::ptrdiff_t g_size = sizeof(element_type_t<T>) * G;
constexpr std::size_t sub_size = g_size * SubG;
Expand Down
6 changes: 3 additions & 3 deletions include/eve/module/core/named_shuffles/slide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ struct slide_left_impl_t
{
// One agr
template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t S>
static constexpr auto pattern(eve::as<T>, eve::fixed<G>, eve::index_t<S>)
static consteval auto pattern(eve::as<T>, eve::fixed<G>, eve::index_t<S>)
{
static_assert(G > 0 && 0 <= S && S <= T::size() / G);
return eve::fix_pattern<T::size() / G>([](int i, int n) { return (i + S) < n ? i + S : na_; });
}

template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t S_>
static constexpr std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g, eve::index_t<S_> s)
static consteval std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g, eve::index_t<S_> s)
{
using abi_t = typename T::abi_type;
constexpr std::size_t reg_size = sizeof(element_type_t<T>) * T::size();
Expand Down Expand Up @@ -133,7 +133,7 @@ struct slide_left_impl_t
// Two args

template<simd_value T, std::ptrdiff_t G, std::ptrdiff_t S_>
static constexpr std::ptrdiff_t
static consteval std::ptrdiff_t
level(eve::as<T> tgt, eve::as<T>, eve::fixed<G> g, eve::index_t<S_> s)
{
using abi_t = typename T::abi_type;
Expand Down
4 changes: 2 additions & 2 deletions include/eve/module/core/named_shuffles/swap_adjacent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace eve
struct swap_adjacent_t
{
template<simd_value T, std::ptrdiff_t G>
static constexpr auto pattern(eve::as<T>, eve::fixed<G>)
static consteval auto pattern(eve::as<T>, eve::fixed<G>)
requires(G < T::size())
{
return eve::fix_pattern<T::size() / G>(
Expand All @@ -65,7 +65,7 @@ struct swap_adjacent_t
}

template<simd_value T, std::ptrdiff_t G>
static constexpr std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g)
static consteval std::ptrdiff_t level(eve::as<T> tgt, eve::fixed<G> g)
{
constexpr std::ptrdiff_t g_size = sizeof(element_type_t<T>) * G;
constexpr std::size_t reg_size = sizeof(element_type_t<T>) * T::size();
Expand Down

0 comments on commit c8ed87f

Please sign in to comment.