32 #ifndef MCKL_RANDOM_INTERNAL_INCREMENT_AVX512_64_4_HPP 33 #define MCKL_RANDOM_INTERNAL_INCREMENT_AVX512_64_4_HPP 46 static constexpr std::size_t K_ = 1;
49 static void eval(
const std::array<T, K_> &ctr, std::array<__m512i, 4> &s)
52 _mm512_set1_epi64(static_cast<MCKL_INT64>(std::get<0>(ctr)));
54 std::get<0>(s) = _mm512_add_epi64(c,
55 _mm512_set_epi64(0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01));
56 std::get<1>(s) = _mm512_add_epi64(c,
57 _mm512_set_epi64(0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09));
58 std::get<2>(s) = _mm512_add_epi64(c,
59 _mm512_set_epi64(0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11));
60 std::get<3>(s) = _mm512_add_epi64(c,
61 _mm512_set_epi64(0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19));
68 static constexpr std::size_t K_ = 2;
71 static void eval(
const std::array<T, K_> &ctr, std::array<__m512i, 4> &s)
73 __m512i c = _mm512_set_epi64(static_cast<MCKL_INT64>(std::get<1>(ctr)),
74 static_cast<MCKL_INT64>(std::get<0>(ctr)),
75 static_cast<MCKL_INT64>(std::get<1>(ctr)),
76 static_cast<MCKL_INT64>(std::get<0>(ctr)),
77 static_cast<MCKL_INT64>(std::get<1>(ctr)),
78 static_cast<MCKL_INT64>(std::get<0>(ctr)),
79 static_cast<MCKL_INT64>(std::get<1>(ctr)),
80 static_cast<MCKL_INT64>(std::get<0>(ctr)));
82 std::get<0>(s) = _mm512_add_epi64(
83 c, _mm512_set_epi64(0, 0x04, 0, 0x03, 0, 0x02, 0, 0x01));
84 std::get<1>(s) = _mm512_add_epi64(
85 c, _mm512_set_epi64(0, 0x08, 0, 0x07, 0, 0x06, 0, 0x05));
86 std::get<2>(s) = _mm512_add_epi64(
87 c, _mm512_set_epi64(0, 0x0C, 0, 0x0B, 0, 0x0A, 0, 0x09));
88 std::get<3>(s) = _mm512_add_epi64(
89 c, _mm512_set_epi64(0, 0x10, 0, 0x0F, 0, 0x0E, 0, 0x0D));
96 static constexpr std::size_t K_ = 4;
99 static void eval(
const std::array<T, K_> &ctr, std::array<__m512i, 4> &s)
101 __m512i c = _mm512_set_epi64(static_cast<MCKL_INT64>(std::get<3>(ctr)),
102 static_cast<MCKL_INT64>(std::get<2>(ctr)),
103 static_cast<MCKL_INT64>(std::get<1>(ctr)),
104 static_cast<MCKL_INT64>(std::get<0>(ctr)),
105 static_cast<MCKL_INT64>(std::get<3>(ctr)),
106 static_cast<MCKL_INT64>(std::get<2>(ctr)),
107 static_cast<MCKL_INT64>(std::get<1>(ctr)),
108 static_cast<MCKL_INT64>(std::get<0>(ctr)));
111 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 2, 0, 0, 0, 1));
113 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 4, 0, 0, 0, 3));
115 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 6, 0, 0, 0, 5));
117 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 8, 0, 0, 0, 7));
121 template <
typename T>
124 static constexpr std::size_t K_ = 8;
127 static void eval(
const std::array<T, K_> &ctr, std::array<__m512i, 4> &s)
129 __m512i c = _mm512_set_epi64(static_cast<MCKL_INT64>(std::get<7>(ctr)),
130 static_cast<MCKL_INT64>(std::get<6>(ctr)),
131 static_cast<MCKL_INT64>(std::get<5>(ctr)),
132 static_cast<MCKL_INT64>(std::get<4>(ctr)),
133 static_cast<MCKL_INT64>(std::get<3>(ctr)),
134 static_cast<MCKL_INT64>(std::get<2>(ctr)),
135 static_cast<MCKL_INT64>(std::get<1>(ctr)),
136 static_cast<MCKL_INT64>(std::get<0>(ctr)));
139 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 0, 0, 0, 0, 1));
141 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 0, 0, 0, 0, 2));
143 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 0, 0, 0, 0, 3));
145 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 0, 0, 0, 0, 4));
149 template <
typename T>
152 static constexpr std::size_t K_ = 16;
155 static void eval(
const std::array<T, K_> &ctr, std::array<__m512i, 4> &s)
158 _mm512_set_epi64(static_cast<MCKL_INT64>(std::get<0x7>(ctr)),
159 static_cast<MCKL_INT64>(std::get<0x5>(ctr)),
160 static_cast<MCKL_INT64>(std::get<0x5>(ctr)),
161 static_cast<MCKL_INT64>(std::get<0x4>(ctr)),
162 static_cast<MCKL_INT64>(std::get<0x3>(ctr)),
163 static_cast<MCKL_INT64>(std::get<0x2>(ctr)),
164 static_cast<MCKL_INT64>(std::get<0x1>(ctr)),
165 static_cast<MCKL_INT64>(std::get<0x0>(ctr)));
168 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 0, 0, 0, 0, 1));
170 _mm512_set_epi64(static_cast<MCKL_INT64>(std::get<0xF>(ctr)),
171 static_cast<MCKL_INT64>(std::get<0xE>(ctr)),
172 static_cast<MCKL_INT64>(std::get<0xD>(ctr)),
173 static_cast<MCKL_INT64>(std::get<0xC>(ctr)),
174 static_cast<MCKL_INT64>(std::get<0xB>(ctr)),
175 static_cast<MCKL_INT64>(std::get<0xA>(ctr)),
176 static_cast<MCKL_INT64>(std::get<0x9>(ctr)),
177 static_cast<MCKL_INT64>(std::get<0x8>(ctr)));
179 _mm512_add_epi64(c, _mm512_set_epi64(0, 0, 0, 0, 0, 0, 0, 2));
180 std::get<3>(s) = std::get<1>(s);
184 template <
typename T>
187 static constexpr std::size_t K_ = 32;
190 static void eval(
const std::array<T, K_> &ctr, std::array<__m512i, 4> &s)
192 std::memcpy(s.data(), ctr.data(), 512);
193 std::get<0>(s) = _mm512_add_epi64(
194 std::get<0>(s), _mm512_set_epi64(0, 0, 0, 0, 0, 0, 0, 1));
204 #endif // MCKL_RANDOM_INTERNAL_INCREMENT_AVX512_64_4_HPP static void eval(const std::array< T, K_ > &ctr, std::array< __m512i, 4 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m512i, 4 > &s)
#define MCKL_PUSH_GCC_WARNING(warning)
static void eval(const std::array< T, K_ > &ctr, std::array< __m512i, 4 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m512i, 4 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m512i, 4 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m512i, 4 > &s)
#define MCKL_POP_GCC_WARNING