aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Myers <ncm@cantrip.org>2000-04-26 02:51:12 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2000-04-26 02:51:12 +0000
commitf17d6c73de036a8eef4992155b142133ee1a46ee (patch)
treee43eb62062687bddc1a0a4a0f93c6a6cb98d8155
parent369edff1857ec11057540d163f338090c24572f4 (diff)
downloadgcc-f17d6c73de036a8eef4992155b142133ee1a46ee.zip
gcc-f17d6c73de036a8eef4992155b142133ee1a46ee.tar.gz
gcc-f17d6c73de036a8eef4992155b142133ee1a46ee.tar.bz2
cpu: Atomicity cleanups.
2000-04-24 Nathan Myers <ncm@cantrip.org> * config/cpu: Atomicity cleanups. * config/cpu/alpha/bits: New directory. * config/cpu/arm/bits: New directory. * config/cpu/generic/bits: New directory. * config/cpu/i386/bits: New directory. * config/cpu/powerpc/bits: New directory. * config/cpu/sparc/sparc32/bits: New directory. * config/cpu/sparc/sparc32/bits: New directory. * config/cpu/*/bits: Move atomicity.h files to here. From-SVN: r33438
-rw-r--r--libstdc++-v3/config/cpu/alpha/bits/atomicity.h (renamed from libstdc++-v3/config/cpu/alpha/atomicity.h)50
-rw-r--r--libstdc++-v3/config/cpu/arm/bits/atomicity.h (renamed from libstdc++-v3/config/cpu/arm/atomicity.h)62
-rw-r--r--libstdc++-v3/config/cpu/generic/bits/atomicity.h (renamed from libstdc++-v3/config/cpu/generic/atomicity.h)32
-rw-r--r--libstdc++-v3/config/cpu/i386/bits/atomicity.h (renamed from libstdc++-v3/config/cpu/i386/atomicity.h)40
-rw-r--r--libstdc++-v3/config/cpu/powerpc/bits/atomicity.h (renamed from libstdc++-v3/config/cpu/powerpc/atomicity.h)56
-rw-r--r--libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h (renamed from libstdc++-v3/config/cpu/sparc/sparc32/atomicity.h)66
-rw-r--r--libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h (renamed from libstdc++-v3/config/cpu/sparc/sparc64/atomicity.h)43
7 files changed, 159 insertions, 190 deletions
diff --git a/libstdc++-v3/config/cpu/alpha/atomicity.h b/libstdc++-v3/config/cpu/alpha/bits/atomicity.h
index b9b92d0..dfc4c32 100644
--- a/libstdc++-v3/config/cpu/alpha/atomicity.h
+++ b/libstdc++-v3/config/cpu/alpha/bits/atomicity.h
@@ -17,22 +17,16 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H 1
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H 1
-#ifdef _GLIBCPP_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#endif
+typedef int _Atomic_word;
-
-static inline int
+static inline _Atomic_word
__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
+__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
- register int result, tmp;
+ register int __result, __tmp;
__asm__ __volatile__ (
"/* Inline exchange & add */\n"
@@ -47,17 +41,17 @@ exchange_and_add (volatile uint32_t *mem, int val)
".previous\n\t"
"mb\n\t"
"/* End exchange & add */"
- : "=&r"(result), "=&r"(tmp), "=m"(*mem)
- : "m" (*mem), "r"(val));
+ : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
+ : "m" (*__mem), "r"(__val));
- return result;
+ return __result;
}
static inline void
__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
+__atomic_add (volatile _Atomic_word* __mem, int __val)
{
- register int result;
+ register _Atomic_word __result;
__asm__ __volatile__ (
"/* Inline exchange & add */\n"
@@ -72,15 +66,15 @@ atomic_add (volatile uint32_t *mem, int val)
".previous\n\t"
"mb\n\t"
"/* End exchange & add */"
- : "=&r"(result), "=m"(*mem)
- : "m" (*mem), "r"(val));
+ : "=&r"(__result), "=m"(*__mem)
+ : "m" (*__mem), "r"(__val));
}
-static inline long
+static inline intint
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
- long int ret;
+ int __ret;
__asm__ __volatile__ (
"/* Inline compare & swap */\n"
@@ -98,16 +92,10 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
"3:\t"
"mb\n\t"
"/* End compare & swap */"
- : "=&r"(ret), "=m"(*p)
- : "r"(oldval), "r"(newval), "m"(*p));
+ : "=&r"(__ret), "=m"(*__p)
+ : "r"(__oldval), "r"(__newval), "m"(*__p));
- return ret;
+ return __ret;
}
#endif /* atomicity.h */
-
-
-
-
-
-
diff --git a/libstdc++-v3/config/cpu/arm/atomicity.h b/libstdc++-v3/config/cpu/arm/bits/atomicity.h
index 7d886a3..3a0a090 100644
--- a/libstdc++-v3/config/cpu/arm/atomicity.h
+++ b/libstdc++-v3/config/cpu/arm/bits/atomicity.h
@@ -17,21 +17,16 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H 1
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H 1
-#ifdef _GLIBCPP_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#endif
+typedef int _Atomic_word;
-static inline int
+static inline _Atomic_word
__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
+__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
- int tmp, tmp2, result;
+ _Atomic_word __tmp, __tmp2, __result;
__asm__ ("\
0: ldr %0,[%3]
add %1,%0,%4
@@ -39,15 +34,17 @@ exchange_and_add (volatile uint32_t *mem, int val)
cmp %0,%2
swpne %1,%2,[%3]
bne 0b
-" : "=&r"(result), "=&r"(tmp), "=&r"(tmp2) : "r" (mem), "r"(val) : "cc", "memory");
- return result;
+" : "=&r"(__result), "=&r"(__tmp), "=&r"(__tmp2)
+ : "r" (__mem), "r"(__val)
+ : "cc", "memory");
+ return __result;
}
static inline void
__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
+__atomic_add (volatile _Atomic_word *__mem, int __val)
{
- int tmp, tmp2, tmp3;
+ _Atomic_word __tmp, __tmp2, __tmp3;
__asm__ ("\
0: ldr %0,[%3]
add %1,%0,%4
@@ -55,14 +52,17 @@ atomic_add (volatile uint32_t *mem, int val)
cmp %0,%2
swpne %1,%2,[%3]
bne 0b
-" : "=&r"(tmp), "=&r"(tmp2), "=&r"(tmp3) : "r" (mem), "r"(val) : "cc", "memory");
+" : "=&r"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3)
+ : "r" (__mem), "r"(__val)
+ : "cc", "memory");
}
static inline int
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
- int result, tmp;
+ int __result;
+ long __tmp;
__asm__ ("\
0: ldr %1,[%2]
mov %0,#0
@@ -74,25 +74,29 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
bne 0b
mov %0,#1
1:
-" : "=&r"(result), "=&r"(tmp) : "r" (p), "r" (newval), "r" (oldval) : "cc", "memory");
+" : "=&r"(__result), "=&r"(__tmp)
+ : "r" (__p), "r" (__newval), "r" (__oldval)
+ : "cc", "memory");
+ return __result;
}
-static inline long int
+static inline long
__attribute__ ((unused))
-always_swap (volatile long int *p, long int newval)
+__always_swap (volatile long *__p, long __newval)
{
- long int result;
+ long __result;
__asm__ ("\
swp %0,%2,[%1]
-" : "=&r"(result) : "r"(p), "r"(newval) : "memory");
- return result;
+" : "=&r"(__result) : "r"(__p), "r"(__newval) : "memory");
+ return __result;
}
static inline int
__attribute__ ((unused))
-test_and_set (volatile long int *p, long int newval)
+__test_and_set (volatile long *__p, long __newval)
{
- int result, tmp, tmp2, tmp3;
+ int __result;
+ long __tmp;
__asm__ ("\
0: ldr %0,[%2]
cmp %0,#0
@@ -102,8 +106,10 @@ test_and_set (volatile long int *p, long int newval)
swpne %0,%1,[%2]
bne 0b
1:
-" : "=&r"(result), "=r" (tmp) : "r"(p), "r"(newval) : "cc", "memory");
- return result;
+" : "=&r"(__result), "=r" (__tmp)
+ : "r"(__p), "r"(__newval)
+ : "cc", "memory");
+ return __result;
}
#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/generic/atomicity.h b/libstdc++-v3/config/cpu/generic/bits/atomicity.h
index 5831f95..ef47fe9 100644
--- a/libstdc++-v3/config/cpu/generic/atomicity.h
+++ b/libstdc++-v3/config/cpu/generic/bits/atomicity.h
@@ -17,41 +17,35 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H 1
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H 1
-#ifdef _GLIBCPP_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#endif
+typedef int _Atomic_word;
-
-static inline int
+static inline _Atomic_word
__attribute__ ((unused))
-exchange_and_add (uint32_t *mem, int val)
+__exchange_and_add (_Atomic_word* __mem, int __val)
{
- int result = *mem;
- *mem += val;
- return result;
+ _Atomic_word __result = *__mem;
+ *__mem += __val;
+ return __result;
}
static inline void
__attribute__ ((unused))
-atomic_add (uint32_t *mem, int val)
+__atomic_add (_Atomic_word* __mem, int __val)
{
- *mem += val;
+ *__mem += __val;
}
static inline int
__attribute__ ((unused))
-compare_and_swap (long int *p, long int oldval, long int newval)
+__compare_and_swap (long *__p, long __oldval, long __newval)
{
- if (*p != oldval)
+ if (*__p != __oldval)
return 0;
- *p = newval;
+ *__p = __newval;
return 1;
}
diff --git a/libstdc++-v3/config/cpu/i386/atomicity.h b/libstdc++-v3/config/cpu/i386/bits/atomicity.h
index dfa9182..f7d0381 100644
--- a/libstdc++-v3/config/cpu/i386/atomicity.h
+++ b/libstdc++-v3/config/cpu/i386/bits/atomicity.h
@@ -17,46 +17,42 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H 1
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H 1
-#ifdef _GLIBCPP_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#endif
+typedef int _Atomic_word;
-
-static inline int
+static inline _Atomic_word
__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
+__exchange_and_add (volatile _Atomic_word *__mem, int __val)
{
- register int result;
+ register _Atomic_word __result;
__asm__ __volatile__ ("lock; xaddl %0,%2"
- : "=r" (result) : "0" (val), "m" (*mem) : "memory");
- return result;
+ : "=r" (__result)
+ : "0" (__val), "m" (*__mem)
+ : "memory");
+ return __result;
}
static inline void
__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
+__atomic_add (volatile _Atomic_word* __mem, int __val)
{
__asm__ __volatile__ ("lock; addl %0,%1"
- : : "ir" (val), "m" (*mem) : "memory");
+ : : "ir" (__val), "m" (*__mem) : "memory");
}
static inline char
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+__compare_and_swap (volatile long* __p, long __oldval, long __newval)
{
- char ret;
- long int readval;
+ char __ret;
+ long __readval;
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
- : "=q" (ret), "=m" (*p), "=a" (readval)
- : "r" (newval), "m" (*p), "a" (oldval));
- return ret;
+ : "=q" (__ret), "=m" (*__p), "=a" (__readval)
+ : "r" (__newval), "m" (*__p), "a" (__oldval));
+ return __ret;
}
#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/powerpc/atomicity.h b/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h
index 59bd61c..02b5e60 100644
--- a/libstdc++-v3/config/cpu/powerpc/atomicity.h
+++ b/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h
@@ -17,16 +17,10 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H 1
-
-#ifdef _GLIBCPP_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#endif
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H 1
+typedef int _Atomic_word;
#if BROKEN_PPC_ASM_CR0
# define __ATOMICITY_INLINE /* nothing */
@@ -34,38 +28,38 @@ typedef int int32_t;
# define __ATOMICITY_INLINE inline
#endif
-static __ATOMICITY_INLINE int
+static __ATOMICITY_INLINE _Atomic_word
__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
+__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
- int tmp, result;
+ _Atomic_word __tmp, __result;
__asm__ ("\
0: lwarx %0,0,%2
add%I3 %1,%0,%3
stwcx. %1,0,%2
bne- 0b
-" : "=&b"(result), "=&r"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory");
- return result;
+" : "=&b"(__result), "=&r"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
+ return __result;
}
static __ATOMICITY_INLINE void
__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
+__atomic_add (volatile _Atomic_word *__mem, int __val)
{
- int tmp;
+ _Atomic_word __tmp;
__asm__ ("\
0: lwarx %0,0,%1
add%I2 %0,%0,%2
stwcx. %0,0,%1
bne- 0b
-" : "=&b"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory");
+" : "=&b"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
}
static __ATOMICITY_INLINE int
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+__compare_and_swap (volatile long *p, long int __oldval, long int __newval)
{
- int result;
+ int __result;
__asm__ ("\
0: lwarx %0,0,%1
sub%I2c. %0,%0,%2
@@ -74,28 +68,30 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
stwcx. %3,0,%1
bne- 0b
1:
-" : "=&b"(result) : "r"(p), "Ir"(oldval), "r"(newval) : "cr0", "memory");
- return result >> 5;
+" : "=&b"(__result)
+ : "r"(__p), "Ir"(__oldval), "r"(__newval)
+ : "cr0", "memory");
+ return __result >> 5;
}
-static __ATOMICITY_INLINE long int
+static __ATOMICITY_INLINE long
__attribute__ ((unused))
-always_swap (volatile long int *p, long int newval)
+__always_swap (volatile long *__p, long int __newval)
{
- long int result;
+ long __result;
__asm__ ("\
0: lwarx %0,0,%1
stwcx. %2,0,%1
bne- 0b
-" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory");
- return result;
+" : "=&r"(__result) : "r"(__p), "r"(__newval) : "cr0", "memory");
+ return __result;
}
static __ATOMICITY_INLINE int
__attribute__ ((unused))
-test_and_set (volatile long int *p, long int newval)
+__test_and_set (volatile long *__p, long int __newval)
{
- int result;
+ int __result;
__asm__ ("\
0: lwarx %0,0,%1
cmpwi %0,0
@@ -103,8 +99,8 @@ test_and_set (volatile long int *p, long int newval)
stwcx. %2,0,%1
bne- 0b
1:
-" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory");
- return result;
+" : "=&r"(__result) : "r"(__p), "r"(__newval) : "cr0", "memory");
+ return __result;
}
#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/sparc/sparc32/atomicity.h b/libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h
index 1ead56e..87db18b 100644
--- a/libstdc++-v3/config/cpu/sparc/sparc32/atomicity.h
+++ b/libstdc++-v3/config/cpu/sparc/sparc32/bits/atomicity.h
@@ -17,88 +17,82 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H 1
-
-#ifdef _GLIBCPP_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#endif
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H 1
+typedef int _Atomic_word;
static int
__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
+__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
- static unsigned char lock;
- int result, tmp;
+ static unsigned char __lock;
+ _Atomic_word __result, __tmp;
__asm__ __volatile__("1: ldstub [%1], %0\n\t"
" cmp %0, 0\n\t"
" bne 1b\n\t"
" nop"
- : "=&r" (tmp)
- : "r" (&lock)
+ : "=&r" (__tmp)
+ : "r" (&__lock)
: "memory");
- result = *mem;
- *mem += val;
+ __result = *__mem;
+ *__mem += __val;
__asm__ __volatile__("stb %%g0, [%0]"
: /* no outputs */
- : "r" (&lock)
+ : "r" (&__lock)
: "memory");
- return result;
+ return __result;
}
static void
__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
+__atomic_add (volatile _Atomic_word* __mem, int __val)
{
- static unsigned char lock;
- int tmp;
+ static unsigned char __lock;
+ _Atomic_word __tmp;
__asm__ __volatile__("1: ldstub [%1], %0\n\t"
" cmp %0, 0\n\t"
" bne 1b\n\t"
" nop"
- : "=&r" (tmp)
- : "r" (&lock)
+ : "=&r" (__tmp)
+ : "r" (&__lock)
: "memory");
- *mem += val;
+ *__mem += __val;
__asm__ __volatile__("stb %%g0, [%0]"
: /* no outputs */
- : "r" (&lock)
+ : "r" (&__lock)
: "memory");
}
static int
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
- static unsigned char lock;
- int ret, tmp;
+ static unsigned char __lock;
+ long __ret, __tmp;
__asm__ __volatile__("1: ldstub [%1], %0\n\t"
" cmp %0, 0\n\t"
" bne 1b\n\t"
" nop"
- : "=&r" (tmp)
- : "r" (&lock)
+ : "=&r" (__tmp)
+ : "r" (&__lock)
: "memory");
- if (*p != oldval)
- ret = 0;
+ if (*__p != __oldval)
+ __ret = 0;
else
{
- *p = newval;
- ret = 1;
+ *__p = __newval;
+ __ret = 1;
}
__asm__ __volatile__("stb %%g0, [%0]"
: /* no outputs */
- : "r" (&lock)
+ : "r" (&__lock)
: "memory");
- return ret;
+ return __ret;
}
#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/cpu/sparc/sparc64/atomicity.h b/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
index 945247a..80d0fc8 100644
--- a/libstdc++-v3/config/cpu/sparc/sparc64/atomicity.h
+++ b/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
@@ -17,22 +17,16 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H 1
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H 1
-#ifdef _GLIBCPP_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-typedef unsigned int uint32_t;
-typedef int int32_t;
-#endif
+typedef long _Atomic_word;
-
-static inline int
+static inline _Atomic_word
__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
+__exchange_and_add (volatile _Atomic_word *__mem, int __val)
{
- uint32_t tmp1, tmp2;
+ _Atomic_word __tmp1, __tmp2;
__asm__ __volatile__("1: lduw [%2], %0\n\t"
" add %0, %3, %1\n\t"
@@ -40,17 +34,17 @@ exchange_and_add (volatile uint32_t *mem, int val)
" sub %0, %1, %0\n\t"
" brnz,pn %0, 1b\n\t"
" nop"
- : "=&r" (tmp1), "=&r" (tmp2)
- : "r" (mem), "r" (val)
+ : "=&r" (__tmp1), "=&r" (__tmp2)
+ : "r" (__mem), "r" (__val)
: "memory");
- return tmp2;
+ return __tmp2;
}
static inline void
__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
+__atomic_add (volatile _Atomic_word* __mem, int __val)
{
- uint32_t tmp1, tmp2;
+ _Atomic_word __tmp1, __tmp2;
__asm__ __volatile__("1: lduw [%2], %0\n\t"
" add %0, %3, %1\n\t"
@@ -58,16 +52,17 @@ atomic_add (volatile uint32_t *mem, int val)
" sub %0, %1, %0\n\t"
" brnz,pn %0, 1b\n\t"
" nop"
- : "=&r" (tmp1), "=&r" (tmp2)
- : "r" (mem), "r" (val)
+ : "=&r" (__tmp1), "=&r" (__tmp2)
+ : "r" (__mem), "r" (__val)
: "memory");
}
static inline int
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+__compare_and_swap (volatile long *__p, long __oldval, long __newval)
{
- register long int tmp, tmp2;
+ register int __tmp,
+ register long __tmp2;
__asm__ __volatile__("1: ldx [%4], %0\n\t"
" mov %2, %1\n\t"
@@ -79,10 +74,10 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval)
" brnz,pn %0, 1b\n\t"
" mov 1, %0\n\t"
"2:"
- : "=&r" (tmp), "=&r" (tmp2)
- : "r" (newval), "r" (oldval), "r" (p)
+ : "=&r" (__tmp), "=&r" (__tmp2)
+ : "r" (__newval), "r" (__oldval), "r" (__p)
: "memory");
- return tmp;
+ return __tmp;
}
#endif /* atomicity.h */