aboutsummaryrefslogtreecommitdiff
path: root/src/arch/avx2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/avx2.h')
-rw-r--r--src/arch/avx2.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/arch/avx2.h b/src/arch/avx2.h
index 7d8deef..e3fddd6 100644
--- a/src/arch/avx2.h
+++ b/src/arch/avx2.h
@@ -308,13 +308,13 @@ STATIC_INLINE uint64_t
308permtoindex_Nx8(uint64_t n, int64_t a) 308permtoindex_Nx8(uint64_t n, int64_t a)
309{ 309{
310 uint64_t i, c, ret; 310 uint64_t i, c, ret;
311 __m64 cmp; 311 __m256i cmp;
312 312
313 for (i = 0, ret = 0; i < n; i++) { 313 for (i = 0, ret = 0; i < n; i++) {
314 cmp = _mm_set1_pi8(a & INT64_C(0xFF)); 314 cmp = _mm256_set1_epi8((char)(a & INT64_C(0xFF)));
315 a = (a >> INT64_C(8)) | INT64_C(0x0F00000000000000); 315 a = (a >> INT64_C(8)) | INT64_C(0x0F00000000000000);
316 cmp = _mm_cmpgt_pi8(cmp, _mm_cvtsi64_m64(a)); 316 cmp = _mm256_cmpgt_epi8(cmp, _mm256_set1_epi64x(a));
317 c = _mm_popcnt_u64(_mm_cvtm64_si64(cmp)) >> UINT64_C(3); 317 c = _mm_popcnt_u32(_mm256_movemask_epi8(cmp)) >> 2;
318 ret += c * factorial[n-1-i]; 318 ret += c * factorial[n-1-i];
319 } 319 }
320 320
@@ -428,11 +428,12 @@ STATIC_INLINE cube_t
428invcoord_epe(uint64_t i) 428invcoord_epe(uint64_t i)
429{ 429{
430 int64_t a; 430 int64_t a;
431 __m64 a64; 431 __m256i b, r;
432 432
433 a = indextoperm_4x8(i); 433 a = indextoperm_4x8(i);
434 a64 = _mm_add_pi8(_mm_cvtsi64_m64(a), _mm_set_pi32(0, 0x08080808)); 434 b = _mm256_set1_epi64x(INT64_C(0x08080808));
435 a = _mm_cvtm64_si64(a64); 435 r = _mm256_add_epi8(_mm256_set1_epi64x(a), b);
436 a = _mm256_extract_epi64(r, 0);
436 437
437 return _mm256_set_epi64x(a, SOLVED_L, 0, SOLVED_L); 438 return _mm256_set_epi64x(a, SOLVED_L, 0, SOLVED_L);
438} 439}

Generated with cgit - Back to sebastiano.tronto.net