Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Saved Another Cycle -- Woohoo!

Author: Matt Taylor

Date: 09:28:57 01/09/03

Go up one level in this thread


On January 08, 2003 at 07:06:58, Vincent Diepeveen wrote:

>On January 06, 2003 at 13:12:24, Matt Taylor wrote:
>
>Matt, i see you use 8 bits code mixed with 32 bits.
>
>Isn't 8 bits code slower on P4?
>
<snip>

Using byte registers is not slower on any modern processor (Pentium and later),
and I don't remember it being any slower on earlier chips. As of P6-core, mixing
byte register accesses with full register accesses (e.g. eax/al) incurs
penalties if you don't follow the rules.

On Athlon, which is the chip I targetted this code to, you can mix eax and al
with no penalty if you clear the register first using either xor reg, reg.
(Hearsay has is that sub reg, reg works also.) The idea is that Athlon knows the
upper 24-bits are zero, so rather than merging al with the contents of eax, it
just zero-extends to 32-bits.

The rules for P6-core (Pentium Pro/2/3) are similar but not as flexible. Using
8-bit registers incurs the penalty if you don't clear the register first. I
don't know all the rules for P6, but the Intel optimization manual for P6-core
processors describes the rules. Likewise for P7-core (Pentium 4).

-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.