Is there some instruction to do shift to left by the number from mask register somehow?

Is there some instruction to do shift to left by the number from mask register somehow?

Hi experts,

Now I want a process like psllw(d/q) behavior, but COUNT can be unequal for each word(dword/qword etc).

How can I do that, any instruction or instruction pairs can be use?

Appreciate if you can give me some tips/hints.

Thank you in advance.

-Steven

4 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Here I will provide the sample to make this question much clearer:

Assume Bi (0-7) for Byte(s) in some xmm0 register in LSB,

xmm0 = 00 00 00 00 00 00 00 00 B7 B6 B5 B4 B3 B2 B1 B0

How can I get desired result? like,

xmm1 = (B7<<7) (B6<<6) (B5<<5) (B4<<4) (B3<<3) (B2<<2) (B1<<1) (B0<<0)

Thanks.

Let me propose to simulate the shifting via PMULLW (SSE 2) or PMULLD (SSE 4.1) as a poor replacement.
When AVX2 becomes available you can apply the commands VPSLLVD and VPSLLVQ.
Alternatively AMD provides the commands VPSHL(B/W/D/Q) with their new XOP commands.

Thanks Sirrida for your answer here. It is very valuable for me to follow this.

发表评论

登录添加评论。还不是成员?立即加入