Re: pshufb by bob
bob
Fri Jul 27 01:00:44 CDT 2007
On Jul 26, 8:24 pm, "Carl Daniel [VC++ MVP]"
<cpdaniel_remove_this_and_nos...@mvps.org.nospam> wrote:
> b...@coolgroups.com wrote:
> > 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?
>
> 1. Use a newer compiler
> 2. use masm to build an .OBJ which you link into your project.
> 3. compile the instruction by hand (or with MASM) and insert the necessary
> code bytes into a block of memory and then call it through a suitably
> constructed function pointer. You'll need to call VirtualProtect to set the
> page attributes to PAGE_EXECUTE (or similar) in order to actually run the
> code in newer CPUs with the "NX bit".
>
> -cd
I tried this:
__asm {
_emit 0x66
_emit 0x0F
_emit 0x38
_emit 0x00
_emit 0xC1
}
However, when I run it, my PC says "Illegal instruction".
Can you try it on your PC? My CPU is fairly modern, so I don't know
why it doesn't work.