Opteron: Error: suffix or operands invalid for `bsf'

Francois G. Dorais dorais@gauss.dartmouth.edu
Sun, 27 Jul 2003 22:02:45 -0400 (EDT)


This new message is much more explanatory. I guess it's not a gcc or
binutils bug at all. Try the following modification of longlong.h:

At line 716 replace

#define count_trailing_zeros(count, x)					\
  do {									\
    ASSERT ((x) != 0);							\
    __asm__ ("bsfq %1,%0" : "=r" (count) : "rm" ((UDItype)(x)));	\
  } while (0)

with the following

#define count_trailing_zeros(count, x)					\
  do {									\
    UDItype __xcnt;							\
    ASSERT ((x) != 0);							\
    __asm__ ("bsfq %1,%0" : "=r" (__xcnt) : "rm" ((UDItype)(x)));	\
    (count) = __xcnt;							\
  } while (0)

This should work since the problem appears to be that the compiler uses a
32-bit register for count, the above should avoid that. I don't see how
this could have adverse side-effects but the gmp maintainers will have the
final word on that. If you're not in a hurry, wou might want to wait until
they release a patch to correct this problem rather than editing
longlong.h yourself.

Francois G. Dorais

On Sun, 27 Jul 2003, Felix E. Klee wrote:

> Thanks to all those who replied. Today I tried out compiling older versions
> and found out that 4.0 and 4.0.1 compile fine. Problems start with version
> 4.1 which, BTW, causes a different error than 4.1.2 when beeing build:
>     gcc -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP -I..
>     -DOPERATION_dive_1 -g -O2 -c dive_1.c -o dive_1.o
>     /tmp/ccr7XqMK.s: Assembler messages:
>     /tmp/ccr7XqMK.s:41: Error: Incorrect register `%esi' used with `q'
>     suffix
>
> So, I guess I'll stick with 4.0.1 since
> 1. I cannot update gcc,
> 2. the sysadmins are currently out of reach,
> 3. debugging the problem probably won't help much because a compiler update
>    likely fixes things,
> 4. hopefully, 4.0.1 isn't much slower than 4.1.2 for simple floating point
>    operations.
>
> Anyways, I attached the dive_1.s (gzipped) file for those who are
> interested.
>
> Felix
>
> --
> To contact me in private don't reply but send mail to
>     felix DOT klee AT inka DOT de
>