1
1

Update the MIPS atomics. We can now compile with gcc and Pathscale.

This commit was SVN r20154.
Этот коммит содержится в:
George Bosilca 2008-12-18 22:38:31 +00:00
родитель 7fc48ae11e
Коммит 24e191a076
2 изменённых файлов: 27 добавлений и 28 удалений

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

@ -32,7 +32,7 @@ retry1:
bne $3, $5, done1
or $2, $6, 0
sc $2, 0($4)
bne $2, 1, retry1
beqz $2, retry1
done1:
.set reorder
@ -49,7 +49,7 @@ retry2:
bne $3, $5, done2
or $2, $6, 0
sc $2, 0($4)
bne $2, 1, retry2
beqz $2, retry2
done2:
sync
.set reorder
@ -68,7 +68,7 @@ retry3:
bne $3, $5, done3
or $2, $6, 0
sc $2, 0($4)
bne $2, 1, retry3
beqz $2, retry3
done3:
.set reorder
@ -85,7 +85,7 @@ retry4:
bne $3, $5, done4
or $2, $6, 0
scd $2, 0($4)
bne $2, 1, retry4
beqz $2, retry4
done4:
.set reorder
@ -102,7 +102,7 @@ retry5:
bne $3, $5, done5
or $2, $6, 0
scd $2, 0($4)
bne $2, 1, retry5
beqz $2, retry5
done5:
.set reorder
sync
@ -120,7 +120,7 @@ retry6:
bne $3, $5, done6
or $2, $6, 0
scd $2, 0($4)
bne $2, 1, retry6
beqz $2, retry6
done6:
.set reorder

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

@ -89,21 +89,21 @@ static inline int opal_atomic_cmpset_32(volatile int32_t *addr,
int32_t oldval, int32_t newval)
{
int32_t ret;
int32_t tmp;
__asm__ __volatile__ ("\t"
".set noreorder \n"
"1: \n\t"
"ll %0, %2 \n\t" /* load *addr into ret */
"bne %0, %3, 2f \n\t" /* done if oldval != ret */
"or %5, %4, 0 \n\t" /* ret = newval */
"sc %5, %2 \n\t" /* store ret in *addr */
__asm__ __volatile__ (".set noreorder \n"
".set noat \n"
"1: \n"
"ll %0, %2 \n" /* load *addr into ret */
"bne %0, %z3, 2f \n" /* done if oldval != ret */
"or $1, %z4, 0 \n" /* tmp = newval (delay slot) */
"sc $1, %2 \n" /* store tmp in *addr */
/* note: ret will be 0 if failed, 1 if succeeded */
"bne %5, 1, 1b \n\t"
"2: \n\t"
"beqz $1, 1b \n" /* if 0 jump back to 1b */
"nop \n" /* fill delay slots */
"2: \n"
".set reorder \n"
: "=&r"(ret), "=m"(*addr)
: "m"(*addr), "r"(oldval), "r"(newval), "r"(tmp)
: "m"(*addr), "r"(oldval), "r"(newval)
: "cc", "memory");
return (ret == oldval);
}
@ -138,22 +138,21 @@ static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
int64_t oldval, int64_t newval)
{
int64_t ret;
int64_t tmp;
__asm__ __volatile__ ("\t"
".set noreorder \n"
"1: \n\t"
__asm__ __volatile__ (".set noreorder \n"
".set noat \n"
"1: \n\t"
"lld %0, %2 \n\t" /* load *addr into ret */
"bne %0, %3, 2f \n\t" /* done if oldval != ret */
"or %5, %4, 0 \n\t" /* tmp = newval */
"scd %5, %2 \n\t" /* store tmp in *addr */
"bne %0, %z3, 2f \n\t" /* done if oldval != ret */
"or $1, %4, 0 \n\t" /* tmp = newval (delay slot) */
"scd $1, %2 \n\t" /* store tmp in *addr */
/* note: ret will be 0 if failed, 1 if succeeded */
"bne %5, 1, 1b \n"
"2: \n\t"
"beqz $1, 1b \n\t" /* if 0 jump back to 1b */
"nop \n\t" /* fill delay slot */
"2: \n\t"
".set reorder \n"
: "=&r" (ret), "=m" (*addr)
: "m" (*addr), "r" (oldval), "r" (newval),
"r"(tmp)
: "m" (*addr), "r" (oldval), "r" (newval)
: "cc", "memory");
return (ret == oldval);