Author: Dieter Buerssner
Date: 05:38:43 02/19/04
Go up one level in this thread
While looking at your code:
int static __inline__ FirstOne(BITBOARD word) {
  int dummy, dummy2;
       asm ("movl    $-1, %1"             "\n\t"
            "bsr     %3, %0"              "\n\t"
            "cmovz   %1, %0"              "\n\t"
            "bsr     %2, %1"              "\n\t"
	    "setnz   %b3"                 "\n\t"
	    "addl    $32,%1"              "\n\t"
	    "testb   %b3, %b3"            "\n\t"
            "cmovz   %0, %1"              "\n\t"
            "movl    $63, %0"             "\n\t"
            "subl    %1, %0"              "\n\t"
  : "=&q" (dummy), "=&q" (dummy2)
  : "q" ((int) (word>>32)), "q" ((int) word)
  : "cc");
  return (dummy);
}
This seems risky. You are changing %3 by setnz %b3 without notifying the
compiler. It is probably better, to have another output var dummy3, to notify
the compiler of this. Perhaps the & for dummy2 is not needed, because the input
is already consumed, when you first need it..
Regards,
Dieter
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.