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.

Encoding

Binary Layout
T
0:4
A
5:9
B
10:14
0
15
DM
16:20
10
21
AX
22:26
BX
27:30
TX
31
 
Format XX3-form
Opcode 0xF0000050
Extension VSX

Operands

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

Example

xxpermdi 0, 1, 1, 2

// Swap high/low doublewords of vs1.

Registers Altered

MSR

Related

More in VSX

Reference

Description

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.

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] ← ?

Extended Mnemonics

Extended Mnemonic Equivalent Instruction
xxspltd xxpermdi XT,XA,XA,0b00
xxmrghd xxpermdi XT,XA,XB,0b00
xxmrgld xxpermdi XT,XA,XB,0b11
xxswapd xxpermdi XT,XA,XA,0b10

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].