- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All,
I am coding a SIMD program (under AMS), I do not succeed my final arrangement of one of
my xmm register. In this 128 bits register, I have 4 double words (int) like that :
AB C D
I would like reorder the register like that :
0 A B C
it seems to be the asm pshufd xmm, xmm, imm8. But I do not find the magical value at imm8, although
I read ten times the doc ...
Thank you
Tim
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is much easier to shift in this case (and the correct direction depends on whether you noted memory order or order inside the register - which is just the opposite thanks to little endian x86...)
v = _mm_slli_si128(v, 4); // shift the contents of v to the left by 4 bytes
or
v = _mm_srli_si128(v, 4); // shift to the right by 4 bytes
The little endian confusion is probably also what makes it so hard to get the correct number for pshufd...
v = _mm_slli_si128(v, 4); // shift the contents of v to the left by 4 bytes
or
v = _mm_srli_si128(v, 4); // shift to the right by 4 bytes
The little endian confusion is probably also what makes it so hard to get the correct number for pshufd...
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is much easier to shift in this case (and the correct direction depends on whether you noted memory order or order inside the register - which is just the opposite thanks to little endian x86...)
v = _mm_slli_si128(v, 4); // shift the contents of v to the left by 4 bytes
or
v = _mm_srli_si128(v, 4); // shift to the right by 4 bytes
The little endian confusion is probably also what makes it so hard to get the correct number for pshufd...
v = _mm_slli_si128(v, 4); // shift the contents of v to the left by 4 bytes
or
v = _mm_srli_si128(v, 4); // shift to the right by 4 bytes
The little endian confusion is probably also what makes it so hard to get the correct number for pshufd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much, it works. As it was a Microsoft specific "functions", I believed it will not work under GCC or ICC. Do we get a convergence between Microsoft/Intel/AMD SIMD ? My reference book is the software
Vectorization handbook it is on intel SSE2 that why I do not find the reference if this function.
Regard's
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As these are intrinsics they should work under any of these compilers (MSVC, ICC or GCC) without problems. However, as you go to the latest and greatest intrinsics the compiler support will probably differ but eventually all compilers will end up addingthat support (just at different points in time).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are differences among the compilers in flexibility of syntax. For example, Intel supports some nesting of intrinsics which Microsoft doesn't, while gcc is more flexible about 128-bit integer usage. Intel compilers have dropped as there no longer is support for SSE without SSE2.
I think a few cases which Microsoft supported but Intel didn't were in line to be fixed.
I think a few cases which Microsoft supported but Intel didn't were in line to be fixed.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page