1
1

* Fix warning with redefining #define

* Fix compiler error on Sparc64 when not inlining assembly
* Fix error in Sparc64 compare&swap operations.  Now pass test suite

This commit was SVN r4436.
Этот коммит содержится в:
Brian Barrett 2005-02-15 18:37:47 +00:00
родитель a2caf839c0
Коммит 3213187beb
3 изменённых файлов: 25 добавлений и 9 удалений

Просмотреть файл

@ -34,8 +34,8 @@ END_FUNC(ompi_atomic_wmb)
START_FUNC(ompi_atomic_cmpset_32)
!#PROLOGUE# 0
!#PROLOGUE# 1
mov %o1, %g1
casa [%o0] 0x80, %o2, %g1
mov %o2, %g1
casa [%o0] 0x80, %o1, %g1
xor %g1, %o1, %g1
subcc %g0, %g1, %g0
retl
@ -77,8 +77,8 @@ END_FUNC(ompi_atomic_cmpset_rel_32)
START_FUNC(ompi_atomic_cmpset_64)
!#PROLOGUE# 0
!#PROLOGUE# 1
mov %o1, %g1
casxa [%o0] 0x80, %o2, %g1
mov %o2, %g1
casxa [%o0] 0x80, %o1, %g1
xor %g1, %o1, %g1
mov 0, %o0
retl

Просмотреть файл

@ -248,6 +248,7 @@ void ompi_atomic_unlock(ompi_lock_t *lock);
#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0
#undef OMPI_HAVE_ATOMIC_SPINLOCKS
#define OMPI_HAVE_ATOMIC_SPINLOCKS (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64)
#define OMPI_NEED_INLINE_ATOMIC_SPINLOCKS
#endif

Просмотреть файл

@ -33,7 +33,7 @@
* Define constants for UltraSparc 64
*
*********************************************************************/
#define OMPI_HAVE_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1
@ -77,11 +77,19 @@ static inline void ompi_atomic_wmb(void)
static inline int ompi_atomic_cmpset_32( volatile int32_t *addr,
int32_t oldval, int32_t newval)
{
int32_t ret = oldval;
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
*
* if (*(reg(rs1)) == reg(rs1) )
* swap reg(rd), *(reg(rs1))
* else
* reg(rd) = *(reg(rs1))
*/
int32_t ret = newval;
__asm__ __volatile("casa [%1] " ASI_P ", %2, %0"
: "+r" (ret)
: "r" (addr), "r" (newval));
: "r" (addr), "r" (oldval));
return (ret == oldval);
}
@ -109,11 +117,18 @@ static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr,
static inline int ompi_atomic_cmpset_64( volatile int64_t *addr,
int64_t oldval, int64_t newval)
{
int64_t ret = oldval;
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
*
* if (*(reg(rs1)) == reg(rs1) )
* swap reg(rd), *(reg(rs1))
* else
* reg(rd) = *(reg(rs1))
*/
int64_t ret = newval;
__asm__ __volatile("casxa [%1] " ASI_P ", %2, %0"
: "+r" (ret)
: "r" (addr), "r" (newval));
: "r" (addr), "r" (oldval));
return (ret == oldval);
}