13.07.2015 Views

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

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

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

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24594 Rev. 3.10 February 2005 AMD64 TechnologyBTCBit Test <strong>and</strong> ComplementCopies a bit, specified by a bit index in a register or 8-bit immediate value (secondoper<strong>and</strong>), from a bit string (first oper<strong>and</strong>), also called the bit base, to the carry flag(CF) of the rFLAGS register, <strong>and</strong> then complements (toggles) the bit in the bit string.If the bit base oper<strong>and</strong> is a register, the instruction uses the modulo 16, 32, or 64(depending on the oper<strong>and</strong> size) of the bit index to select a bit in the register.If the bit base oper<strong>and</strong> is a memory location, bit 0 of the byte at the specified addressis the bit base of the bit string. If the bit index is in a register, the instruction selects abit position relative to the bit base in the range –2 63 to +2 63 – 1 if the oper<strong>and</strong> size is64, –2 31 to +2 31 – 1, if the oper<strong>and</strong> size is 32, <strong>and</strong> –2 15 to +2 15 – 1 if the oper<strong>and</strong> size is16. If the bit index is in an immediate value, the bit selected is that value modulo 16,32, or 64, depending the oper<strong>and</strong> size.This instruction is useful for implementing semaphores in concurrent operatingsystems. Such an application should precede this instruction with the LOCK prefix.For details about the LOCK prefix, see “Lock Prefix” on page 10.Mnemonic Opcode DescriptionBTC reg/mem16, reg16 0F BB /rBTC reg/mem32, reg32 0F BB /rBTC reg/mem64, reg64 0F BB /rBTC reg/mem16, imm80F BA /7 ibBTC reg/mem32, imm80F BA /7 ibBTC reg/mem64, imm80F BA /7 ibCopy the value of the selected bit to the carry flag, thencomplement the selected bit.Copy the value of the selected bit to the carry flag, thencomplement the selected bit.Copy the value of the selected bit to the carry flag, thencomplement the selected bit.Copy the value of the selected bit to the carry flag, thencomplement the selected bit.Copy the value of the selected bit to the carry flag, thencomplement the selected bit.Copy the value of the selected bit to the carry flag, thencomplement the selected bit.Related <strong>Instructions</strong>BT, BTR, BTSBTC 81

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

Saved successfully!

Ooh no, something went wrong!