It is necessary to multiply one XMM register by another, but with a bitmask value

In the x86 / SIMD assembly, I filled the XMM register with four 32-bit pixels of the graphic that I need to convert. However, the pixels are in 10-bit RGB format, so they exist in 32 bits in this form:

[  red   ][  green ][  blue  ][]
RRRRRRRRRRGGGGGGGGGGBBBBBBBBBB00

The last two bits are padding bits and are not used.

I need to multiply these pixels by a different value, but the value needs to be masked so that it only affects the pixels. This value is constant, so it can be hardcoded. Let's say the value is 0.1234. How would I put this in another XMM register with the appropriate masking, so that it only affects the red part of each 32-bit segment?

Illustrated graphically, I would like to do something like this:

XMM0 (first 32 bit segment):
[ 0.1234 ][  1.0   ][  1.0   ][]

*

XMM1 (first 32 bit segment):
RRRRRRRRRRGGGGGGGGGGBBBBBBBBBB00

XMM0 XMM1. , 32- XMM, 32 , .

+5
2

, , ( 16- ) .

, , - xmm (, 16 32- ), shift shuffle ( float). , .

- (, ​​), float, , float , . , 32- , .

+3

, , R/G/B XMM ( 1023.0) .

, R, G B, , XMM , , R, G B . , , .

+2

All Articles