Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

_mm_set_epi8 - what does "set" mean?

Tags:

x86

intel

simd

sse

What does the _mm_set_epi8 do?

I'm reading the documentation but I can't understand it, what is r0..r15?

like image 506
Johnny Pauling Avatar asked Feb 28 '13 10:02

Johnny Pauling


1 Answers

_mm_set_epi8 is just a convenience macro which initialises a 128 bit SSE __m128i vector to a specified set of values (16 x 8 bit values in this case), e.g.

__m128i v = _mm_set_epi8(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);

will set v to the 128 bit value: 0x000102030405060708090a0b0c0d0e0f.

There are other similar macros for different vector element types, e.g. _mm_set_epi16, _mm_set_epi32, _mm_set_ps, etc.

(Note: the documentation you linked to in your question is not very good, but r0..r15 apparently just refer to the individual 8 bit fields within the returned vector).

like image 156
Paul R Avatar answered Nov 08 '22 01:11

Paul R