Intel Pentium Instruction Set Reference
BSF - Bit Scan Forward
Code |
Mnemonic |
Description |
0F BC |
BSF r16, r/m16 |
Bit scan forward on r/m16 |
0F BC |
BSF r32, r/m32 |
Bit scan forward on r/m32 |
Description
Searches the source operand (second operand) for the least significant set bit (1 bit). If a least significant 1 bit is found, its bit index is stored in the destination operand (first operand). The source operand can be a register or a memory location; the destination operand is a register. The bit index is an unsigned offset from bit 0 of the source operand. If the contents source operand are 0, the contents of the destination operand is undefined.
Operands |
Bytes |
Clocks |
r16, r16 |
3 |
6 - 34 |
NP |
r32, r32 |
3 |
6 - 42 |
NP |
r16, m16 |
3 + d(0, 1, 2) |
6 - 35 |
NP |
r32, m32 |
3 + d(0, 1, 2, 4) |
6 - 43 |
NP |
Flags
ID |
unaffected |
DF |
unaffected |
VIP |
unaffected |
IF |
unaffected |
VIF |
unaffected |
TF |
unaffected |
AC |
unaffected |
SF |
undefined |
VM |
unaffected |
ZF |
sets to 1 if all the source operand is 0; otherwise, is cleared |
RF |
unaffected |
AF |
undefined |
NT |
unaffected |
PF |
undefined |
IOPL |
unaffected |
CF |
undefined |
OF |
undefined |