am 3b093369: am 1147407b: Merge "Remove unconditional swap from the android atomic operations suite." into honeycomb

* commit '3b093369d85f2d248799073152ece79987d4b30b':
  Remove unconditional swap from the android atomic operations suite.
This commit is contained in:
Carl Shapiro 2011-01-24 16:46:45 -08:00 committed by Android Git Automerger
commit f59ed65c47
4 changed files with 0 additions and 62 deletions

View file

@ -145,38 +145,6 @@ extern inline int android_atomic_release_cas(int32_t old_value,
}
#if defined(__thumb__)
extern int32_t android_atomic_swap(int32_t new_value,
volatile int32_t *ptr);
#elif defined(__ARM_HAVE_LDREX_STREX)
extern inline int32_t android_atomic_swap(int32_t new_value,
volatile int32_t *ptr)
{
int32_t prev, status;
do {
__asm__ __volatile__ ("ldrex %0, [%3]\n"
"strex %1, %4, [%3]"
: "=&r" (prev), "=&r" (status), "+m" (*ptr)
: "r" (ptr), "r" (new_value)
: "cc");
} while (__builtin_expect(status != 0, 0));
android_memory_barrier();
return prev;
}
#else
extern inline int32_t android_atomic_swap(int32_t new_value,
volatile int32_t *ptr)
{
int32_t prev;
__asm__ __volatile__ ("swp %0, %2, [%3]"
: "=&r" (prev), "+m" (*ptr)
: "r" (new_value), "r" (ptr)
: "cc");
android_memory_barrier();
return prev;
}
#endif
#if defined(__thumb__)
extern int32_t android_atomic_add(int32_t increment,
volatile int32_t *ptr);

View file

@ -98,17 +98,6 @@ extern inline int android_atomic_release_cas(int32_t old_value,
return android_atomic_cas(old_value, new_value, ptr);
}
extern inline int32_t android_atomic_swap(int32_t new_value,
volatile int32_t *ptr)
{
__asm__ __volatile__ ("xchgl %1, %0"
: "=r" (new_value)
: "m" (*ptr), "0" (new_value)
: "memory");
/* new_value now holds the old value of *ptr */
return new_value;
}
extern inline int32_t android_atomic_add(int32_t increment,
volatile int32_t *ptr)
{

View file

@ -89,13 +89,6 @@ int32_t android_atomic_release_load(volatile const int32_t* addr);
void android_atomic_acquire_store(int32_t value, volatile int32_t* addr);
void android_atomic_release_store(int32_t value, volatile int32_t* addr);
/*
* Unconditional swap operation with release ordering.
*
* Stores the new value at *addr, and returns the previous value.
*/
int32_t android_atomic_swap(int32_t value, volatile int32_t* addr);
/*
* Compare-and-set operation with "acquire" or "release" ordering.
*

View file

@ -113,18 +113,6 @@ int32_t android_atomic_or(int32_t value, volatile int32_t* addr) {
return oldValue;
}
int32_t android_atomic_acquire_swap(int32_t value, volatile int32_t* addr) {
return android_atomic_release_swap(value, addr);
}
int32_t android_atomic_release_swap(int32_t value, volatile int32_t* addr) {
int32_t oldValue;
do {
oldValue = *addr;
} while (android_atomic_cmpxchg(oldValue, value, addr));
return oldValue;
}
int android_atomic_acquire_cmpxchg(int32_t oldvalue, int32_t newvalue,
volatile int32_t* addr) {
return android_atomic_release_cmpxchg(oldValue, newValue, addr);