Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Problems building Open MPI 1.4.1 with Pathscale
From: George Bosilca (bosilca_at_[hidden])
Date: 2010-02-17 18:15:10


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: ake_at_[hidden] Phone: +46 90 7866134 Fax: +46 90 7866126
> Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users