pshufb

Started by
5 comments, last by ogl5 16 years, 9 months ago
I'm trying to execute this instruction using inline assembly in VS.NET 2002: pshufb xmm0, xmm1 Unfortunately, pshufb is somewhat new, so VS.NET 2002 doesn't recognize it. Is there a feasible workaround?
Advertisement
Are you sure this is a beginner problem? :O
Are you sure it isn't supposed to be pshufd?

edit: Nevermind it's an SSE3 extension apparently. Short of getting the Intel compiler I'm not sure what you can do. You could try the free Visual C++ Express Edition and see if it works, or maybe try including the intrinics libraries from a newer compiler, though I seriously doubt anything good will come of it.
"Think you Disco Duck, think!" Professor Farnsworth
Quote:Original post by Horatius83
Are you sure it isn't supposed to be pshufd?
pshufb was introduced with SSE3, so it's legit.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Just checked it, yes it works under Visual C++ 2005.
"Think you Disco Duck, think!" Professor Farnsworth
According to the Intel manual, this opcode maps to:
PSHUFB xmmA,xmmB -> 66 0F 38 00 /r
If I'm not mistaken, /r is defined as:
      XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7  <- SrcXMM0   C0   C8   D0   D8   E0   E8   F0   F8  XMM1   C1   C9   D1   D9   E1   E9   F1   F9XMM2   C2   CA   D2   DA   E2   EA   F2   FAXMM3   C3   CB   D3   DB   E3   EB   F3   FBXMM4   C4   CC   D4   DC   E4   EC   F4   FCXMM5   C5   CD   D5   DD   E5   ED   F5   FDXMM6   C6   CE   D6   DE   E6   EE   F6   FEXMM7   C7   CF   D7   DF   E7   EF   F7   FFDst^

So your pshufb xmm0, xmm1 should translate to 66 0f 38 00 c1

In VisualC++ (since db is not supported) this can be done using the _emit pseudo-keyword:
__asm { _emit 0x66; _emit 0x0f; _emit 0x38; _emit 0x00; _emit 0xc1; }

I concur: that's not very pretty.

You can get more information by downloading the intel manuals (PDF files).
For some reason, the pshufb instruction does not work on my AMD Athlon 64. I tried it in 32 bit mode (with emit), and I get an illegal instruction message from Windows.

According to this:

http://www.amd.com/us-en/Processors/ProductInformation/0,,30_118_9485_9487%5E9503,00.html

it should support SSE3.

Any ideas why pshufb doesn't work?

This topic is closed to new replies.

Advertisement