vcntmbb
Vector Count Mask Bits Byte
Counts the number of true (or false) mask bits in a VSR and places the count in the leftmost byte of a GPR.
Details
Counts the number of byte elements in VRB that have bit 0 set to the value specified by MP (0 or 1), and places the count in the leftmost byte of the target GPR RT. This instruction is part of the VMX category and does not affect condition registers or status fields.
Pseudocode Operation
count ← 0
for i in 0 to 15:
if (VRB.byte[i][0] == MP) then
count ← count + 1
RT[56:63] ← count
RT[0:55] ← 0
Programming Note
This instruction is useful for counting the number of bytes in a vector register where the least significant bit matches a specified mask value (MP). Ensure that the Vector Facility is enabled by checking and setting the VEC bit in the Machine State Register (MSR) before using this instruction. The result is left-shifted 56 bits, so only the lower byte of GPR[RT] contains the count. This instruction operates at the problem state privilege level.
Example
Encoding
Operands
-
RT
Target General Purpose Register -
VRB
Source Vector Register -
MP
Mask Bit (0 or 1)