- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to shift values in a simd register and replace from left or right. Basically I have an array like {4,5,4,5} in SSE or {4,5,4,5,4,5,4,5} in AVX and need to convert them to {5,4,5,4} or {5,4,5,4,5,4,5,4}. I need the solution to work with both SSE and AVX instruction sets.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you mean data dependent rotation (i.e. different rotation of each subword) or a cyclically exchange of the subwords?
A solution of the first problem is sketched on my site or with AVX2 (Intel proposal: 2 times VPSLLV* or VPSRLV* and one POR) or XOP (AMD Bulldozer: VPROT*) commands.
The second problem is easily solved by the commands SHUFPS, SHUFPD, PSHUFD, PSHUFB and PALIGNR; unfortunately these commands are somewhat limited for YMM usage because of their missing cross-lane operations.
A solution of the first problem is sketched on my site or with AVX2 (Intel proposal: 2 times VPSLLV* or VPSRLV* and one POR) or XOP (AMD Bulldozer: VPROT*) commands.
The second problem is easily solved by the commands SHUFPS, SHUFPD, PSHUFD, PSHUFB and PALIGNR; unfortunately these commands are somewhat limited for YMM usage because of their missing cross-lane operations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting Pourya_Shirazian
I need to shift values in a simd register and replace from left or right. Basically I have an array like {4,5,4,5} in SSE or {4,5,4,5,4,5,4,5} in AVX and need to convert them to {5,4,5,4} or {5,4,5,4,5,4,5,4}. I need the solution to work with both SSE and AVX instruction sets.
If I take you literally that the only numbers are:
{4,5,4,5} in SSE or {4,5,4,5,4,5,4,5} in AVX, then pxor with
{1,1,1,1} in SSE or {1,1,1,1,1,1,1,1} in AVX, to convert to
{5,4,5,4} in SSE or{5,4,5,4,5,4,5,4} in AVX.
xor again with same number sequence to convert back from
{5,4,5,4} in SSE or{5,4,5,4,5,4,5,4} in AVX to
{4,5,4,5} in SSE or {4,5,4,5,4,5,4,5} in AVX.
Jim Dempsey

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