Help with simple assembly mmx exercise -
Looking at a vector of bytes in length of 8, how can I use MMMA instructions, all 2 of 5 Can I convert to example?
.data v1 byte1, 2, 3, 4, 1, 2, 3, 4
Thanks.
Edit: Just one example of 2 and 5 is that they are actually the criteria of a process.
I'm sure there are several ways to do this. For example, the following should work: / P>
1) Mask (or load) 5 and one of two mmx
registers ( mm0
- mm7
) < / P>
2) Load the data in another Mmx register, such as MOVQ
3) to test with the mask of 2, eg Using PCMPEQB
, the result will be according to the FF
and 00h
whether the register Whether the element was 2 or not
4) Use MASKMOVQ
, register with 5 and create a mask, which is already selected in the positions of 2 Write selectively MASKMOVQ
will store data for mask positions that handle the FFh
values.
5) Repeat until it finishes. 6) Finally, release the EMMS
to exit the MMX position. At the end of the routine, a SFENCE
or MFENCE
Issue instructions (because MASKMOVQ
generates a non-temporary signal).
If you use MMX instead of XMM, then you will not have to worry about alignment.
EDIT: If you have a problem with the details of the instructions, in the manual of Intel® 64 and IA-32 architecture software developer, set the instructions set (Volume 2A and 2B), all Something should be included in which you would ever want to know that you can find them.
Comments
Post a Comment