POOL32A 000000 |
rt |
rs |
CLO 0100101100 |
POOL32AXf 111100 |
6 |
5 |
5 |
10 |
6 |
CLO rt, rs |
microMIPS |
Count Leading Ones in Word |
Count Leading Ones in Word
To count the number of leading ones in a word.
GPR[rt] = count_leading_ones GPR[rs]
Bits 31..0 of GPR rs are scanned from most significant to least significant bit. The number of leading ones is counted and the result is written to GPR rt. If all of bits 31..0 were set in GPR rs, the result written to GPR rt is 32.
If GPR rs does not contain a sign-extended 32-bit value (bits 63..31 equal), then the results of the operation are
UNPREDICTABLE.
if NotWordValue(GPR[rs]) then UNPREDICTABLE endif temp = 32 for i in 31 .. 0 if GPR[rs]i = 0 then temp = 31 - i break endif endfor GPR[rt] = temp
None