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

The xxpermdi instruction permutes the doublewords of VSR[XA] and VSR[XB] into VSR[XT] based on the immediate value DM. If DM.bit[1]=0, the contents of doubleword element 0 of VSR[XB] are placed into doubleword element 1 of VSR[XT]. Otherwise, the contents of doubleword element 1 of VSR[XB] are placed into doubleword element 1 of VSR[XT].

Pseudocode Operation

if MSR.VSX=0 then VSX_Unavailable()

Let XT be the value 32×TX + T.
Let XA be the value 32×AX + A.
Let XB be the value 32×BX + B.

VSR[32×TX+T].dword[0] ← VSR[32×AX+A].dword[DM.bit[0]]
VSR[32×TX+T].dword[1] ← VSR[32×BX+B].dword[DM.bit[1]]

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

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 0xF000000A
Extension VSX
Registers Altered MSR

Operands

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