diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-17 17:42:43 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-17 17:42:43 +0200 |
| commit | 1809d7b212128fcdcb481002a17db5dc97a15e03 (patch) | |
| tree | 4e045b4fefc5e229969891b0e1963dd683bd46ad /src/cube_avx2.h | |
| parent | d26d9e46d305b3ab3c6ae3b55f1859cf413a1c94 (diff) | |
| download | nissy-core-1809d7b212128fcdcb481002a17db5dc97a15e03.tar.gz nissy-core-1809d7b212128fcdcb481002a17db5dc97a15e03.zip | |
Added inverse eo and copy_{edges,corners}
Diffstat (limited to 'src/cube_avx2.h')
| -rw-r--r-- | src/cube_avx2.h | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/src/cube_avx2.h b/src/cube_avx2.h index 42fb9d1..8d1c940 100644 --- a/src/cube_avx2.h +++ b/src/cube_avx2.h | |||
| @@ -23,9 +23,12 @@ _static_inline int64_t coord_fast_co(cube_fast_t); | |||
| 23 | _static_inline int64_t coord_fast_csep(cube_fast_t); | 23 | _static_inline int64_t coord_fast_csep(cube_fast_t); |
| 24 | _static_inline int64_t coord_fast_cocsep(cube_fast_t); | 24 | _static_inline int64_t coord_fast_cocsep(cube_fast_t); |
| 25 | _static_inline int64_t coord_fast_eo(cube_fast_t); | 25 | _static_inline int64_t coord_fast_eo(cube_fast_t); |
| 26 | _static_inline void set_eo_fast(cube_fast_t *, int64_t); | ||
| 27 | _static_inline int64_t coord_fast_esep(cube_fast_t); | 26 | _static_inline int64_t coord_fast_esep(cube_fast_t); |
| 28 | 27 | ||
| 28 | _static_inline void copy_corners_fast(cube_fast_t *, cube_fast_t); | ||
| 29 | _static_inline void copy_edges_fast(cube_fast_t *, cube_fast_t); | ||
| 30 | _static_inline void set_eo_fast(cube_fast_t *, int64_t); | ||
| 31 | |||
| 29 | _static_inline cube_fast_t | 32 | _static_inline cube_fast_t |
| 30 | fastcube( | 33 | fastcube( |
| 31 | uint8_t c_ufr, | 34 | uint8_t c_ufr, |
| @@ -199,12 +202,6 @@ coord_fast_eo(cube_fast_t c) | |||
| 199 | return mask >> 17; | 202 | return mask >> 17; |
| 200 | } | 203 | } |
| 201 | 204 | ||
| 202 | _static_inline void | ||
| 203 | set_eo_fast(cube_fast_t *c, int64_t eo) | ||
| 204 | { | ||
| 205 | /* TODO */ | ||
| 206 | } | ||
| 207 | |||
| 208 | _static_inline int64_t | 205 | _static_inline int64_t |
| 209 | coord_fast_esep(cube_fast_t c) | 206 | coord_fast_esep(cube_fast_t c) |
| 210 | { | 207 | { |
| @@ -234,3 +231,40 @@ coord_fast_esep(cube_fast_t c) | |||
| 234 | 231 | ||
| 235 | return ret1 * 70 + ret2; | 232 | return ret1 * 70 + ret2; |
| 236 | } | 233 | } |
| 234 | |||
| 235 | _static_inline void | ||
| 236 | copy_corners_fast(cube_fast_t *dest, cube_fast_t src) | ||
| 237 | { | ||
| 238 | *dest = _mm256_blend_epi32(*dest, src, 0x0F); | ||
| 239 | } | ||
| 240 | |||
| 241 | _static_inline void | ||
| 242 | copy_edges_fast(cube_fast_t *dest, cube_fast_t src) | ||
| 243 | { | ||
| 244 | *dest = _mm256_blend_epi32(*dest, src, 0xF0); | ||
| 245 | } | ||
| 246 | |||
| 247 | _static_inline void | ||
| 248 | set_eo_fast(cube_fast_t *cube, int64_t eo) | ||
| 249 | { | ||
| 250 | int64_t eo12, eotop, eobot; | ||
| 251 | __m256i veo; | ||
| 252 | |||
| 253 | eo12 = (eo << 1) + (_mm_popcnt_u64(eo) % 2); | ||
| 254 | eotop = (eo12 & (1 << 11)) << 17 | | ||
| 255 | (eo12 & (1 << 10)) << 10 | | ||
| 256 | (eo12 & (1 << 9)) << 3 | | ||
| 257 | (eo12 & (1 << 8)) >> 4; | ||
| 258 | eobot = (eo12 & (1 << 7)) << 53 | | ||
| 259 | (eo12 & (1 << 6)) << 46 | | ||
| 260 | (eo12 & (1 << 5)) << 39 | | ||
| 261 | (eo12 & (1 << 4)) << 32 | | ||
| 262 | (eo12 & (1 << 3)) << 25 | | ||
| 263 | (eo12 & (1 << 2)) << 18 | | ||
| 264 | (eo12 & (1 << 1)) << 11 | | ||
| 265 | (eo12 & 1) << 4; | ||
| 266 | veo = _mm256_set_epi64x(eotop, eobot, 0, 0); | ||
| 267 | |||
| 268 | *cube = _mm256_andnot_si256(_eo_avx2, *cube); | ||
| 269 | *cube = _mm256_or_si256(*cube, veo); | ||
| 270 | } | ||
