diff options
Diffstat (limited to 'contrib/libstdc++/config/cpu/mips/atomicity.h')
-rw-r--r-- | contrib/libstdc++/config/cpu/mips/atomicity.h | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/contrib/libstdc++/config/cpu/mips/atomicity.h b/contrib/libstdc++/config/cpu/mips/atomicity.h index 7bacabd..0871342 100644 --- a/contrib/libstdc++/config/cpu/mips/atomicity.h +++ b/contrib/libstdc++/config/cpu/mips/atomicity.h @@ -1,6 +1,6 @@ -// Low-level functions for atomic operations. +// Low-level functions for atomic operations: MIPS version -*- C++ -*- -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -27,55 +27,55 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#ifndef _BITS_ATOMICITY_H -#define _BITS_ATOMICITY_H 1 +#include <bits/atomicity.h> -typedef int _Atomic_word; - -static inline int -__attribute__ ((__unused__)) -__exchange_and_add (volatile _Atomic_word *__mem, int __val) +namespace __gnu_cxx { - int __result, __tmp; - - __asm__ __volatile__ - ("/* Inline exchange & add */\n\t" - "1:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %0,%3\n\t" - "addu %1,%4,%0\n\t" - "sc %1,%2\n\t" - ".set pop\n\t" - "beqz %1,1b\n\t" - "/* End exchange & add */" - : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) - : "m" (*__mem), "r"(__val) - : "memory"); - - return __result; -} - -static inline void -__attribute__ ((__unused__)) -__atomic_add (volatile _Atomic_word *__mem, int __val) -{ - int __result; - - __asm__ __volatile__ - ("/* Inline atomic add */\n\t" - "1:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %0,%2\n\t" - "addu %0,%3,%0\n\t" - "sc %0,%1\n\t" - ".set pop\n\t" - "beqz %0,1b\n\t" - "/* End atomic add */" - : "=&r"(__result), "=m"(*__mem) - : "m" (*__mem), "r"(__val) - : "memory"); -} - -#endif /* atomicity.h */ + _Atomic_word + __attribute__ ((__unused__)) + __exchange_and_add(volatile _Atomic_word* __mem, int __val) + { + _Atomic_word __result, __tmp; + + __asm__ __volatile__ + ("/* Inline exchange & add */\n\t" + "1:\n\t" + ".set push\n\t" +#if _MIPS_SIM == _ABIO32 + ".set mips2\n\t" +#endif + "ll %0,%3\n\t" + "addu %1,%4,%0\n\t" + "sc %1,%2\n\t" + ".set pop\n\t" + "beqz %1,1b\n\t" + "/* End exchange & add */" + : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) + : "m" (*__mem), "r"(__val)); + + return __result; + } + + void + __attribute__ ((__unused__)) + __atomic_add(volatile _Atomic_word* __mem, int __val) + { + _Atomic_word __result; + + __asm__ __volatile__ + ("/* Inline atomic add */\n\t" + "1:\n\t" + ".set push\n\t" +#if _MIPS_SIM == _ABIO32 + ".set mips2\n\t" +#endif + "ll %0,%2\n\t" + "addu %0,%3,%0\n\t" + "sc %0,%1\n\t" + ".set pop\n\t" + "beqz %0,1b\n\t" + "/* End atomic add */" + : "=&r"(__result), "=m"(*__mem) + : "m" (*__mem), "r"(__val)); + } +} // namespace __gnu_cxx |