Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Self-Correction

Author: Matt Taylor

Date: 11:23:31 01/18/03

Go up one level in this thread


On January 18, 2003 at 13:22:02, Dieter Buerssner wrote:

>On January 18, 2003 at 05:16:06, Matt Taylor wrote:
>
>>GCC-style:
>>asm("\txorl\t%%eax, %%eax\n
>>    "\tmovl\t$1, %%edx\n"
>>
>>    "\tshll\t%%cl, %%edx\n"
>>    "\ttestl\t$32, %%ecx\n"
>>    "\tmovl\t$0, %%ecx\n"
>>
>>    "\tcmovnzl\t%%edx, %%eax\n"
>>    "\tcmovnzl\t%%ecx, %%edx\n"
>>    : "=A" (index) : "c" (count), "A" (1));
>
>This is very fragile code. You are not telling the compiler, that you modify
>ecx, and the flags register. Does "A" mean the edx:eax pair? The input ("A" (1))
>does not seem to make sense, because you set it in the assembly anyway.
>
>Regards,
>Dieter

The code works fine. The GCC manual (as well as the inline asm tutorials)
specifies that inputs are modified. Yes, the "A" is edx:eax.

You are right about the redundant first two asm instructions. I was very tired.
I decided to have gcc load edx:eax with 1 at its convenience, and I forgot to
delete the appropraite asm lines.

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