addu and subu are special. We need to use daddu and dsubu here to get

proper behavior.

Submitted by:	jmallet@
This commit is contained in:
Warner Losh 2009-07-05 21:16:26 +00:00
parent ece5503dbe
commit 3eecc82e89

View File

@ -220,7 +220,7 @@ atomic_add_64(__volatile uint64_t *p, uint64_t v)
__asm __volatile (
"1:\n\t"
"lld %0, %3\n\t" /* load old value */
"addu %0, %2, %0\n\t" /* calculate new value */
"daddu %0, %2, %0\n\t" /* calculate new value */
"scd %0, %1\n\t" /* attempt to store */
"beqz %0, 1b\n\t" /* spin if failed */
: "=&r" (temp), "=m" (*p)
@ -236,7 +236,7 @@ atomic_subtract_64(__volatile uint64_t *p, uint64_t v)
__asm __volatile (
"1:\n\t"
"lld %0, %3\n\t" /* load old value */
"subu %0, %2\n\t" /* calculate new value */
"dsubu %0, %2\n\t" /* calculate new value */
"scd %0, %1\n\t" /* attempt to store */
"beqz %0, 1b\n\t" /* spin if failed */
: "=&r" (temp), "=m" (*p)