pdepd
Parallel Bits Deposit Doubleword
Deposits bits from RS to RA under control of mask RB (Scalar).
Details
The pdepd instruction deposits bits from the source register RS into the destination register RA based on a mask specified in the RB register. Bits from RS are placed in the least-significant positions of RA where the corresponding bits in RB are set to 1, maintaining their original order.
Pseudocode Operation
result ←0
mask ←(RB)
m ←0
k ←0
do while (m < 64)
if (mask63-m == 1) then do
result63-m ←(RS)63-k
k ←k + 1
end
Programming Note
The pdepd instruction is useful for selectively depositing bits from one register into another based on a mask. Ensure that the source and destination registers are properly aligned to avoid unexpected behavior. This instruction operates at user privilege level, but care must be taken with the mask to prevent unintended data corruption.
Example
Encoding
Operands
-
RA
Target -
RS
Source -
RB
Mask