From 3b2776d4fbff358e885ccb34870607cf5062276f Mon Sep 17 00:00:00 2001 From: Joel Falcou Date: Thu, 2 Feb 2023 15:15:25 +0100 Subject: [PATCH] Use proper constant generator in optimized if_else --- .../eve/module/core/regular/impl/if_else.hpp | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/include/eve/module/core/regular/impl/if_else.hpp b/include/eve/module/core/regular/impl/if_else.hpp index 1486330c94..9cfd577c28 100644 --- a/include/eve/module/core/regular/impl/if_else.hpp +++ b/include/eve/module/core/regular/impl/if_else.hpp @@ -115,13 +115,9 @@ if_else_(EVE_SUPPORTS(cpu_), T const& cond, U const& u, Constant const& v) noexc { using tgt = as; - if constexpr( scalar_value ) return static_cast(cond) ? u : v(tgt {}); - else if constexpr( kumi::product_type ) - { - auto cst = U {kumi::map([&](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 ) return static_cast(cond) ? u : v(tgt {}); + else if constexpr( kumi::product_type ) return if_else(cond, u, v(tgt {})); + else if constexpr( current_api >= avx512 ) return if_else(cond, u, v(tgt {})); else { using cvt = as>>; @@ -165,13 +161,9 @@ if_else_(EVE_SUPPORTS(cpu_), T const& cond, Constant const& v, U const& u) noexc { using tgt = as; - if constexpr( scalar_value ) return static_cast(cond) ? v(tgt {}) : u; - else if constexpr( kumi::product_type ) - { - auto cst = U {kumi::map([&](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 ) return static_cast(cond) ? v(tgt {}) : u; + else if constexpr( kumi::product_type ) return if_else(cond, v(tgt {}), u); + else if constexpr( current_api >= avx512 ) return if_else(cond, v(tgt {}), u); else { using cvt = as>>;