Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/xsimd/arch/xsimd_emulated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ namespace xsimd
return { typename batch<T, emulated<N>>::register_type { static_cast<T>(values)... } };
}

template <class A, class T, size_t N, class... Values>
// no A parameter: callers pass no explicit template argument, so deduction stays constrained
template <class T, size_t N, class... Values>
XSIMD_INLINE batch_bool<T, emulated<N>> set(batch_bool<T, emulated<N>> const&, requires_arch<emulated<N>>, Values... values) noexcept
{
static_assert(sizeof...(Values) == batch<T, emulated<N>>::size, "consistent init");
Expand Down
5 changes: 3 additions & 2 deletions include/xsimd/types/xsimd_batch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ namespace xsimd
template <class T, class A>
template <class... Ts>
XSIMD_INLINE batch_bool<T, A>::batch_bool(bool val0, bool val1, Ts... vals) noexcept
: batch_bool(kernel::set<A>(batch_bool {}, A {}, val0, val1, static_cast<bool>(vals)...))
: batch_bool(make_register(std::index_sequence<> {}, val0, val1, static_cast<bool>(vals)...))
{
static_assert(sizeof...(Ts) + 2 == size, "The constructor requires as many arguments as batch elements.");
}
Expand Down Expand Up @@ -1387,7 +1387,8 @@ namespace xsimd
template <class... V>
XSIMD_INLINE auto batch_bool<T, A>::make_register(std::index_sequence<>, V... v) noexcept -> register_type
{
return kernel::set<A>(batch_bool<T, A>(), A {}, v...).data;
// no explicit template argument here: kernel::set<A> would instantiate unrelated register types
return kernel::set(batch_bool<T, A>(), A {}, v...).data;
}

/*******************************
Expand Down
16 changes: 16 additions & 0 deletions test/test_batch_bool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,4 +1002,20 @@ TEST_CASE_TEMPLATE("batch_bool mask hygiene", B, BATCH_TYPES)
}
}

#if XSIMD_WITH_EMULATED
TEST_CASE("emulated batch_bool construction")
{
using M = xsimd::batch_bool<float, xsimd::emulated<96>>;

M const all_true(true);
CHECK(all_true.get(0));
CHECK(all_true.get(M::size - 1));

M const lanes(true, false, true);
CHECK(lanes.get(0));
CHECK_FALSE(lanes.get(1));
CHECK(lanes.get(2));
}
#endif

#endif
Loading