Skip to content

Commit a3a2b8e

Browse files
tomjnixonserge-sans-paille
authored andcommitted
add basic test for fast_cast selection
1 parent 76e9d8b commit a3a2b8e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_batch_cast.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ namespace detail
5151
{
5252
return true;
5353
}
54+
55+
template <typename Arch, typename From, typename To>
56+
using uses_fast_cast = std::is_same<xsimd::kernel::detail::conversion_type<Arch, From, To>,
57+
xsimd::kernel::detail::with_fast_conversion>;
5458
}
5559

5660
template <class CP>
@@ -349,3 +353,14 @@ TYPED_TEST(batch_cast_test, cast_sizeshift2)
349353
this->test_cast_sizeshift2();
350354
}
351355
#endif
356+
357+
#if XSIMD_WITH_SSE2
358+
TEST(batch_cast, uses_fast_cast)
359+
{
360+
using A = xsimd::default_arch;
361+
static_assert(detail::uses_fast_cast<A, int32_t, float>::value,
362+
"expected int32 to float conversion to use fast_cast");
363+
static_assert(detail::uses_fast_cast<A, float, int32_t>::value,
364+
"expected float to int32 conversion to use fast_cast");
365+
}
366+
#endif

0 commit comments

Comments
 (0)