Commit 40702893 by John David Anglin

linux-atomic.c (__kernel_cmpxchg2): Change declaration of oldval and newval to const void *.

	* config/pa/linux-atomic.c (__kernel_cmpxchg2): Change declaration of
	oldval and newval to const void *.  Fix typo.
	(FETCH_AND_OP_2): Use __atomic_load_n to load value.
	(FETCH_AND_OP_WORD): Likewise.
	(OP_AND_FETCH_WORD): Likewise.
	(COMPARE_AND_SWAP_2): Likewise.
	(__sync_val_compare_and_swap_4): Likewise.
	(__sync_lock_test_and_set_4): Likewise.
	(SYNC_LOCK_RELEASE_2): Likewise.
	Remove support for long long atomic operations.

From-SVN: r220307
parent 0d9a5f8a
2015-01-31 John David Anglin <danglin@gcc.gnu.org>
* config/pa/linux-atomic.c (__kernel_cmpxchg2): Change declaration of
oldval and newval to const void *. Fix typo.
(FETCH_AND_OP_2): Use __atomic_load_n to load value.
(FETCH_AND_OP_WORD): Likewise.
(OP_AND_FETCH_WORD): Likewise.
(COMPARE_AND_SWAP_2): Likewise.
(__sync_val_compare_and_swap_4): Likewise.
(__sync_lock_test_and_set_4): Likewise.
(SYNC_LOCK_RELEASE_2): Likewise.
Remove support for long long atomic operations.
2015-01-27 Caroline Tice <cmtice@google.com> 2015-01-27 Caroline Tice <cmtice@google.com>
Committing VTV Cywin/Ming patch for Patrick Wollgast Committing VTV Cywin/Ming patch for Patrick Wollgast
......
...@@ -73,7 +73,8 @@ __kernel_cmpxchg (int oldval, int newval, int *mem) ...@@ -73,7 +73,8 @@ __kernel_cmpxchg (int oldval, int newval, int *mem)
} }
static inline long static inline long
__kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size) __kernel_cmpxchg2 (const void *oldval, const void *newval, void *mem,
int val_size)
{ {
register unsigned long lws_mem asm("r26") = (unsigned long) (mem); register unsigned long lws_mem asm("r26") = (unsigned long) (mem);
register long lws_ret asm("r28"); register long lws_ret asm("r28");
...@@ -90,7 +91,7 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size) ...@@ -90,7 +91,7 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
if (__builtin_expect (lws_errno == -EFAULT || lws_errno == -ENOSYS, 0)) if (__builtin_expect (lws_errno == -EFAULT || lws_errno == -ENOSYS, 0))
__builtin_trap (); __builtin_trap ();
/* If the kernel LWS call fails, retrun EBUSY */ /* If the kernel LWS call fails, return EBUSY */
if (!lws_errno && lws_ret) if (!lws_errno && lws_ret)
lws_errno = -EBUSY; lws_errno = -EBUSY;
...@@ -113,7 +114,7 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size) ...@@ -113,7 +114,7 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
int failure; \ int failure; \
\ \
do { \ do { \
tmp = *ptr; \ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
newval = PFX_OP (tmp INF_OP val); \ newval = PFX_OP (tmp INF_OP val); \
failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \ failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \
} while (failure != 0); \ } while (failure != 0); \
...@@ -121,13 +122,6 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size) ...@@ -121,13 +122,6 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
return tmp; \ return tmp; \
} }
FETCH_AND_OP_2 (add, , +, long long, 8, 3)
FETCH_AND_OP_2 (sub, , -, long long, 8, 3)
FETCH_AND_OP_2 (or, , |, long long, 8, 3)
FETCH_AND_OP_2 (and, , &, long long, 8, 3)
FETCH_AND_OP_2 (xor, , ^, long long, 8, 3)
FETCH_AND_OP_2 (nand, ~, &, long long, 8, 3)
FETCH_AND_OP_2 (add, , +, short, 2, 1) FETCH_AND_OP_2 (add, , +, short, 2, 1)
FETCH_AND_OP_2 (sub, , -, short, 2, 1) FETCH_AND_OP_2 (sub, , -, short, 2, 1)
FETCH_AND_OP_2 (or, , |, short, 2, 1) FETCH_AND_OP_2 (or, , |, short, 2, 1)
...@@ -150,7 +144,7 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0) ...@@ -150,7 +144,7 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0)
int failure; \ int failure; \
\ \
do { \ do { \
tmp = *ptr; \ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
newval = PFX_OP (tmp INF_OP val); \ newval = PFX_OP (tmp INF_OP val); \
failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \ failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \
} while (failure != 0); \ } while (failure != 0); \
...@@ -158,13 +152,6 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0) ...@@ -158,13 +152,6 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0)
return PFX_OP (tmp INF_OP val); \ return PFX_OP (tmp INF_OP val); \
} }
OP_AND_FETCH_2 (add, , +, long long, 8, 3)
OP_AND_FETCH_2 (sub, , -, long long, 8, 3)
OP_AND_FETCH_2 (or, , |, long long, 8, 3)
OP_AND_FETCH_2 (and, , &, long long, 8, 3)
OP_AND_FETCH_2 (xor, , ^, long long, 8, 3)
OP_AND_FETCH_2 (nand, ~, &, long long, 8, 3)
OP_AND_FETCH_2 (add, , +, short, 2, 1) OP_AND_FETCH_2 (add, , +, short, 2, 1)
OP_AND_FETCH_2 (sub, , -, short, 2, 1) OP_AND_FETCH_2 (sub, , -, short, 2, 1)
OP_AND_FETCH_2 (or, , |, short, 2, 1) OP_AND_FETCH_2 (or, , |, short, 2, 1)
...@@ -186,7 +173,7 @@ OP_AND_FETCH_2 (nand, ~, &, signed char, 1, 0) ...@@ -186,7 +173,7 @@ OP_AND_FETCH_2 (nand, ~, &, signed char, 1, 0)
int failure, tmp; \ int failure, tmp; \
\ \
do { \ do { \
tmp = *ptr; \ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \ failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
} while (failure != 0); \ } while (failure != 0); \
\ \
...@@ -207,7 +194,7 @@ FETCH_AND_OP_WORD (nand, ~, &) ...@@ -207,7 +194,7 @@ FETCH_AND_OP_WORD (nand, ~, &)
int tmp, failure; \ int tmp, failure; \
\ \
do { \ do { \
tmp = *ptr; \ tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \ failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
} while (failure != 0); \ } while (failure != 0); \
\ \
...@@ -233,7 +220,7 @@ typedef unsigned char bool; ...@@ -233,7 +220,7 @@ typedef unsigned char bool;
\ \
while (1) \ while (1) \
{ \ { \
actual_oldval = *ptr; \ actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
\ \
if (__builtin_expect (oldval != actual_oldval, 0)) \ if (__builtin_expect (oldval != actual_oldval, 0)) \
return actual_oldval; \ return actual_oldval; \
...@@ -242,7 +229,7 @@ typedef unsigned char bool; ...@@ -242,7 +229,7 @@ typedef unsigned char bool;
\ \
if (__builtin_expect (!fail, 1)) \ if (__builtin_expect (!fail, 1)) \
return actual_oldval; \ return actual_oldval; \
} \ } \
} \ } \
\ \
bool HIDDEN \ bool HIDDEN \
...@@ -253,7 +240,6 @@ typedef unsigned char bool; ...@@ -253,7 +240,6 @@ typedef unsigned char bool;
return (failure != 0); \ return (failure != 0); \
} }
COMPARE_AND_SWAP_2 (long long, 8, 3)
COMPARE_AND_SWAP_2 (short, 2, 1) COMPARE_AND_SWAP_2 (short, 2, 1)
COMPARE_AND_SWAP_2 (char, 1, 0) COMPARE_AND_SWAP_2 (char, 1, 0)
...@@ -264,7 +250,7 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval) ...@@ -264,7 +250,7 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
while (1) while (1)
{ {
actual_oldval = *ptr; actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
if (__builtin_expect (oldval != actual_oldval, 0)) if (__builtin_expect (oldval != actual_oldval, 0))
return actual_oldval; return actual_oldval;
...@@ -291,14 +277,13 @@ TYPE HIDDEN \ ...@@ -291,14 +277,13 @@ TYPE HIDDEN \
int failure; \ int failure; \
\ \
do { \ do { \
oldval = *ptr; \ oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg2 (&oldval, &val, ptr, INDEX); \ failure = __kernel_cmpxchg2 (&oldval, &val, ptr, INDEX); \
} while (failure != 0); \ } while (failure != 0); \
\ \
return oldval; \ return oldval; \
} }
SYNC_LOCK_TEST_AND_SET_2 (long long, 8, 3)
SYNC_LOCK_TEST_AND_SET_2 (short, 2, 1) SYNC_LOCK_TEST_AND_SET_2 (short, 2, 1)
SYNC_LOCK_TEST_AND_SET_2 (signed char, 1, 0) SYNC_LOCK_TEST_AND_SET_2 (signed char, 1, 0)
...@@ -308,7 +293,7 @@ __sync_lock_test_and_set_4 (int *ptr, int val) ...@@ -308,7 +293,7 @@ __sync_lock_test_and_set_4 (int *ptr, int val)
int failure, oldval; int failure, oldval;
do { do {
oldval = *ptr; oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
failure = __kernel_cmpxchg (oldval, val, ptr); failure = __kernel_cmpxchg (oldval, val, ptr);
} while (failure != 0); } while (failure != 0);
...@@ -322,12 +307,11 @@ __sync_lock_test_and_set_4 (int *ptr, int val) ...@@ -322,12 +307,11 @@ __sync_lock_test_and_set_4 (int *ptr, int val)
TYPE failure, oldval, zero = 0; \ TYPE failure, oldval, zero = 0; \
\ \
do { \ do { \
oldval = *ptr; \ oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
failure = __kernel_cmpxchg2 (&oldval, &zero, ptr, INDEX); \ failure = __kernel_cmpxchg2 (&oldval, &zero, ptr, INDEX); \
} while (failure != 0); \ } while (failure != 0); \
} }
SYNC_LOCK_RELEASE_2 (long long, 8, 3)
SYNC_LOCK_RELEASE_2 (short, 2, 1) SYNC_LOCK_RELEASE_2 (short, 2, 1)
SYNC_LOCK_RELEASE_2 (signed char, 1, 0) SYNC_LOCK_RELEASE_2 (signed char, 1, 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment