m68k problem and libstdc++

Roman Zippel zippel@linux-m68k.org
Sat Jan 12 06:27:00 GMT 2002


Hi,

Craig Rodrigues wrote:

> +// * variants with the "tas" instruction
> +//   cpu32, 5400
> +// * variants with no atomic read/modify/write instruction at all
> +//   68000/10, 5200/300

The 68000 already has the tas instruction.

> -static inline void
> +static void
>  __attribute__ ((__unused__))
>  __atomic_add (volatile _Atomic_word* __mem, int __val)
>  {
> -  __asm__ __volatile__ ("add%.l %0,%1"
> -                       : : "id" (__val), "m" (*__mem) : "memory");
> +  static unsigned char __lock;
> +  _Atomic_word __tmp;
> +
> +  __asm__ __volatile__( "add%.l        %1,(%0)"
> +                       :
> +                       : "a" (__mem), "d" (__val)
> +                       : "memory" );
>  }

Why was that changed? The "inline" is removed and the constraints are
more restrictive.
Hmm, I think the '"m" (*__mem)' should rather be a '"+m" (*__mem)' in
the output arguments, then '"memory"' wouldn't be required anymore.

bye, Roman



More information about the Libstdc++ mailing list