Skip to content

Commit

Permalink
[simd] Support full abi and type for test
Browse files Browse the repository at this point in the history
[simd] Support using meta type in test_all_simd()

[simd] Rename deduce.cpp to deduce.pass.cpp

[simd] fix test_util.h
 1. using scalar instead of __scalar for abi
 2. specified the vectorizable type
* [ref] https://en.cppreference.com/w/cpp/types/is_integral
* [ref] https://en.cppreference.com/w/cpp/types/is_floating_point
  • Loading branch information
fepicture committed Aug 3, 2022
1 parent d79fd0f commit 0379b9a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions libcxx/test/std/experimental/simd/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,35 @@

namespace ex = std::experimental::parallelism_v2;

template <class F>
void test_simd() {}
template <class F, class _Tp, class Simd, class... Simds>
void test_simd_abi();

template <class F, class Simd, class... Simds>
void test_simd() {
F{}.template operator()<Simd>();
test_simd<F, Simds...>();
template <class F, class _Tp>
void test_all_simd_abi() {
using namespace ex;
// TODO: generate number sequence to test different length `simd abi`
test_simd_abi<F, _Tp, simd_abi::native<_Tp>, simd_abi::fixed_size<42>, simd_abi::scalar, simd_abi::compatible<_Tp>,
simd_abi::deduce_t<_Tp, 42> >();
}

template <class F>
void test_all_simd() {
using namespace ex;
using namespace ex::simd_abi;

// clang-format off
test_simd<F,
// public ABIs
native_simd<int>,
fixed_size_simd<int, 4>,
fixed_size_simd<int, 15>,

// private ABIs
simd<int, __scalar>,
simd<int, __vec_ext<4>>
>();
// clang-format on
void test_all_simd_abi() {
test_all_simd_abi<F, long double>();
test_all_simd_abi<F, double>();
test_all_simd_abi<F, float>();
test_all_simd_abi<F, long long>();
test_all_simd_abi<F, unsigned long long>();
test_all_simd_abi<F, long>();
test_all_simd_abi<F, unsigned long>();
test_all_simd_abi<F, int>();
test_all_simd_abi<F, unsigned int>();
test_all_simd_abi<F, short>();
test_all_simd_abi<F, unsigned short>();
test_all_simd_abi<F, wchar_t>();
test_all_simd_abi<F, signed char>();
test_all_simd_abi<F, unsigned char>();
test_all_simd_abi<F, char32_t>();
test_all_simd_abi<F, char16_t>();
}

#endif // TEST_UTIL_H

0 comments on commit 0379b9a

Please sign in to comment.