bpermd
Bit Permute Doubleword
bpermd RA, RS, RB
Permutes bits from RS based on the index values in RB. Highly optimized for bit shuffling.
Details
The bpermd instruction performs a bit permutation on the contents of two registers (RS and RB) and places the result in another register (RA). Each byte of RS specifies an index into RB, and the corresponding bits from RB are placed into RA. If the index exceeds 63, the permuted bit is set to 0.
Pseudocode Operation
Programming Note
The fact that the permuted bit is 0 if the corresponding index value exceeds 63 permits the permuted bits to be selected from a 128-bit quantity, using a single index register.
Example
bpermd r3, r4, r5
Encoding
Binary Layout
31
0
RS
6
RA
11
RB
16
252
/
Operands
-
RA
Target Register -
RS
Source Register (Data) -
RB
Permute Control Byte Selects