Quick navigation: [ Jump to body ]

Quick navigation: [ Jump to menu ]

Intel Pentium CPU Instruction Set Reference

BSR instruction - Bit Scan Reverse

Code Mnemonic Description
0F BD BSR r16, r/m16 Bit scan reverse on r/m16
0F BD BSR r32, r/m32 Bit scan reverse on r/m32


Searches the source operand (second operand) for the most significant set bit (1 bit). If a most 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 7 - 39 NP
r32, r32 3 7 - 71 NP
r16, m16 3 + d(0, 1, 2) 7 - 40 NP
r32, m32 3 + d(0, 1, 2, 4) 7 - 72 NP


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