xxpermx

VSX Vector Permute Extended

xxpermx XT, XA, XB, XC, UIM

Permutes bytes from two source vectors using a control vector and a 3-bit selector.

Details

Permutes bytes from source vectors XA and XB using byte indices in XC, with a 3-bit UIM field selecting between different permutation modes. The permutation control bytes in XC determine which source byte maps to each position in XT. This VSX instruction does not affect condition registers or status fields.

Pseudocode Operation

for i in 0 to 15:
  idx ← (XC[8*i:8*i+7] & 0x1F) | (UIM << 5)
  if idx < 16:
    XT[8*i:8*i+7] ← XA[8*idx:8*idx+7]
  else:
    XT[8*i:8*i+7] ← XB[8*(idx-16):8*(idx-16)+7]

Programming Note

The following is an example of emulating 256-bit xxperm, where a 256-bit vector is contained in a pair of VSRs. The instruction is capable of emulating up to a 2048-bit xxperm.

Example

xxpermx vs1, vs2, vs3, vs4, uim

Encoding

Binary Layout
1
0
8
6
0
9
/
10
60
32
XT
38
XA
43
XB
48
XC
53
UIM
58
 
Format XX4-form
Opcode 0x0500000088000000
Extension VSX
Registers Altered MSR

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B
  • XC
    Control
  • UIM
    Selector
  • VX1
    Target Vector Register
  • VX2
    Source Vector Register
  • VX3
    Source Vector Register