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
This commit is contained in:
parent
0d9a5f8adc
commit
407028931a
@ -1,3 +1,16 @@
|
||||
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>
|
||||
|
||||
Committing VTV Cywin/Ming patch for Patrick Wollgast
|
||||
|
@ -73,7 +73,8 @@ __kernel_cmpxchg (int oldval, int newval, int *mem)
|
||||
}
|
||||
|
||||
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 long lws_ret asm("r28");
|
||||
@ -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))
|
||||
__builtin_trap ();
|
||||
|
||||
/* If the kernel LWS call fails, retrun EBUSY */
|
||||
/* If the kernel LWS call fails, return EBUSY */
|
||||
if (!lws_errno && lws_ret)
|
||||
lws_errno = -EBUSY;
|
||||
|
||||
@ -113,7 +114,7 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
|
||||
int failure; \
|
||||
\
|
||||
do { \
|
||||
tmp = *ptr; \
|
||||
tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
|
||||
newval = PFX_OP (tmp INF_OP val); \
|
||||
failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \
|
||||
} while (failure != 0); \
|
||||
@ -121,13 +122,6 @@ __kernel_cmpxchg2 (void * oldval, void * newval, void *mem, int val_size)
|
||||
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 (sub, , -, short, 2, 1)
|
||||
FETCH_AND_OP_2 (or, , |, short, 2, 1)
|
||||
@ -150,7 +144,7 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0)
|
||||
int failure; \
|
||||
\
|
||||
do { \
|
||||
tmp = *ptr; \
|
||||
tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
|
||||
newval = PFX_OP (tmp INF_OP val); \
|
||||
failure = __kernel_cmpxchg2 (&tmp, &newval, ptr, INDEX); \
|
||||
} while (failure != 0); \
|
||||
@ -158,13 +152,6 @@ FETCH_AND_OP_2 (nand, ~, &, signed char, 1, 0)
|
||||
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 (sub, , -, short, 2, 1)
|
||||
OP_AND_FETCH_2 (or, , |, short, 2, 1)
|
||||
@ -186,7 +173,7 @@ OP_AND_FETCH_2 (nand, ~, &, signed char, 1, 0)
|
||||
int failure, tmp; \
|
||||
\
|
||||
do { \
|
||||
tmp = *ptr; \
|
||||
tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
|
||||
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
|
||||
} while (failure != 0); \
|
||||
\
|
||||
@ -207,7 +194,7 @@ FETCH_AND_OP_WORD (nand, ~, &)
|
||||
int tmp, failure; \
|
||||
\
|
||||
do { \
|
||||
tmp = *ptr; \
|
||||
tmp = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
|
||||
failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
|
||||
} while (failure != 0); \
|
||||
\
|
||||
@ -233,7 +220,7 @@ typedef unsigned char bool;
|
||||
\
|
||||
while (1) \
|
||||
{ \
|
||||
actual_oldval = *ptr; \
|
||||
actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
|
||||
\
|
||||
if (__builtin_expect (oldval != actual_oldval, 0)) \
|
||||
return actual_oldval; \
|
||||
@ -242,7 +229,7 @@ typedef unsigned char bool;
|
||||
\
|
||||
if (__builtin_expect (!fail, 1)) \
|
||||
return actual_oldval; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
bool HIDDEN \
|
||||
@ -253,7 +240,6 @@ typedef unsigned char bool;
|
||||
return (failure != 0); \
|
||||
}
|
||||
|
||||
COMPARE_AND_SWAP_2 (long long, 8, 3)
|
||||
COMPARE_AND_SWAP_2 (short, 2, 1)
|
||||
COMPARE_AND_SWAP_2 (char, 1, 0)
|
||||
|
||||
@ -264,7 +250,7 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
|
||||
|
||||
while (1)
|
||||
{
|
||||
actual_oldval = *ptr;
|
||||
actual_oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
|
||||
|
||||
if (__builtin_expect (oldval != actual_oldval, 0))
|
||||
return actual_oldval;
|
||||
@ -291,14 +277,13 @@ TYPE HIDDEN \
|
||||
int failure; \
|
||||
\
|
||||
do { \
|
||||
oldval = *ptr; \
|
||||
oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
|
||||
failure = __kernel_cmpxchg2 (&oldval, &val, ptr, INDEX); \
|
||||
} while (failure != 0); \
|
||||
\
|
||||
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 (signed char, 1, 0)
|
||||
|
||||
@ -308,7 +293,7 @@ __sync_lock_test_and_set_4 (int *ptr, int val)
|
||||
int failure, oldval;
|
||||
|
||||
do {
|
||||
oldval = *ptr;
|
||||
oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
|
||||
failure = __kernel_cmpxchg (oldval, val, ptr);
|
||||
} while (failure != 0);
|
||||
|
||||
@ -322,12 +307,11 @@ __sync_lock_test_and_set_4 (int *ptr, int val)
|
||||
TYPE failure, oldval, zero = 0; \
|
||||
\
|
||||
do { \
|
||||
oldval = *ptr; \
|
||||
oldval = __atomic_load_n (ptr, __ATOMIC_SEQ_CST); \
|
||||
failure = __kernel_cmpxchg2 (&oldval, &zero, ptr, INDEX); \
|
||||
} while (failure != 0); \
|
||||
}
|
||||
|
||||
SYNC_LOCK_RELEASE_2 (long long, 8, 3)
|
||||
SYNC_LOCK_RELEASE_2 (short, 2, 1)
|
||||
SYNC_LOCK_RELEASE_2 (signed char, 1, 0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user