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

The xxpermx instruction performs a permute operation on vector elements based on the index vector. The contents of byte element i of VSR[XT] are set to the contents of byte element eidx of src if section equals UIM; otherwise, they are set to 0.

Pseudocode Operation

if MSR.VSX=0 then
    VSX_Unavailable()
src.qword[0] ←VSR[32×AX+A]
src.qword[1] ←VSR[32×BX+B]
do i = 0 to 15
    section ←VSR[32×CX+C].byte[i].bit[0:2]
    eidx    ←VSR[32×CX+C].byte[i].bit[3:7]
    if section=UIM then
        VSR[32×TX+T].byte[i] ←src.byte[eidx]
    else
        VSR[32×TX+T].byte[i] ←0x00
end

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 0xF0000000
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