Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move generation question for the big boys

Author: Rafael Andrist

Date: 14:12:54 09/15/01

Go up one level in this thread


On September 15, 2001 at 16:17:52, Vincent Diepeveen wrote:

>Like if i check for 2 non-array/pointer entities for being zero:
>
>if( a & b )
>  then do this and that;
>
>to produce some crap assembly:
>  CMP EAX,0
>  JNZ LOOP
>  CMP EDX,0
>  JNZ LOOP1
>
>Now already people will complain: "you don't need special CMP for
>2 different statements". Well they're right.
>
>In fact you don't need 2 compares even. All you need is something
>primitive like:
>
>  ADD EAX,EDX
>  CMP EAX,0
>  JNZ LOOP1
>

This won't work because eax+edx can be zero if, e.g., eax=-2 and edx=2. If you
use only positive values (pointers), it can happen too if you get an overflow.

You have to write it that way:

; reading from memory
; do something else to avoid AGI stall
or  eax, edx
; use other pipe for other thing
cmp eax, 0
jnz loop1


Rafael B. Andrist



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.