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 2005SBBSubtract with BorrowSubtracts an immediate value or the value in a register or a memory location (secondoperand) from a register or a memory location (first operand), and stores the result inthe first operand location. If the carry flag (CF) is 1, the instruction subtracts 1 fromthe result. Otherwise, it operates like SUB.The SBB instruction sign-extends immediate value operands to the length of the firstoperand size.This instruction evaluates the result for both signed and unsigned data types and setsthe OF and CF flags to indicate a borrow in a signed or unsigned result, respectively. Itsets the SF flag to indicate the sign of a signed result.This instruction is useful for multibyte (multiword) numbers because it takes intoaccount the borrow from a previous SUB instruction.The forms of the SBB instruction that write to memory support the LOCK prefix. Fordetails about the LOCK prefix, see “Lock Prefix” on page 10.Mnemonic Opcode DescriptionSBB AL, imm8SBB AX, imm16SBB EAX, imm32SBB RAX, imm32SBB reg/mem8, imm8SBB reg/mem16, imm16SBB reg/mem32, imm32SBB reg/mem64, imm321C ib1D iw1D id1D id80 /3 ib81 /3 iw81 /3 id81 /3 idSubtract an immediate 8-bit value from the AL register withborrow.Subtract an immediate 16-bit value from the AX register withborrow.Subtract an immediate 32-bit value from the EAX register withborrow.Subtract a sign-extended immediate 32-bit value from the RAXregister with borrow.Subtract an immediate 8-bit value from an 8-bit register ormemory location with borrow.Subtract an immediate 16-bit value from a 16-bit register ormemory location with borrow.Subtract an immediate 32-bit value from a 32-bit register ormemory location with borrow.Subtract a sign-extended immediate 32-bit value from a 64-bitregister or memory location with borrow.262 SBB

24594 Rev. 3.10 February 2005 AMD64 TechnologyMnemonic Opcode DescriptionSBB reg/mem16, imm883 /3 ibSBB reg/mem32, imm883 /3 ibSBB reg/mem64, imm883 /3 ibSBB reg/mem8, reg8 18 /rSBB reg/mem16, reg16 19 /rSBB reg/mem32, reg32 19 /rSBB reg/mem64, reg64 19 /rSBB reg8, reg/mem8 1A /rSBB reg16, reg/mem16 1B /rSBB reg32, reg/mem32 1B /rSBB reg64, reg/mem64 1B /rSubtract a sign-extended 8-bit immediate value from a 16-bitregister or memory location with borrow.Subtract a sign-extended 8-bit immediate value from a 32-bitregister or memory location with borrow.Subtract a sign-extended 8-bit immediate value from a 64-bitregister or memory location with borrow.Subtract the contents of an 8-bit register from an 8-bit register ormemory location with borrow.Subtract the contents of a 16-bit register from a 16-bit register ormemory location with borrow.Subtract the contents of a 32-bit register from a 32-bit register ormemory location with borrow.Subtract the contents of a 64-bit register from a 64-bit register ormemory location with borrow.Subtract the contents of an 8-bit register or memory locationfrom the contents of an 8-bit register with borrow.Subtract the contents of a 16-bit register or memory locationfrom the contents of a 16-bit register with borrow.Subtract the contents of a 32-bit register or memory locationfrom the contents of a 32-bit register with borrow.Subtract the contents of a 64-bit register or memory locationfrom the contents of a 64-bit register with borrow.Related InstructionsSUB, ADD, ADCSBB 263

AMD64 Technology 24594 Rev. 3.10 February 2005SBBSubtract with BorrowSubtracts an immediate value or the value in a register or a memory location (secondoper<strong>and</strong>) from a register or a memory location (first oper<strong>and</strong>), <strong>and</strong> stores the result inthe first oper<strong>and</strong> location. If the carry flag (CF) is 1, the instruction subtracts 1 fromthe result. Otherwise, it operates like SUB.The SBB instruction sign-extends immediate value oper<strong>and</strong>s to the length of the firstoper<strong>and</strong> size.This instruction evaluates the result for both signed <strong>and</strong> unsigned data types <strong>and</strong> setsthe OF <strong>and</strong> CF flags to indicate a borrow in a signed or unsigned result, respectively. Itsets the SF flag to indicate the sign of a signed result.This instruction is useful for multibyte (multiword) numbers because it takes intoaccount the borrow from a previous SUB instruction.The forms of the SBB instruction that write to memory support the LOCK prefix. Fordetails about the LOCK prefix, see “Lock Prefix” on page 10.Mnemonic Opcode DescriptionSBB AL, imm8SBB AX, imm16SBB EAX, imm32SBB RAX, imm32SBB reg/mem8, imm8SBB reg/mem16, imm16SBB reg/mem32, imm32SBB reg/mem64, imm321C ib1D iw1D id1D id80 /3 ib81 /3 iw81 /3 id81 /3 idSubtract an immediate 8-bit value from the AL register withborrow.Subtract an immediate 16-bit value from the AX register withborrow.Subtract an immediate 32-bit value from the EAX register withborrow.Subtract a sign-extended immediate 32-bit value from the RAXregister with borrow.Subtract an immediate 8-bit value from an 8-bit register ormemory location with borrow.Subtract an immediate 16-bit value from a 16-bit register ormemory location with borrow.Subtract an immediate 32-bit value from a 32-bit register ormemory location with borrow.Subtract a sign-extended immediate 32-bit value from a 64-bitregister or memory location with borrow.262 SBB

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

Saved successfully!

Ooh no, something went wrong!