Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: With Hammer it becomes easier!

Author: Matt Taylor

Date: 04:40:05 01/22/03

Go up one level in this thread


On January 22, 2003 at 07:23:08, Gerd Isenberg wrote:

>from
>
>AMD 64-Bit Technology
>AMD x86-64 Architecture
>Programmer’s Manual
>Volume 3:
>General-Purpose and System
>Instructions
>
>--------------------------------------------------------------------------------
>
>BSWAP Byte Swap
>
>Reverses the byte order of the specified register. This action converts the
>contents of the register from little endian to big endian or vice versa. In a
>doubleword, bits 7–0 are exchanged with bits 31–24, and bits 15–8 are exchanged
>with bits 23–16. In a quadword, bits 7–0 are exchanged with bits 63–56, bits
>15–8 with bits 55–48, bits 23–16 with bits 47–40, and bits 31–24 with bits
>39–32. A subsequent use of the BSWAP instruction with the same operand restores
>the original value of the operand. The result of applying the BSWAP instruction
>to a 16-bit register is undefined. To swap the bytes of a 16-bit register, use
>the XCHG instruction and specify the respective byte halves of the 16-bit
>register as the two operands. For example, to swap the bytes of AX, use XCHG
>AL,AH.
>
>Related Instructions
>XCHG
>BSWAP Byte Swap
>Mnemonic Opcode Description
>BSWAP reg32 0F C8 +rd Reverse the byte order of reg32.
>BSWAP reg64 0F C8 +rd Reverse the byte order of reg64.

Oh...doh! Ok, good point. Now 3 iterations for free, not just 2 with cheap swap
tricks. (Plus better preservation of decode resources and smaller code.)

Dann - I was wrong in my statement about x86-64!

-Matt



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.