vctzh
Vector Count Trailing Zeros Halfword
Counts trailing zeros in each halfword.
Details
The vctzh instruction counts the number of trailing zero bits in each halfword element of a vector register and stores the result in another vector register. It processes each of the 8 halfwords in the source vector, counting zeros from the least significant bit until it encounters a '1'. The count is then stored in the corresponding position in the destination vector.
Pseudocode Operation
Programming Note
The vctzh instruction is useful for counting trailing zeros in each halfword of a vector, which can be helpful in bit manipulation and data compression tasks. Ensure that the Vector Facility (VEC) is enabled in the MSR register to avoid a Vector_Unavailable exception. The instruction processes 8 halfwords per vector register, so ensure your data is properly aligned and structured for optimal performance.
Example
Encoding
Operands
-
vD
Target -
vB
Source