Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Avoiding if ( expr ) and branch misprediction ?

Author: Gerd Isenberg

Date: 15:19:38 01/20/06

Go up one level in this thread



>>Oups, r08 is probably wrong here - how is the syntax of using partial 32-, 16-
>>or 8-bit partial r08-r15 registers?
>
>I honestly don't know, because I did not try to see if such a thing was
>possible.  The things I did in X86-64 asm were for 64 bit operations, so rax or
>r8 were just fine.  No idea what can be done with respect to 32 bit partial
>registers for the new ones...
>
>

D (DWORD) postfix, r8D–r15D

----------------------------------------------------------------------------

Software Optimization Guide for AMD64 Processors
25112 Rev. 3.06 September 2005

pg 68 General 64-Bit Optimizations Chapter 3

3.4 32-Bit Legacy GPRs and Small Unsigned Integers

Optimization

Use the 32-bit legacy general-purpose registers (EAX through ESI) instead of
their 64-bit extensions to store unsigned integer values whose range never
requires more than 32 bits, even if subsequent statements use the 32-bit value
in a 64-bit operation. (For example, use ECX instead of RCX until you need to
perform a 64-bit operation; then use RCX.)

Rationale

In 64-bit mode, the machine-language representation of many instructions that
operate on 64-bit register operands requires a REX prefix byte, which increases
the size of the code. However, instructions that operate on a 32-bit legacy
register operand do not require the prefix and have the desirable side-effect of
clearing the upper 32 bits of the extended register to zero. For example, using
the AND instruction on ECX clears the upper half of RCX.

Caution

Because the assembler also uses a REX prefix byte to encode the 32-bit sizes of
the eight new 64-bit general-purpose registers (R8D–R15D), you should only use
one of the original eight generalpurpose registers (EAX through ESI) to
implement this technique.



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.