diff --git a/include/eve/module/core/regular/logical_and.hpp b/include/eve/module/core/regular/logical_and.hpp index 5d8f1f5efd..14a24cd00b 100644 --- a/include/eve/module/core/regular/logical_and.hpp +++ b/include/eve/module/core/regular/logical_and.hpp @@ -88,7 +88,11 @@ namespace eve else if constexpr (std::same_as) return logical_and(U{a}, b); else if constexpr (std::same_as) return logical_and(a, T{b}); else if constexpr (logical_simd_value && scalar_value) return logical_and(a, T{b}); - else if constexpr (scalar_value && logical_simd_value) return logical_and(b, U{a}); + else if constexpr (scalar_value && logical_simd_value) + { + using lw_t = as_logical_t>; + return logical_and(lw_t{a}, lw_t{b}); + } else if constexpr (std::same_as) { if constexpr (scalar_value && scalar_value) return T{a && b}; diff --git a/include/eve/traits/common_value.hpp b/include/eve/traits/common_value.hpp index f6519f8c8a..c14f23513a 100644 --- a/include/eve/traits/common_value.hpp +++ b/include/eve/traits/common_value.hpp @@ -97,9 +97,9 @@ namespace eve::detail ) { if constexpr (std::same_as && std::same_as) return find_common_logical_reducer{}; else if constexpr (simd_value) return find_common_logical_reducer>{}; - else if constexpr (simd_value) return find_common_logical_reducer>{}; else if constexpr (std::same_as) return find_common_logical_reducer>{}; else if constexpr (std::same_as) return find_common_logical_reducer>{}; + else if constexpr (simd_value) return find_common_logical_reducer>>{}; else if constexpr (scalar_value) return find_common_logical_reducer>{}; else return find_common_logical_reducer{}; } diff --git a/test/unit/meta/traits/common_logical.cpp b/test/unit/meta/traits/common_logical.cpp index 32d61b9703..cd34e0f58c 100644 --- a/test/unit/meta/traits/common_logical.cpp +++ b/test/unit/meta/traits/common_logical.cpp @@ -61,21 +61,24 @@ TTS_CASE_TPL("eve::common_logical on wide x wide" ) ( tts::type> ) { - using Wt = eve::wide; - using Wu = eve::wide; + using Wt = eve::wide>; + using Wu = eve::wide>; + using LWt = eve::logical; + using LWu = eve::logical; - TTS_TYPE_IS((eve::common_logical_t), eve::logical); - TTS_TYPE_IS((eve::common_logical_t>), eve::logical); - TTS_TYPE_IS((eve::common_logical_t, Wu>), eve::logical); - TTS_TYPE_IS((eve::common_logical_t, eve::logical>), eve::logical); + TTS_TYPE_IS((eve::common_logical_t), LWt); + TTS_TYPE_IS((eve::common_logical_t), LWt); + TTS_TYPE_IS((eve::common_logical_t), LWt); + TTS_TYPE_IS((eve::common_logical_t), LWt); - TTS_TYPE_IS((eve::common_logical_t), eve::logical); - TTS_TYPE_IS((eve::common_logical_t>), eve::logical); - TTS_TYPE_IS((eve::common_logical_t, Wu>), eve::logical); - TTS_TYPE_IS((eve::common_logical_t, eve::logical>), eve::logical); + // ensure compatibility with eve::detail::map + TTS_TYPE_IS((eve::common_logical_t), LWt); + TTS_TYPE_IS((eve::common_logical_t), LWt); + TTS_TYPE_IS((eve::common_logical_t, Wu>), LWt); + TTS_TYPE_IS((eve::common_logical_t, LWu>), LWt); - TTS_TYPE_IS((eve::common_logical_t), eve::logical); - TTS_TYPE_IS((eve::common_logical_t>), eve::logical); - TTS_TYPE_IS((eve::common_logical_t, U>), eve::logical); - TTS_TYPE_IS((eve::common_logical_t, eve::logical>), eve::logical); + TTS_TYPE_IS((eve::common_logical_t), LWt); + TTS_TYPE_IS((eve::common_logical_t>), LWt); + TTS_TYPE_IS((eve::common_logical_t), LWt); + TTS_TYPE_IS((eve::common_logical_t>), LWt); };