vprtybq

Vector Parity Byte Quadword

vprtybq vD, vB

Calculates the parity of each byte in a vector register and stores the result in another vector register.

Details

The vprtybq instruction calculates the parity of each byte in the source vector register VRB and stores the result in the target vector register VRT. The result is a single bit (0 or 1) indicating whether the number of 1s in the bytes is odd or even.

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()

s ← 0
do j = 0 to 15
    s ← s ⊕ VSR[VRB+32].byte[j].bit[7]
end
do i = 0 to 127
    if i < 128 then
        VSR[VRT+32].byte[i] ← CHOP128(EXTZ(s))
    end
end

Programming Note

The vprtybq instruction calculates the parity of each byte in the source vector register VRB and stores the result in the target vector register VRT. Ensure that the Vector Facility is enabled by checking and setting the MSR.VEC bit. The instruction processes 16 bytes from VRB, and the result is a single bit indicating the parity for each byte, which is then replicated across all 128 bits of VRT.

Example

vprtybq vd, vb

Encoding

Binary Layout
4
0
vD
6
0
11
vB
16
1668
 
Format VX-form
Opcode 0x10000684
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target
  • vB
    Source
  • VRT
    Target Vector Register
  • VRB
    Source Vector Register