Jump to content
  • Advertisement
Sign in to follow this  
ogl5

pshufb

This topic is 4077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by Horatius83
Are you sure it isn't supposed to be pshufd?
pshufb was introduced with SSE3, so it's legit.

Share this post


Link to post
Share on other sites
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 <- Src
XMM0 C0 C8 D0 D8 E0 E8 F0 F8
XMM1 C1 C9 D1 D9 E1 E9 F1 F9
XMM2 C2 CA D2 DA E2 EA F2 FA
XMM3 C3 CB D3 DB E3 EB F3 FB
XMM4 C4 CC D4 DC E4 EC F4 FC
XMM5 C5 CD D5 DD E5 ED F5 FD
XMM6 C6 CE D6 DE E6 EE F6 FE
XMM7 C7 CF D7 DF E7 EF F7 FF
Dst^

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).

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!