prtyw
Parity Word
Calculates parity of a word (Scalar).
Details
The Parity Word instruction examines the least significant bit in each byte of the lower and upper halves of a doubleword (64 bits). It sets the corresponding output bytes to 1 if there is an odd number of one bits; otherwise, it sets them to 0.
Pseudocode Operation
s ← 0
t ← 0
do i = 0 to 3
s ← s ⊕ (RS)i×8+7
do i = 4 to 7
t ← t ⊕ (RS)i×8+7
RA0:31 ← 310 || s
RA32:63 ← 310 || t
Programming Note
The prtyw instruction is useful for calculating the parity of each byte in a doubleword, which can be helpful in error detection. Ensure that the input register (RS) contains valid data; otherwise, the output may not reflect meaningful parity information. This instruction operates at user privilege level and does not generate exceptions under normal conditions.
Example
Encoding
Operands
-
RA
Target -
RS
Source