flintlib / flint

FLINT (Fast Library for Number Theory)
http://www.flintlib.org
GNU Lesser General Public License v3.0
401 stars 235 forks source link

vector bit shift: change srl to srli #2015

Closed vneiger closed 2 weeks ago

vneiger commented 2 weeks ago

For bit shifting each 64-bit word of a 256 bit vector a (and of 512 bit vectors emulated via two 256 ones), all shifted by the same amount b, the current code uses _mm256_srl_epi64(a, _mm_set_epi32(0,0,0,b)); It should be slightly faster to directly use _mm256_srli_epi64(a, b); as this avoids the "set" and the srli variant is more efficient than srl.