Question

Is it possible to access to a single byte in a mmx register, like a array? I've this code:

movq mm1,vector1
movq mm2,vector2
psubw mm1,mm2

I want to put mm1[1],mm1[2],mm1[3]....into c++ vars, like:

int a,b=0;
mov a,mm1[1]
mov b,mm1[2]

Thanks.

Was it helpful?

Solution

Yes, it is possible.

I can show the code for SSE2 for c++, but is similar for MMX :

__m128i a;
unsigned char *p = (unsigned char*) &a;
// access bytes pointed by pointer p

OTHER TIPS

There's no direct possibility to address bytes in MMX registers unless you want to use VJo's approach, but that completely undermines the benefits of using MMX in the first place.

However if you have the data in favorable format it's might possible to place them all in the registers and do a bunch of unpack operations, which would transpose the data.

BTW why don't you use SSE1/2/3/4? MMX is fairly obsolete. IIRC SSE4 has direct 8/16/32/64-bit extraction instructions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top