FLO : Find Leading One

Format:

SPA 5.0:
        {@{!}Pg}   FLO{.fmt}{.SH}   Rd{.CC},{~}Sb   {&req_6}   {&rdN}   {&wrN}   {?sched}   ;   

 .fmt:       {.U32,.S32*}
             .U32: Return index for first "1" 
             .S32: Return index for first "0" if negative source, first "1" if positive or zero.

 .SH         Return the left shift count required to move the first set/cleared bit to the MSB

 .CC:        Write condition codes

FLO allows the following source Sb:
    Sb(register)
    Sb(constant with immediate address)
    Sb(#IMM20)

Description:

Find leading set/cleared bit in source. Returns ~0 if search failed.

Default is to return the bit position of the first "1" (starting at 31 and scanning down to 0), but if the .SH option is specified, the shift count that one should shift the input left by to move the first "1" to the msb is returned.

Examples:

FLO R0,R1;

Back to Index of Instructions