The intrinsic _mm_slli_si128
will do a logical shift left of a 128 bit register, but is restricted to immediate shift values, and shifts by bytes not bits.
I can use an intrinsic like _mm_sll_epi64
or _mm_sll_epi32
to shift left a set of values within the __m128i
register, but these don't carry the "overflow" bits.
For a shift by N bits imagine that I could do a something like:
_mm_sll_epi64
_mm_srr_epi64
(for the bits I want to carry: move them into the low order )
- shuffle the srr result
- or these together.
(but probably also have to include checks of N relative to 64).
Is there a better way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…