summaryrefslogtreecommitdiff
path: root/config/cpu/powerpc/atomicity.h
diff options
context:
space:
mode:
Diffstat (limited to 'config/cpu/powerpc/atomicity.h')
-rw-r--r--config/cpu/powerpc/atomicity.h58
1 files changed, 30 insertions, 28 deletions
diff --git a/config/cpu/powerpc/atomicity.h b/config/cpu/powerpc/atomicity.h
index 3b44b7d..5a74a65 100644
--- a/config/cpu/powerpc/atomicity.h
+++ b/config/cpu/powerpc/atomicity.h
@@ -28,7 +28,7 @@
// the GNU General Public License.
#ifndef _GLIBCXX_ATOMICITY_H
-#define _GLIBCXX_ATOMICITY_H 1
+#define _GLIBCXX_ATOMICITY_H 1
#ifdef __PPC405__
#define _STWCX "sync \n\tstwcx. "
@@ -40,39 +40,41 @@ typedef int _Atomic_word;
static inline _Atomic_word
__attribute__ ((__unused__))
-__exchange_and_add(volatile _Atomic_word* __mem, int __val)
+__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
- _Atomic_word __tmp, __res;
- __asm__ __volatile__ (
- "/* Inline exchange & add */\n"
- "0:\t"
- "lwarx %0,0,%3 \n\t"
- "add%I4 %1,%0,%4 \n\t"
- _STWCX " %1,0,%3 \n\t"
- "bne- 0b \n\t"
- "/* End exchange & add */"
- : "=&b"(__res), "=&r"(__tmp), "=m" (*__mem)
- : "r" (__mem), "Ir"(__val), "m" (*__mem)
- : "cr0");
- return __res;
+ _Atomic_word __tmp, __res;
+
+ __asm__ __volatile__ (
+ "/* Inline exchange & add */\n"
+ "0:\t"
+ "lwarx %0,0,%3 \n\t"
+ "add%I4 %1,%0,%4 \n\t"
+ _STWCX " %1,0,%3 \n\t"
+ "bne- 0b \n\t"
+ "/* End exchange & add */"
+ : "=&b" (__res), "=&r" (__tmp), "=m" (*__mem)
+ : "r" (__mem), "Ir" (__val), "m" (*__mem)
+ : "cr0");
+ return __res;
}
static inline void
__attribute__ ((__unused__))
-__atomic_add(volatile _Atomic_word* __mem, int __val)
+__atomic_add (volatile _Atomic_word* __mem, int __val)
{
- _Atomic_word __tmp;
- __asm__ __volatile__ (
- "/* Inline atomic add */\n"
- "0:\t"
- "lwarx %0,0,%2 \n\t"
- "add%I3 %0,%0,%3 \n\t"
- _STWCX " %0,0,%2 \n\t"
- "bne- 0b \n\t"
- "/* End atomic add */"
- : "=&b"(__tmp), "=m" (*__mem)
- : "r" (__mem), "Ir"(__val), "m" (*__mem)
- : "cr0");
+ _Atomic_word __tmp;
+
+ __asm__ __volatile__ (
+ "/* Inline atomic add */\n"
+ "0:\t"
+ "lwarx %0,0,%2 \n\t"
+ "add%I3 %0,%0,%3 \n\t"
+ _STWCX " %0,0,%2 \n\t"
+ "bne- 0b \n\t"
+ "/* End atomic add */"
+ : "=&b" (__tmp), "=m" (*__mem)
+ : "r" (__mem), "Ir" (__val), "m" (*__mem)
+ : "cr0");
}
#endif /* atomicity.h */