This is the mail archive of the gcc-patches@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: [PATCH] Fix PR11784 - atomic __exchange_and_add() broken for ColdFire targets


On Tuesday 05 August 2003 00:52, Richard Henderson wrote:
> On Mon, Aug 04, 2003 at 03:22:13AM +0200, Bernardo Innocenti wrote:
> > +// bset with no immediate addressing
> > +#if defined(__mcf5200__) || defined(__mcf5300__)
> > +  __asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b"
> > +		      : /* no outputs */
> > +		      : "a"(&__Atomicity_lock<0>::_S_atomicity_lock)
> > +		      : "cc", "memory");
> > +
> > +// bset with immediate addressing
> > +#elif defined(__mc68000__)
> > +  __asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b"
> > +		      : "=m"(__Atomicity_lock<0>::_S_atomicity_lock)
> > +		      : "m"(__Atomicity_lock<0>::_S_atomicity_lock)
> > +		      : "cc");
> > +
>
> These should be combined, surely?

No, absolutely not. ColdFire cores don't provide the immediate
addressing mode for the BSET instruction (probably because it
would make the opcode too long for the simplified execution unit).

Code generated for the second version is more efficient because
the compiler don't have to load the address into an address
register and the inline asm does not need the "clobbers memory"
constraint.

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/

Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html



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