diff options
Diffstat (limited to 'contrib/libstdc++/config/cpu/s390/atomicity.h')
-rw-r--r-- | contrib/libstdc++/config/cpu/s390/atomicity.h | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/contrib/libstdc++/config/cpu/s390/atomicity.h b/contrib/libstdc++/config/cpu/s390/atomicity.h index 331c29a..b979e3a 100644 --- a/contrib/libstdc++/config/cpu/s390/atomicity.h +++ b/contrib/libstdc++/config/cpu/s390/atomicity.h @@ -1,6 +1,6 @@ // Low-level functions for atomic operations: S/390 version -*- C++ -*- -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 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,34 +27,28 @@ // 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 _Atomic_word -__attribute__ ((__unused__)) -__exchange_and_add (volatile _Atomic_word *__mem, int __val) -{ - register _Atomic_word __old_val, __new_val; - - __asm__ __volatile__ (" l %0,0(%2)\n" - "0: lr %1,%0\n" - " ar %1,%3\n" - " cs %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (__old_val), "=&d" (__new_val) - : "a" (__mem), "d" (__val) : "cc", "memory" ); - return __old_val; -} - -static inline void -__attribute__ ((__unused__)) -__atomic_add (volatile _Atomic_word *__mem, int __val) +namespace __gnu_cxx { - __exchange_and_add (__mem, __val); -} - -#endif /* atomicity.h */ - - + _Atomic_word + __attribute__ ((__unused__)) + __exchange_and_add(volatile _Atomic_word* __mem, int __val) + { + register _Atomic_word __old_val, __new_val; + + __asm__ __volatile__ (" l %0,0(%3)\n" + "0: lr %1,%0\n" + " ar %1,%4\n" + " cs %0,%1,0(%3)\n" + " jl 0b" + : "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem) + : "a" (__mem), "d" (__val), "m" (*__mem) : "cc"); + return __old_val; + } + + void + __attribute__ ((__unused__)) + __atomic_add(volatile _Atomic_word* __mem, int __val) + { __exchange_and_add(__mem, __val); } +} // namespace __gnu_cxx |