xxperm

VSX Vector Permute

xxperm XT, XA, XB, XC

Performs a vector permute operation on the contents of three VSX registers.

Details

The xxperm instruction performs a vector permute operation on the contents of three VSX registers. The source bytes are rearranged according to the control vector provided in another register.

Pseudocode Operation

if MSR.VSX=0 then
    VSX_Unavailable()
src.byte[0:15] ← VSR[32×AX+A]
src.byte[16:31] ← VSR[32×TX+T]
pcv.byte[0:15] ← VSR[32×BX+B]
do i = 0 to 15
    idx ← pcv.byte[i].bit[3:7]
    VSR[32×TX+T].byte[i] ← src.byte[idx]
end

Programming Note

The xxperm instruction requires VSX (Vector Scalar Extensions) to be enabled in the MSR register. Ensure that the control vector register is correctly set up, as it defines how the source bytes are permuted. This instruction operates on 32-byte vectors and can be used for tasks like data reordering or encryption. Be cautious of alignment requirements; the VSX registers must be properly aligned to avoid exceptions.

Example

xxperm vs1, vs2, vs3, vs4

Encoding

Binary Layout
18
0
T
6
A
11
B
16
AX
21
BX
29
TX
30
 
Format XX4-form
Opcode 0xF000001A
Extension VSX
Registers Altered MSR

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B
  • XC
    Control