Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Questions to Paul Hunter about the assembly

Author: Gerd Isenberg

Date: 18:01:29 08/23/04

Go up one level in this thread


On August 23, 2004 at 16:37:13, Lance Perkins wrote:

>On August 23, 2004 at 14:56:56, Gerd Isenberg wrote:
>
>>
>>No. Some posted C-Code snippets may produce same assembly.
>
>Huh? The entire computer science community is laughing here. Prove then that you
>can write a different C code that will produce this same assembly. Then tell
>that to Bob since he teaches these things in school.


If some C or even pseudo source code was posted here in CCC, like Vincent's move
generator or some kogge stone filler or whatever else, it is not unlikely to
produce same assembly here and there.


>
>I've written compiler backends, btw. Its an exact science.
>

Yes.

>>
>>Ok, that looks odd.
>>
>>OTOH it sounds logical to me that EvaluateMate returns VALUE_MATE but for some
>>reason this executable was compiled with other #define switches for instance.
>>Wasn't such tautological conditions a former trick to align code and to have
>>influence on branch predictions inside this code cache line?
>
>Are you just throwing out random words here? You add a check to align code?

IIRC there was a short jmp $+3 or so to padd some code bytes.
Of course i was joking a bit about cmp eax, VALUE_MATE jxx for alignment or
branch prediction reasons, sorry for that.


>Also, there is nothing to predict here as far as branching is concerned. There
>should be no branching at all. The correct C code should be:
>int ms=EvaluateMate(tree);
>// if (ms == 99999) break; /* removed */
>score+=ms;
>
>>
>>Such statements might be possible in a lot of other chess programs.
>>What secret algorithm is inside the if-body?
>>
>>if ((TotalBlackPieces==0) && (TotalWhitePieces==6) &&
>>      (!WhitePawns) && (!BlackPawns) && WhiteBishops && WhiteKnights) {
>>
>
>I've only commented on a portion of the code. Can't you figure out the rest by
>yourself?

Sorry i'm absolutely not familar with crafty's source.
It would be nice to see the intended mapping of Crafty C-source and the posted
assembly, which you did for the if statement above but not for the rest of the
assembly.

Thanks,
Gerd



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.