7template <
typename T,
typename A =
void>
9 static constexpr bool value =
false;
22struct is_vectorizable_type<T, typename std::enable_if_t<std::is_same<hila::arithmetic_type<T>, int>::value>> {
23 static constexpr bool value =
true;
26struct is_vectorizable_type<T, typename std::enable_if_t<std::is_same<hila::arithmetic_type<T>, unsigned int>::value>> {
27 static constexpr bool value =
true;
30struct is_vectorizable_type<T, typename std::enable_if_t<std::is_same<hila::arithmetic_type<T>, int64_t>::value>> {
31 static constexpr bool value =
true;
34struct is_vectorizable_type<T, typename std::enable_if_t<std::is_same<hila::arithmetic_type<T>, uint64_t>::value>> {
35 static constexpr bool value =
true;
38struct is_vectorizable_type<T, typename std::enable_if_t<std::is_same<hila::arithmetic_type<T>, float>::value>> {
39 static constexpr bool value =
true;
42struct is_vectorizable_type<T, typename std::enable_if_t<std::is_same<hila::arithmetic_type<T>, double>::value>> {
43 static constexpr bool value =
true;
48template <
int vector_size>
53template <
typename T,
int vector_len>
struct vector_base_type {};
55template <>
struct vector_base_type<int,4> {
using type =
Vec4i; };
56template <>
struct vector_base_type<double, 4> {
using type = Vec4d; };
57template <>
struct vector_base_type<double, 8> {
using type = Vec8d; };
58template <>
struct vector_base_type<float, 8> {
using type = Vec8f; };
59template <>
struct vector_base_type<float, 16> {
using type = Vec16f; };
60template <>
struct vector_base_type<int, 8> {
using type = Vec8i; };
61template <>
struct vector_base_type<unsigned int, 8> {
using type = Vec8ui; };
62template <>
struct vector_base_type<int, 16> {
using type = Vec16i; };
63template <>
struct vector_base_type<unsigned int, 16> {
using type = Vec16ui; };
64template <>
struct vector_base_type<int64_t, 4> {
using type = Vec4q; };
65template <>
struct vector_base_type<uint64_t, 4> {
using type = Vec4uq; };
66template <>
struct vector_base_type<int64_t, 8> {
using type = Vec8q; };
67template <>
struct vector_base_type<uint64_t, 8> {
using type = Vec8uq; };
84template <
typename T,
typename A =
void>
86 static constexpr bool is_vectorizable =
false;
89 static constexpr int vector_size = 1;
93 static constexpr int elements = 1;
95 static constexpr int base_type_size =
sizeof(base_type);
102struct vector_info<T, typename std::enable_if_t<hila::is_vectorizable_type<T>::value>> {
103 static constexpr bool is_vectorizable =
true;
105 using base_type = hila::arithmetic_type<T>;
107 static constexpr int vector_size = VECTOR_SIZE /
sizeof(base_type);
109 using type =
typename vector_base_type<base_type, vector_size>::type;
111 static constexpr int elements =
sizeof(T) /
sizeof(base_type);
113 static constexpr int base_type_size =
sizeof(base_type);
Implement hila::swap for gauge fields.
is_vectorizable_type<T>::value is always false if the target is not vectorizable