This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: m68k problem and libstdc++


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]