Commit ef6c2c53 by Walter Lee Committed by Walter Lee

Rename some internal atomic macros to have a less generic prefix.

From-SVN: r185074
parent ca538e97
2012-03-07 Walter Lee <walt@tilera.com>
* config/tilepro/atomic.c: Rename "atomic_" prefix to
"arch_atomic_".
(atomic_xor): Rename and move definition to
config/tilepro/atomic.h.
(atomic_nand): Ditto.
* config/tilepro/atomic.h: Rename "atomic_" prefix to
"arch_atomic_".
(arch_atomic_xor): Move from config/tilepro/atomic.c.
(arch_atomic_nand): Ditto.
2012-03-07 Georg-Johann Lay <avr@gjlay.de> 2012-03-07 Georg-Johann Lay <avr@gjlay.de>
PR target/52507 PR target/52507
......
...@@ -63,18 +63,12 @@ post_atomic_barrier (int model) ...@@ -63,18 +63,12 @@ post_atomic_barrier (int model)
#define __unused __attribute__((unused)) #define __unused __attribute__((unused))
/* Provide additional methods not implemented by atomic.h. */
#define atomic_xor(mem, mask) \
__atomic_update_cmpxchg(mem, mask, __old ^ __value)
#define atomic_nand(mem, mask) \
__atomic_update_cmpxchg(mem, mask, ~(__old & __value))
#define __atomic_fetch_and_do(type, size, opname) \ #define __atomic_fetch_and_do(type, size, opname) \
type \ type \
__atomic_fetch_##opname##_##size(type* p, type i, int model) \ __atomic_fetch_##opname##_##size(type* p, type i, int model) \
{ \ { \
pre_atomic_barrier(model); \ pre_atomic_barrier(model); \
type rv = atomic_##opname(p, i); \ type rv = arch_atomic_##opname(p, i); \
post_atomic_barrier(model); \ post_atomic_barrier(model); \
return rv; \ return rv; \
} }
...@@ -96,7 +90,7 @@ type \ ...@@ -96,7 +90,7 @@ type \
__atomic_##opname##_fetch_##size(type* p, type i, int model) \ __atomic_##opname##_fetch_##size(type* p, type i, int model) \
{ \ { \
pre_atomic_barrier(model); \ pre_atomic_barrier(model); \
type rv = atomic_##opname(p, i) op i; \ type rv = arch_atomic_##opname(p, i) op i; \
post_atomic_barrier(model); \ post_atomic_barrier(model); \
return rv; \ return rv; \
} }
...@@ -120,7 +114,7 @@ __atomic_compare_exchange_##size(volatile type* ptr, type* oldvalp, \ ...@@ -120,7 +114,7 @@ __atomic_compare_exchange_##size(volatile type* ptr, type* oldvalp, \
{ \ { \
type oldval = *oldvalp; \ type oldval = *oldvalp; \
pre_atomic_barrier(models); \ pre_atomic_barrier(models); \
type retval = atomic_val_compare_and_exchange(ptr, oldval, newval); \ type retval = arch_atomic_val_compare_and_exchange(ptr, oldval, newval); \
post_atomic_barrier(models); \ post_atomic_barrier(models); \
bool success = (retval == oldval); \ bool success = (retval == oldval); \
*oldvalp = retval; \ *oldvalp = retval; \
...@@ -131,7 +125,7 @@ type \ ...@@ -131,7 +125,7 @@ type \
__atomic_exchange_##size(volatile type* ptr, type val, int model) \ __atomic_exchange_##size(volatile type* ptr, type val, int model) \
{ \ { \
pre_atomic_barrier(model); \ pre_atomic_barrier(model); \
type retval = atomic_exchange(ptr, val); \ type retval = arch_atomic_exchange(ptr, val); \
post_atomic_barrier(model); \ post_atomic_barrier(model); \
return retval; \ return retval; \
} }
...@@ -159,7 +153,7 @@ __atomic_compare_exchange_##size(volatile type* ptr, type* guess, \ ...@@ -159,7 +153,7 @@ __atomic_compare_exchange_##size(volatile type* ptr, type* guess, \
type oldval = (oldword >> shift) & valmask; \ type oldval = (oldword >> shift) & valmask; \
if (__builtin_expect((oldval == *guess), 1)) { \ if (__builtin_expect((oldval == *guess), 1)) { \
unsigned int word = (oldword & bgmask) | ((val & valmask) << shift); \ unsigned int word = (oldword & bgmask) | ((val & valmask) << shift); \
oldword = atomic_val_compare_and_exchange(p, oldword, word); \ oldword = arch_atomic_val_compare_and_exchange(p, oldword, word); \
oldval = (oldword >> shift) & valmask; \ oldval = (oldword >> shift) & valmask; \
} \ } \
post_atomic_barrier(models); \ post_atomic_barrier(models); \
...@@ -187,7 +181,7 @@ proto \ ...@@ -187,7 +181,7 @@ proto \
oldval = (oldword >> shift) & valmask; \ oldval = (oldword >> shift) & valmask; \
val = expr; \ val = expr; \
unsigned int word = (oldword & bgmask) | ((val & valmask) << shift); \ unsigned int word = (oldword & bgmask) | ((val & valmask) << shift); \
xword = atomic_val_compare_and_exchange(p, oldword, word); \ xword = arch_atomic_val_compare_and_exchange(p, oldword, word); \
} while (__builtin_expect(xword != oldword, 0)); \ } while (__builtin_expect(xword != oldword, 0)); \
bottom \ bottom \
} }
......
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