Volume 3: General-Purpose and System Instructions - Stanford ...
Volume 3: General-Purpose and System Instructions - Stanford ... Volume 3: General-Purpose and System Instructions - Stanford ...
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
- Page 242 and 243: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 244 and 245: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 246 and 247: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 248 and 249: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 250 and 251: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 252 and 253: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 254 and 255: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 256 and 257: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 258 and 259: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 260 and 261: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 262 and 263: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 264 and 265: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 266 and 267: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 268 and 269: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 270 and 271: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 272 and 273: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 274 and 275: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 276 and 277: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 278 and 279: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 280 and 281: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 282 and 283: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 284 and 285: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 286 and 287: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 288 and 289: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 290 and 291: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 294 and 295: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 296 and 297: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 298 and 299: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 300 and 301: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 302 and 303: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 304 and 305: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 306 and 307: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 308 and 309: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 310 and 311: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 312 and 313: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 314 and 315: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 316 and 317: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 318 and 319: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 320 and 321: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 322 and 323: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 324 and 325: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 326 and 327: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 328 and 329: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 330 and 331: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 332 and 333: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 334 and 335: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 336 and 337: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 338 and 339: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 340 and 341: AMD64 Technology 24594 Rev. 3.10 Fe
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