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.

AMD64 Technology 24594 Rev. 3.10 February 2005BSWAPByte SwapReverses the byte order of the specified register. This action converts the contents ofthe register from little endian to big endian or vice versa. In a doubleword, bits 7–0 areexchanged with bits 31–24, <strong>and</strong> bits 15–8 are exchanged with bits 23–16. In aquadword, bits 7–0 are exchanged with bits 63–56, bits 15–8 with bits 55–48, bits 23–16with bits 47–40, <strong>and</strong> bits 31–24 with bits 39–32. A subsequent use of the BSWAPinstruction with the same oper<strong>and</strong> restores the original value of the oper<strong>and</strong>.The result of applying the BSWAP instruction to a 16-bit register is undefined. To swapthe bytes of a 16-bit register, use the XCHG instruction <strong>and</strong> specify the respective bytehalves of the 16-bit register as the two oper<strong>and</strong>s. For example, to swap the bytes of AX,use XCHG AL, AH.Mnemonic Opcode DescriptionBSWAP reg32 0F C8 +rd Reverse the byte order of reg32.BSWAP reg64 0F C8 +rq Reverse the byte order of reg64.Related <strong>Instructions</strong>XCHGrFLAGS AffectedNoneExceptionsNone78 BSWAP

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

Saved successfully!

Ooh no, something went wrong!