Skip to content

Commit

Permalink
Use proper constant generator in optimized if_else
Browse files Browse the repository at this point in the history
  • Loading branch information
jfalcou authored Feb 2, 2023
1 parent 2ab9f8c commit 59d1d7b
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions include/eve/module/core/regular/impl/if_else.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,9 @@ if_else_(EVE_SUPPORTS(cpu_), T const& cond, U const& u, Constant const& v) noexc
{
using tgt = as<U>;

if constexpr( scalar_value<T> ) return static_cast<bool>(cond) ? u : v(tgt {});
else if constexpr( kumi::product_type<U> )
{
auto cst = U {kumi::map([&]<typename M>(M const& e) { return v(as(e)); }, u)};
return if_else(cond, u, cst);
}
else if constexpr( current_api >= avx512 ) return if_else(cond, u, v(tgt {}));
if constexpr( scalar_value<T> ) return static_cast<bool>(cond) ? u : v(tgt {});
else if constexpr( kumi::product_type<U> ) return if_else(cond, u, v(tgt {}));
else if constexpr( current_api >= avx512 ) return if_else(cond, u, v(tgt {}));
else
{
using cvt = as<as_logical_t<element_type_t<U>>>;
Expand Down Expand Up @@ -165,13 +161,9 @@ if_else_(EVE_SUPPORTS(cpu_), T const& cond, Constant const& v, U const& u) noexc
{
using tgt = as<U>;

if constexpr( scalar_value<T> ) return static_cast<bool>(cond) ? v(tgt {}) : u;
else if constexpr( kumi::product_type<U> )
{
auto cst = U {kumi::map([&]<typename M>(M const& e) { return v(as(e)); }, u)};
return if_else(cond, cst, u);
}
else if constexpr( current_api >= avx512 ) return if_else(cond, v(tgt {}), u);
if constexpr( scalar_value<T> ) return static_cast<bool>(cond) ? v(tgt {}) : u;
else if constexpr( kumi::product_type<U> ) return if_else(cond, v(tgt {}), u);
else if constexpr( current_api >= avx512 ) return if_else(cond, v(tgt {}), u);
else
{
using cvt = as<as_logical_t<element_type_t<U>>>;
Expand Down

0 comments on commit 59d1d7b

Please sign in to comment.