Use atomic64_t with 64bit atomic macros

This commit is contained in:
H.J. Lu 2012-03-19 17:29:26 -07:00
parent 24d8f4b7dc
commit 95443d88af
2 changed files with 18 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2012-03-19 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/bits/atomic.h
(__arch_c_compare_and_exchange_val_64_acq): Use atomic64_t on
64bit integer.
(atomic_exchange_acq): Likewise.
(__arch_exchange_and_add_body): Likewise.
(__arch_add_body): Likewise.
(atomic_add_negative): Likewise.
(atomic_add_zero): Likewise.
2012-03-19 H.J. Lu <hongjiu.lu@intel.com> 2012-03-19 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/bits/mathdef.h: Don't include <bits/wordsize.h>. * sysdeps/x86_64/bits/mathdef.h: Don't include <bits/wordsize.h>.

View File

@ -101,8 +101,8 @@ typedef uintmax_t uatomic_max_t;
"lock\n" \ "lock\n" \
"0:\tcmpxchgq %q2, %1" \ "0:\tcmpxchgq %q2, %1" \
: "=a" (ret), "=m" (*mem) \ : "=a" (ret), "=m" (*mem) \
: "q" ((long int) (newval)), "m" (*mem), \ : "q" ((atomic64_t) (newval)), "m" (*mem), \
"0" ((long int)oldval), \ "0" ((atomic64_t) (oldval)), \
"i" (offsetof (tcbhead_t, multiple_threads))); \ "i" (offsetof (tcbhead_t, multiple_threads))); \
ret; }) ret; })
@ -125,7 +125,7 @@ typedef uintmax_t uatomic_max_t;
else \ else \
__asm __volatile ("xchgq %q0, %1" \ __asm __volatile ("xchgq %q0, %1" \
: "=r" (result), "=m" (*mem) \ : "=r" (result), "=m" (*mem) \
: "0" ((long) (newvalue)), "m" (*mem)); \ : "0" ((atomic64_t) (newvalue)), "m" (*mem)); \
result; }) result; })
@ -149,7 +149,7 @@ typedef uintmax_t uatomic_max_t;
else \ else \
__asm __volatile (lock "xaddq %q0, %1" \ __asm __volatile (lock "xaddq %q0, %1" \
: "=r" (result), "=m" (*mem) \ : "=r" (result), "=m" (*mem) \
: "0" ((long) (value)), "m" (*mem), \ : "0" ((atomic64_t) (value)), "m" (*mem), \
"i" (offsetof (tcbhead_t, multiple_threads))); \ "i" (offsetof (tcbhead_t, multiple_threads))); \
result; }) result; })
@ -187,7 +187,7 @@ typedef uintmax_t uatomic_max_t;
else \ else \
__asm __volatile (lock "addq %q1, %0" \ __asm __volatile (lock "addq %q1, %0" \
: "=m" (*mem) \ : "=m" (*mem) \
: "ir" ((long) (value)), "m" (*mem), \ : "ir" ((atomic64_t) (value)), "m" (*mem), \
"i" (offsetof (tcbhead_t, multiple_threads))); \ "i" (offsetof (tcbhead_t, multiple_threads))); \
} while (0) } while (0)
@ -218,7 +218,7 @@ typedef uintmax_t uatomic_max_t;
else \ else \
__asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1" \ __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1" \
: "=m" (*mem), "=qm" (__result) \ : "=m" (*mem), "=qm" (__result) \
: "ir" ((long) (value)), "m" (*mem)); \ : "ir" ((atomic64_t) (value)), "m" (*mem)); \
__result; }) __result; })
@ -239,7 +239,7 @@ typedef uintmax_t uatomic_max_t;
else \ else \
__asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1" \ __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1" \
: "=m" (*mem), "=qm" (__result) \ : "=m" (*mem), "=qm" (__result) \
: "ir" ((long) (value)), "m" (*mem)); \ : "ir" ((atomic64_t) (value)), "m" (*mem)); \
__result; }) __result; })