Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Expert Assembler Question

Author: Tony Werten

Date: 21:43:29 08/26/05

Go up one level in this thread


On August 26, 2005 at 18:12:30, Ed Schröder wrote:

>I am no longer up-to-date regarding the newest processors (such as the AMD-64)
>and the internal working concerning speed, hence my question:
>
>Which (similar) code is faster?
>
>       test    byte ptr xxx,1    |        test    byte ptr xxx,1
>       je      label             |        mov     AL,[ECX]
>       mov     AL,[ECX]          |        je      label
>       mov     BL,[EDX]          |        mov     BL,[EDX]
>       ...     ........          |        ...     ........
>       ...     ........          |        ...     ........
>label:                           | label:
>
>Thanks in advance,

Hi Ed,

probably not what you wanted to know, but the code is quite different from each
other.

If the jump condition is met 50% of the time, then the left code will execute
the 2 moves 50% of the time for an average of 1 move per loop and the right side
100%+50% is 1.5 moves per loop on average.

Did you mean something else ?

2 BTW's:

1 Depending on what you do with AL and BL, you might want to use the full
registers by doing movzx eax,[ecx] and movzx ebx,[edx] (No penalty on new
processors)

2 This kind of code might be helped a lot with conditional moves. (All new
processors support that) It basicly does a "if (cond) move eax,xx" without a
branch, so without the risk if branchmispredictions (very, very expensive on new
processors).

Tony

>
>Ed



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.