What do you do without fast gather and scatter in AVX2 instructions?
What do you do without fast gather and scatter in AVX2 instructions? I'm writing a program to detect primes numbers. One part is bit sieving possible candidates out. I've written a fairly fast program but I thought I'd see if anyone has some better ideas. My program could use some fast gather and scatter instructions but I'm limited to AVX2 hardware for a x86 architecture (I know AVX-512 has these though I'd not sure how fast they are). #include <stdint.h> #include <immintrin.h> #define USE_AVX2 // Sieve the bits in array sieveX for later use void sieveFactors(uint64_t *sieveX) { const uint64_t totalX = 5000000; #ifdef USE_AVX2 uint64_t indx[4], bits[4]; const __m256i sieveX2 = _mm256_set1_epi64x((uint64_t)(sieveX)); const __m256i total = _mm256_set1_epi64x(totalX - 1); const __m256i mask = _mm256_set1_epi64x(0x3f); // Just filling with some typical values (not really constant) __m256i ans = _mm256_set_epi64x(58, 52, 154, 1...