On Wed, 2010-02-10 at 08:21 -0500, Jeff Squyres wrote:
> On Feb 10, 2010, at 7:47 AM, Ake Sandgren wrote:
> 
> > According to people who knows asm statements fairly well (compiler
> > developers), it should be
> 
> > static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
> >                                          int32_t oldval, int32_t newval)
> > {
> >     unsigned char ret;
> >     __asm__ __volatile__ (
> >                         SMPLOCK "cmpxchgl %3,%2   \n\t"
> >                                 "sete     %0      \n\t"
> >                         : "=qm" (ret), "=a" (oldval), "=m" (*addr)
> >                         : "q"(newval), "2"(*addr), "1"(oldval)
> >                         : "memory", "cc");
> > 
> >     return (int)ret;
> > }
> 
> Disclaimer: I know almost nothing about assembly.
> 
> I know that OMPI's asm is a carefully crafted set of assembly that works 
> across a broad range of compilers.  So what might not be "quite right" for 
> one compiler may actually be there because another compiler needs it.
> 
> That being said, if the changes above are for correctness, not 
> neatness/style/etc., I can't speak for that...

The above should be correct for gcc style unless i misunderstood them.

Quoting from their reply:
'it should be "memory", "cc" since you also have to tell gcc you're
clobbering the EFLAGS'

And i don't know asm either so...

-- 
Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden
Internet: a...@hpc2n.umu.se   Phone: +46 90 7866134 Fax: +46 90 7866126
Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se

Reply via email to