32 #ifndef MCKL_RANDOM_INTERNAL_INCREMENT_AVX2_64_F_HPP 33 #define MCKL_RANDOM_INTERNAL_INCREMENT_AVX2_64_F_HPP 46 static constexpr std::size_t K_ = 1;
49 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 16> &s)
52 _mm256_set1_epi64x(static_cast<MCKL_INT64>(std::get<0>(ctr)));
55 _mm256_add_epi64(c, _mm256_set_epi64x(0x04, 0x03, 0x02, 0x01));
57 _mm256_add_epi64(c, _mm256_set_epi64x(0x08, 0x07, 0x06, 0x05));
59 _mm256_add_epi64(c, _mm256_set_epi64x(0x0C, 0x0B, 0x0A, 0x09));
61 _mm256_add_epi64(c, _mm256_set_epi64x(0x10, 0x0F, 0x0E, 0x0D));
63 _mm256_add_epi64(c, _mm256_set_epi64x(0x14, 0x13, 0x12, 0x11));
65 _mm256_add_epi64(c, _mm256_set_epi64x(0x18, 0x17, 0x16, 0x15));
67 _mm256_add_epi64(c, _mm256_set_epi64x(0x1C, 0x1B, 0x1A, 0x19));
69 _mm256_add_epi64(c, _mm256_set_epi64x(0x20, 0x1F, 0x1E, 0x1D));
71 __m256i d = _mm256_set1_epi64x(0x20);
72 std::get<0x8>(s) = _mm256_add_epi64(std::get<0x0>(s), d);
73 std::get<0x9>(s) = _mm256_add_epi64(std::get<0x1>(s), d);
74 std::get<0xA>(s) = _mm256_add_epi64(std::get<0x2>(s), d);
75 std::get<0xB>(s) = _mm256_add_epi64(std::get<0x3>(s), d);
76 std::get<0xC>(s) = _mm256_add_epi64(std::get<0x4>(s), d);
77 std::get<0xD>(s) = _mm256_add_epi64(std::get<0x5>(s), d);
78 std::get<0xE>(s) = _mm256_add_epi64(std::get<0x6>(s), d);
79 std::get<0xF>(s) = _mm256_add_epi64(std::get<0x7>(s), d);
86 static constexpr std::size_t K_ = 2;
89 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 16> &s)
92 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<1>(ctr)),
93 static_cast<MCKL_INT64>(std::get<0>(ctr)),
94 static_cast<MCKL_INT64>(std::get<1>(ctr)),
95 static_cast<MCKL_INT64>(std::get<0>(ctr)));
98 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x02, 0, 0x01));
100 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x04, 0, 0x03));
102 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x06, 0, 0x05));
104 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x08, 0, 0x07));
106 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x0A, 0, 0x09));
108 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x0C, 0, 0x0B));
110 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x0E, 0, 0x0D));
112 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x10, 0, 0x0F));
114 __m256i d = _mm256_set_epi64x(0, 0x10, 0, 0x10);
115 std::get<0x8>(s) = _mm256_add_epi64(std::get<0x0>(s), d);
116 std::get<0x9>(s) = _mm256_add_epi64(std::get<0x1>(s), d);
117 std::get<0xA>(s) = _mm256_add_epi64(std::get<0x2>(s), d);
118 std::get<0xB>(s) = _mm256_add_epi64(std::get<0x3>(s), d);
119 std::get<0xC>(s) = _mm256_add_epi64(std::get<0x4>(s), d);
120 std::get<0xD>(s) = _mm256_add_epi64(std::get<0x5>(s), d);
121 std::get<0xE>(s) = _mm256_add_epi64(std::get<0x6>(s), d);
122 std::get<0xF>(s) = _mm256_add_epi64(std::get<0x7>(s), d);
126 template <
typename T>
129 static constexpr std::size_t K_ = 4;
132 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 16> &s)
135 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<3>(ctr)),
136 static_cast<MCKL_INT64>(std::get<2>(ctr)),
137 static_cast<MCKL_INT64>(std::get<1>(ctr)),
138 static_cast<MCKL_INT64>(std::get<0>(ctr)));
140 std::get<0x0>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 1));
141 std::get<0x1>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 2));
142 std::get<0x2>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 3));
143 std::get<0x3>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 4));
144 std::get<0x4>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 5));
145 std::get<0x5>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 6));
146 std::get<0x6>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 7));
147 std::get<0x7>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 8));
149 __m256i d = _mm256_set_epi64x(0, 0, 0, 8);
150 std::get<0x8>(s) = _mm256_add_epi64(std::get<0x0>(s), d);
151 std::get<0x9>(s) = _mm256_add_epi64(std::get<0x1>(s), d);
152 std::get<0xA>(s) = _mm256_add_epi64(std::get<0x2>(s), d);
153 std::get<0xB>(s) = _mm256_add_epi64(std::get<0x3>(s), d);
154 std::get<0xC>(s) = _mm256_add_epi64(std::get<0x4>(s), d);
155 std::get<0xD>(s) = _mm256_add_epi64(std::get<0x5>(s), d);
156 std::get<0xE>(s) = _mm256_add_epi64(std::get<0x6>(s), d);
157 std::get<0xF>(s) = _mm256_add_epi64(std::get<0x7>(s), d);
161 template <
typename T>
164 static constexpr std::size_t K_ = 8;
167 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 16> &s)
170 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<3>(ctr)),
171 static_cast<MCKL_INT64>(std::get<2>(ctr)),
172 static_cast<MCKL_INT64>(std::get<1>(ctr)),
173 static_cast<MCKL_INT64>(std::get<0>(ctr)));
175 std::get<0x0>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 1));
177 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<7>(ctr)),
178 static_cast<MCKL_INT64>(std::get<6>(ctr)),
179 static_cast<MCKL_INT64>(std::get<5>(ctr)),
180 static_cast<MCKL_INT64>(std::get<4>(ctr)));
181 std::get<0x2>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 2));
182 std::get<0x3>(s) = std::get<0x1>(s);
183 std::get<0x4>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 3));
184 std::get<0x5>(s) = std::get<0x1>(s);
185 std::get<0x6>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 4));
186 std::get<0x7>(s) = std::get<0x1>(s);
187 std::get<0x8>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 5));
188 std::get<0x9>(s) = std::get<0x1>(s);
189 std::get<0xA>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 6));
190 std::get<0xB>(s) = std::get<0x1>(s);
191 std::get<0xC>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 7));
192 std::get<0xD>(s) = std::get<0x1>(s);
193 std::get<0xE>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 8));
194 std::get<0xF>(s) = std::get<0x1>(s);
198 template <
typename T>
201 static constexpr std::size_t K_ = 16;
204 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 16> &s)
207 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x3>(ctr)),
208 static_cast<MCKL_INT64>(std::get<0x2>(ctr)),
209 static_cast<MCKL_INT64>(std::get<0x1>(ctr)),
210 static_cast<MCKL_INT64>(std::get<0x0>(ctr)));
212 std::get<0x0>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 1));
214 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x7>(ctr)),
215 static_cast<MCKL_INT64>(std::get<0x6>(ctr)),
216 static_cast<MCKL_INT64>(std::get<0x5>(ctr)),
217 static_cast<MCKL_INT64>(std::get<0x4>(ctr)));
219 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0xB>(ctr)),
224 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0xF>(ctr)),
225 static_cast<MCKL_INT64>(std::get<0xE>(ctr)),
226 static_cast<MCKL_INT64>(std::get<0xD>(ctr)),
227 static_cast<MCKL_INT64>(std::get<0xC>(ctr)));
228 std::get<0x4>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 2));
229 std::get<0x5>(s) = std::get<1>(s);
230 std::get<0x6>(s) = std::get<2>(s);
231 std::get<0x7>(s) = std::get<3>(s);
232 std::get<0x8>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 3));
233 std::get<0x9>(s) = std::get<1>(s);
234 std::get<0xA>(s) = std::get<2>(s);
235 std::get<0xB>(s) = std::get<3>(s);
236 std::get<0xC>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 4));
237 std::get<0xD>(s) = std::get<1>(s);
238 std::get<0xE>(s) = std::get<2>(s);
239 std::get<0xF>(s) = std::get<3>(s);
243 template <
typename T>
246 static constexpr std::size_t K_ = 32;
249 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 16> &s)
252 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x03>(ctr)),
253 static_cast<MCKL_INT64>(std::get<0x02>(ctr)),
254 static_cast<MCKL_INT64>(std::get<0x01>(ctr)),
255 static_cast<MCKL_INT64>(std::get<0x00>(ctr)));
257 std::get<0x0>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 1));
259 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x07>(ctr)),
260 static_cast<MCKL_INT64>(std::get<0x06>(ctr)),
261 static_cast<MCKL_INT64>(std::get<0x05>(ctr)),
262 static_cast<MCKL_INT64>(std::get<0x04>(ctr)));
264 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x0B>(ctr)),
267 static_cast<MCKL_INT64>(std::get<0x08>(ctr)));
269 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x0F>(ctr)),
270 static_cast<MCKL_INT64>(std::get<0x0E>(ctr)),
271 static_cast<MCKL_INT64>(std::get<0x0D>(ctr)),
272 static_cast<MCKL_INT64>(std::get<0x0C>(ctr)));
274 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x13>(ctr)),
277 static_cast<MCKL_INT64>(std::get<0x10>(ctr)));
279 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x17>(ctr)),
280 static_cast<MCKL_INT64>(std::get<0x16>(ctr)),
281 static_cast<MCKL_INT64>(std::get<0x15>(ctr)),
282 static_cast<MCKL_INT64>(std::get<0x14>(ctr)));
284 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x1B>(ctr)),
287 static_cast<MCKL_INT64>(std::get<0x18>(ctr)));
289 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x1F>(ctr)),
290 static_cast<MCKL_INT64>(std::get<0x1E>(ctr)),
291 static_cast<MCKL_INT64>(std::get<0x1D>(ctr)),
292 static_cast<MCKL_INT64>(std::get<0x1C>(ctr)));
293 std::get<0x8>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 2));
294 std::get<0x9>(s) = std::get<0x1>(s);
295 std::get<0xA>(s) = std::get<0x2>(s);
296 std::get<0xB>(s) = std::get<0x3>(s);
297 std::get<0xC>(s) = std::get<0x4>(s);
298 std::get<0xD>(s) = std::get<0x5>(s);
299 std::get<0xE>(s) = std::get<0x6>(s);
300 std::get<0xF>(s) = std::get<0x7>(s);
304 template <
typename T>
307 static constexpr std::size_t K_ = 64;
310 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 16> &s)
312 std::memcpy(s.data(), ctr.data(), 512);
314 _mm256_add_epi64(std::get<0>(s), _mm256_set_epi64x(0, 0, 0, 1));
324 #endif // MCKL_RANDOM_INTERNAL_INCREMENT_AVX2_64_F_HPP #define MCKL_PUSH_GCC_WARNING(warning)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 16 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 16 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 16 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 16 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 16 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 16 > &s)
#define MCKL_POP_GCC_WARNING
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 16 > &s)