Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ... Volume 3: General-Purpose and System Instructions - Stanford ...

scs.stanford.edu
from scs.stanford.edu More from this publisher
13.07.2015 Views

AMD64 Technology 24594 Rev. 3.10 February 2005BSRBit Scan ReverseSearches the value in a register or a memory location (second operand) for the mostsignificantset bit. If a set bit is found, the instruction clears the zero flag (ZF) andstores the index of the most-significant set bit in a destination register (first operand).If the second operand contains 0, the instruction sets ZF to 1 and does not change thecontents of the destination register. The bit index is an unsigned offset from bit 0 ofthe searched value.Mnemonic Opcode DescriptionBSR reg16, reg/mem16 0F BD /r Bit scan reverse on the contents of reg/mem16.BSR reg32, reg/mem32 0F BD /r Bit scan reverse on the contents of reg/mem32.BSR reg64, reg/mem64 0F BD /r Bit scan reverse on the contents of reg/mem64.Related InstructionsBSFrFLAGS AffectedID VIP VIF AC VM RF NT IOPL OF DF IF TF SF ZF AF PF CFExceptionsU U M U U U21 20 19 18 17 16 14 13–12 11 10 9 8 7 6 4 2 0Note: Bits 31–22, 15, 5, 3, and 1 are reserved. A flag set to 1 or cleared to 0 is M (modified). Unaffected flags are blank. Undefinedflags are U.Exception RealVirtual8086 Protected Cause of ExceptionStack, #SS X X X A memory address exceeded the stack segment limit or was noncanonical.General protection,#GPX X XA memory address exceeded the data segment limit or was noncanonical.XA null data segment was used to reference memory.76 BSR

24594 Rev. 3.10 February 2005 AMD64 TechnologyExceptionRealVirtual8086 Protected Cause of ExceptionPage fault, #PF X X A page fault resulted from the execution of the instruction.Alignment check, #AC X X An unaligned memory reference was performed while alignmentchecking was enabled.BSR 77

24594 Rev. 3.10 February 2005 AMD64 TechnologyExceptionRealVirtual8086 Protected Cause of ExceptionPage fault, #PF X X A page fault resulted from the execution of the instruction.Alignment check, #AC X X An unaligned memory reference was performed while alignmentchecking was enabled.BSR 77

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!