vpextd
Vector Parallel Bits Extract Doubleword
Extracts bits from one vector register based on the bit positions specified in another vector register and places them into a third vector register.
Details
Extracts bits from vA based on bit-position indices specified in vB, placing extracted bits into the corresponding doubleword elements of vD. The instruction operates on 64-bit doubleword elements, where vB contains bit indices (0–63) that select which bits from vA are gathered into vD. This is a VMX extension instruction with no condition register or status flag updates.
Pseudocode Operation
for i in 0 to 1 do
vD[i*64:(i+1)*64] ← 0
for j in 0 to 63 do
if vB[i*64+j] < 64 then
vD[i*64+j] ← vA[i*64 + vB[i*64+j:i*64+j+5]]
else
vD[i*64+j] ← 0
Programming Note
The vpextd instruction is used to extract bits from one vector register based on the bit positions specified in another vector register. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, a Vector_Unavailable exception will be raised. This operation is performed on each doubleword element of the vectors, so ensure proper alignment and indexing to avoid unexpected results.
Example
Encoding
Operands
-
vD
Target -
vA
Source -
vB
Mask -
VRT
Target Vector Register -
VRA
Source Vector Register A -
VRB
Source Vector Register B