switch(OperandSize) {
case 8:
//PINSRW instruction with 64-bit source operand:
Masks[] = {
0x000000000000FFFF,
0x00000000FFFF0000,
0x0000FFFF00000000,
0xFFFF000000000000
};
SEL = Count & 3;
Mask = Masks[SEL];
Destination = (Destination & ~Mask) | (((Source << (SEL * 16)) & Mask);
break;
case 16:
//PINSRW instruction with 128-bit source operand:
Masks[] = {
0x0000000000000000000000000000FFFF,
0x000000000000000000000000FFFF0000,
0x00000000000000000000FFFF00000000,
0x0000000000000000FFFF000000000000,
0x000000000000FFFF0000000000000000,
0x00000000FFFF00000000000000000000,
0x0000FFFF000000000000000000000000,
0xFFFF0000000000000000000000000000
};
SEL = Count & 7;
Mask = Masks[SEL];
Destination = (Destination & ~Mask) | (((Source << (SEL * 16)) & Mask);
break;
}
|