vpermxor

Vector Permute and Exclusive-OR

vpermxor vD, vA, vB, vC

Permutes bytes from vA and vB, then XORs with vC. Used for finite field arithmetic.

Details

The vpermxor instruction performs a permute and exclusive OR operation on the contents of three vector registers (VRA, VRB, VRC) and stores the result in another vector register (VRT).

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
do i = 0 to 15
    indexA ← VSR[VRC+32].byte[i].bit[0:3]
    indexB ← VSR[VRC+32].byte[i].bit[4:7]
    src1   ← VSR[VRA+32].byte[indexA]
    src2   ← VSR[VRB+32].byte[indexB]
    VSR[VRT+32].byte[i] ← src1 ⊕ src2
end

Programming Note

The vpermxor instruction requires the Vector Facility to be enabled in the MSR. Ensure that the index values in VRC do not exceed 15 to avoid undefined behavior. This instruction operates on byte-level data and is useful for complex data transformations involving permutation and bitwise operations.

Example

vpermxor vd, va, vb, vc

Encoding

Binary Layout
0
0
VRT
6
VRA
11
VRB
16
VRC
21
45
26
 
Format VA-form
Opcode 0x1000002D
Extension Vector Crypto
Registers Altered MSR

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B
  • vC
    Permute
  • VRT
    Target Vector Register
  • VRA
    Source Vector Register
  • VRB
    Source Vector Register
  • VRC
    Control Vector Register