I usually prefer the expanded notation: unsigned char ret; __asm__ __volatile__ ( "lock; cmpxchgl %3,%4 \n\t" " sete %0 \n\t" : "=qm" (ret), "=a" (oldval), "=m" (*addr) : "q"(newval), "m"(*addr), "1"(oldval) : "memory", "cc");
return (int)ret; } as it shows more clearly the input and output registers. But your version does exactly the same thing. I'll commit shortly. Thanks, george. On Feb 10, 2010, at 10:55 , Ake Sandgren wrote: > On Wed, 2010-02-10 at 08:42 -0700, Barrett, Brian W wrote: >> Adding the memory and cc will certainly do no harm, and someone tried to >> remove them as an optimization. I wouldn't change the input and output >> lines - the differences are mainly syntactic sugar. > > Gcc actually didn't like the example i sent earlier. > Another iteration gave this as a working (gcc/intel/pgi/pathscale works) > code. > > 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) > : "memory", "cc"); > > return (int)ret; > } > > -- > 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 > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users