I have an XMM register consisting of 16 bytes, each byte being the value FF, like so: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Let's say EAX contains a value from 1 to 15, which represents the number of high order bytes of the XMM register I want to zero out. So for example:
If EAX was 1, the resulting XMM register would be: 00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
If EAX was 2, the resulting XMM register would be: 0000FFFFFFFFFFFFFFFFFFFFFFFFFFFF
...
...
If EAX was 15, the resulting XMM register would be: 000000000000000000000000000000FF
This has to be done at runtime, so I can't use immediate operands (I had thought of using PSLLDQ and PSRLDQ to shift, but those use imm8).
You may be guessing that what I'm trying to do is create a mask which I will subsequently PAND with another XMM register, and that is exactly what I am doing. If I could zero out EAX high-order bytes of an XMM register directly without even having to use a mask, that would be even better.
I have been trying to figure out what instruction(s) will do this for me, and keep being stumped. This must run in 32-bit mode; I am able to use SSE 4.2 instructions.
Thanks for any ideas. / Rav