pextd
Parallel Bits Extract Doubleword
Extracts bits from a source register based on a mask and places them into the target register.
Details
The contents of the bits in register RS corresponding to bits in mask containing a 1 are packed into an n-bit value. The extracted value is placed into register RA.
Pseudocode Operation
result ← 0
mask ← (RB)
m ← 0
k ← 0
do while (m < 64)
if ((RB)63-m == 1) then do
result63-k ← (RS)63-m
k ← k + 1
end
m ← m + 1
end
RA ← result
Programming Note
The pextd instruction is useful for extracting and packing bits from a source register based on a mask. Ensure the mask register (RB) has bits set to 1 where you want to extract corresponding bits from the source register (RS). The operation is performed in little-endian order, so the least significant bit of the result corresponds to the first bit set in the mask. This instruction operates at user privilege level and does not generate exceptions for normal use cases.
Example
Encoding
Operands
-
RA
Target -
RS
Source -
RB
Mask