32 #ifndef MCKL_RANDOM_INTERNAL_INCREMENT_AVX2_64_8_HPP 33 #define MCKL_RANDOM_INTERNAL_INCREMENT_AVX2_64_8_HPP 46 static constexpr std::size_t K_ = 1;
49 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 8> &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));
76 static constexpr std::size_t K_ = 2;
79 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 8> &s)
82 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<1>(ctr)),
83 static_cast<MCKL_INT64>(std::get<0>(ctr)),
84 static_cast<MCKL_INT64>(std::get<1>(ctr)),
85 static_cast<MCKL_INT64>(std::get<0>(ctr)));
88 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x02, 0, 0x01));
90 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x04, 0, 0x03));
92 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x06, 0, 0x05));
94 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x08, 0, 0x07));
96 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x0A, 0, 0x09));
98 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x0C, 0, 0x0B));
100 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x0E, 0, 0x0D));
102 _mm256_add_epi64(c, _mm256_set_epi64x(0, 0x10, 0, 0x0F));
106 template <
typename T>
109 static constexpr std::size_t K_ = 4;
112 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 8> &s)
115 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<3>(ctr)),
116 static_cast<MCKL_INT64>(std::get<2>(ctr)),
117 static_cast<MCKL_INT64>(std::get<1>(ctr)),
118 static_cast<MCKL_INT64>(std::get<0>(ctr)));
120 std::get<0>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 1));
121 std::get<1>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 2));
122 std::get<2>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 3));
123 std::get<3>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 4));
124 std::get<4>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 5));
125 std::get<5>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 6));
126 std::get<6>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 7));
127 std::get<7>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 8));
131 template <
typename T>
134 static constexpr std::size_t K_ = 8;
137 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 8> &s)
140 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<3>(ctr)),
141 static_cast<MCKL_INT64>(std::get<2>(ctr)),
142 static_cast<MCKL_INT64>(std::get<1>(ctr)),
143 static_cast<MCKL_INT64>(std::get<0>(ctr)));
145 std::get<0>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 1));
147 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<7>(ctr)),
148 static_cast<MCKL_INT64>(std::get<6>(ctr)),
149 static_cast<MCKL_INT64>(std::get<5>(ctr)),
150 static_cast<MCKL_INT64>(std::get<4>(ctr)));
151 std::get<2>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 2));
152 std::get<3>(s) = std::get<1>(s);
153 std::get<4>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 3));
154 std::get<5>(s) = std::get<1>(s);
155 std::get<6>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 4));
156 std::get<7>(s) = std::get<1>(s);
160 template <
typename T>
163 static constexpr std::size_t K_ = 16;
166 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 8> &s)
169 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x3>(ctr)),
170 static_cast<MCKL_INT64>(std::get<0x2>(ctr)),
171 static_cast<MCKL_INT64>(std::get<0x1>(ctr)),
172 static_cast<MCKL_INT64>(std::get<0x0>(ctr)));
174 std::get<0>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 1));
176 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0x7>(ctr)),
177 static_cast<MCKL_INT64>(std::get<6>(ctr)),
178 static_cast<MCKL_INT64>(std::get<5>(ctr)),
179 static_cast<MCKL_INT64>(std::get<4>(ctr)));
181 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0xB>(ctr)),
186 _mm256_set_epi64x(static_cast<MCKL_INT64>(std::get<0xF>(ctr)),
187 static_cast<MCKL_INT64>(std::get<0xE>(ctr)),
188 static_cast<MCKL_INT64>(std::get<0xD>(ctr)),
189 static_cast<MCKL_INT64>(std::get<0xC>(ctr)));
190 std::get<4>(s) = _mm256_add_epi64(c, _mm256_set_epi64x(0, 0, 0, 2));
191 std::get<5>(s) = std::get<1>(s);
192 std::get<6>(s) = std::get<2>(s);
193 std::get<7>(s) = std::get<3>(s);
197 template <
typename T>
200 static constexpr std::size_t K_ = 32;
203 static void eval(
const std::array<T, K_> &ctr, std::array<__m256i, 8> &s)
205 std::memcpy(s.data(), ctr.data(), 256);
207 _mm256_add_epi64(std::get<0>(s), _mm256_set_epi64x(0, 0, 0, 1));
217 #endif // MCKL_RANDOM_INTERNAL_INCREMENT_AVX2_64_8_HPP #define MCKL_PUSH_GCC_WARNING(warning)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 8 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 8 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 8 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 8 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 8 > &s)
static void eval(const std::array< T, K_ > &ctr, std::array< __m256i, 8 > &s)
#define MCKL_POP_GCC_WARNING