cfuged
Centrifuge Doubleword
Separates bits of the source register into two groups based on a mask (Power10 Scalar).
Details
The cfuged instruction counts the number of leading zero bits in a doubleword (64-bit) value, but only for those bits that are set to 1 in a mask specified by another register. The result is placed into a destination register.
Pseudocode Operation
n ←0
count = 0
do while n < 64
do i = 0 to 63
if((RB)i=1) then do
n ←n + 1
if((RS)i=1) then break
end
end
RA ←EXTZ64(count)
Programming Note
The cfuged instruction is useful for counting leading zeros in a doubleword value, but only considering the bits that are set to 1 in a mask. Ensure the mask register (RB) has bits set where you want to consider leading zeros in the source register (RS). The result is zero-extended to 64 bits before being stored in the destination register (RA). This instruction operates at user privilege level and does not generate exceptions under normal conditions.
Example
Encoding
Operands
-
RA
Target -
RS
Source -
RB
Mask