diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-23 01:38:00 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-23 01:38:00 +0000 |
commit | 5994c992cc75abb67085190a7fa7848604ea67aa (patch) | |
tree | 123b92e3d573ae32f58f2baa33d404885dfc8247 /libjava/sysdep | |
parent | 4e30d7e6201f4bd94e77b2c5fde23ca8e97af133 (diff) | |
download | gcc-5994c992cc75abb67085190a7fa7848604ea67aa.tar.gz |
* sysdep/ia64/locks.h: Include ia64intrin.h.
(compare_and_swap): Use __sync_bool_compare_and_swap.
(compare_and_swap_release): Expose ar.ccv assignment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64737 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/sysdep')
-rw-r--r-- | libjava/sysdep/ia64/locks.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libjava/sysdep/ia64/locks.h b/libjava/sysdep/ia64/locks.h index 6edee83ea99..bde43b420fb 100644 --- a/libjava/sysdep/ia64/locks.h +++ b/libjava/sysdep/ia64/locks.h @@ -11,6 +11,8 @@ details. */ #ifndef __SYSDEP_LOCKS_H__ #define __SYSDEP_LOCKS_H__ +#include <ia64intrin.h> + typedef size_t obj_addr_t; /* Integer type big enough for object */ /* address. */ @@ -19,11 +21,7 @@ compare_and_swap(volatile obj_addr_t *addr, obj_addr_t old, obj_addr_t new_val) { - unsigned long oldval; - __asm__ __volatile__("mov ar.ccv=%4 ;; cmpxchg8.acq %0=%1,%2,ar.ccv" - : "=r"(oldval), "=m"(*addr) - : "r"(new_val), "1"(*addr), "r"(old) : "memory"); - return (oldval == old); + return __sync_bool_compare_and_swap (addr, old, new_val); } // The fact that *addr is volatile should cause the compiler to @@ -31,7 +29,7 @@ compare_and_swap(volatile obj_addr_t *addr, inline static void release_set(volatile obj_addr_t *addr, obj_addr_t new_val) { - __asm__ __volatile__(" " : : : "memory"); + __asm__ __volatile__("" : : : "memory"); *(addr) = new_val; } @@ -40,11 +38,12 @@ compare_and_swap_release(volatile obj_addr_t *addr, obj_addr_t old, obj_addr_t new_val) { - unsigned long oldval; - __asm__ __volatile__("mov ar.ccv=%4 ;; cmpxchg8.rel %0=%1,%2,ar.ccv" - : "=r"(oldval), "=m"(*addr) - : "r"(new_val), "1"(*addr), "r"(old) : "memory"); - return (oldval == old); + register unsigned long ar_ccv __asm__("ar.ccv") = old; + unsigned long out; + __asm__ __volatile__("cmpxchg8.rel %0=%1,%2,%4" + : "=r"(out), "=m"(*addr) + : "r"(new_val), "m"(*addr), "d"(ar_ccv) : "memory"); + return (out == old); } #endif |