xxpermdi

VSX Permute Doubleword Immediate

xxpermdi XT, XA, XB, DM

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

xxpermdi 0, 1, 1, 2

// Swap high/low doublewords of vs1.

Encoding

Binary Layout
T
0
A
5
B
10
0
15
DM
16
10
21
AX
22
BX
27
TX
31
 
Format XX3-form
Opcode 0xF0000050
Extension VSX
Registers Altered MSR

Operands

  • XT
    Target
  • XA
    Source A
  • XB
    Source B
  • DM
    Selector (2 bits)