Skip to content

Commit

Permalink
Fix interleave
Browse files Browse the repository at this point in the history
  • Loading branch information
jfalcou committed Nov 29, 2022
1 parent b99104e commit b5e5e14
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions include/eve/detail/function/simd/common/interleave.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ namespace eve::detail
EVE_FORCEINLINE auto interleave_(EVE_SUPPORTS(cpu_),T v0, Ts... vs) noexcept
{
auto const values = kumi::make_tuple(v0,vs...);
constexpr auto nb = 1 + sizeof...(Ts);
static constexpr auto nb = 1 + sizeof...(Ts);

using ABI = abi_t<element_type_t<T>, eve::fixed<T::size()>>;
constexpr bool is_bit_logical = logical_simd_value<T> && !ABI::is_wide_logical;

if constexpr (T::size() == 1) return values;
else if constexpr ( nb == 4 && (sizeof(eve::element_type_t<T>) < 8) && !is_bit_logical )
else if constexpr (nb == 4 && (sizeof(eve::element_type_t<T>) < 8) && !is_bit_logical)
{
auto a = v0;
auto b = get<1>(values);
auto c = get<2>(values);
auto d = get<3>(values);
auto b = kumi::get<1>(values);
auto c = kumi::get<2>(values);
auto d = kumi::get<3>(values);

auto [ab0, ab1] = interleave(a, b);
auto [cd0, cd1] = interleave(c, d);
Expand All @@ -51,12 +51,11 @@ namespace eve::detail
}
else
{
constexpr auto card = T::size();

return [&]<std::size_t... J>(std::index_sequence<J...>)
{
return kumi::make_tuple
( [&]<std::size_t O, std::size_t... I>
(
[&]<std::size_t O, std::size_t... I>
(std::index_sequence<I...>, std::integral_constant<std::size_t,O>)
{
/*
Expand All @@ -70,8 +69,9 @@ namespace eve::detail
- g++ and clang are able to turn this mess into an intrinsic based code if able
- special cases are optimized in their respective arch file
*/
constexpr auto card = T::size();
return T{ kumi::get<((I+card*O)%nb)>(values).get((I+card*O)/nb)... };
}( std::make_index_sequence<card>{}, std::integral_constant<std::size_t,J>{})...
}( std::make_index_sequence<T::size()>{}, std::integral_constant<std::size_t,J>{})...
);
}( std::make_index_sequence<nb>{});
}
Expand Down

0 comments on commit b5e5e14

Please sign in to comment.