xxpermdi
VSX Permute Doubleword Immediate
Selects two doublewords from the four available in source registers XA and XB based on a 2-bit selector.
Details
Selects two 64-bit doublewords from source registers XA and XB and places them in target register XT. The 2-bit selector DM controls which doubleword is chosen: bits [1:0] of DM select from XA for the high half of XT, and bits [3:2] select from XB for the low half. No condition registers or status flags are affected.
Pseudocode Operation
case DM[1:0]:
0: XT[0:63] ← XA[0:63]
1: XT[0:63] ← XA[64:127]
otherwise: XT[0:63] ← ?
case DM[3:2]:
0: XT[64:127] ← XB[0:63]
1: XT[64:127] ← XB[64:127]
otherwise: XT[64:127] ← ?
Programming Note
The xxpermdi instruction is used to permute doublewords from two VSX registers into a third register based on an immediate value. Ensure that the VSX facility is enabled in the MSR register; otherwise, a VSX_Unavailable exception will be raised. The immediate value DM controls which doubleword elements are selected from VSR[XB] for placement in VSR[XT].
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
| xxspltd | |
| xxmrghd | |
| xxmrgld | |
| xxswapd |
Example
// Swap high/low doublewords of vs1.
Encoding
Operands
-
XT
Target -
XA
Source A -
XB
Source B -
DM
Selector (2 bits)