aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog10
-rw-r--r--nptl/atomic.h141
-rw-r--r--nptl/sysdeps/i386/i486/bits/atomic.h348
-rw-r--r--nptl/sysdeps/i386/i586/bits/atomic.h20
-rw-r--r--nptl/sysdeps/i386/i686/bits/atomic.h20
-rw-r--r--nptl/sysdeps/ia64/bits/atomic.h97
-rw-r--r--nptl/sysdeps/powerpc/bits/atomic.h116
-rw-r--r--nptl/sysdeps/s390/bits/atomic.h78
-rw-r--r--nptl/sysdeps/sh/bits/atomic.h405
-rw-r--r--nptl/sysdeps/x86_64/bits/atomic.h294
10 files changed, 10 insertions, 1519 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 0ff78787a6..ccdc2dacb0 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,15 @@
2003-03-19 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/i386/i686/bits/atomic.h: Removed.
+ * sysdeps/i386/i586/bits/atomic.h: Removed.
+ * sysdeps/i386/i486/bits/atomic.h: Removed. Moved to glibc.
+ * sysdeps/x86_64/bits/atomic.h: Removed. Moved to glibc.
+ * sysdeps/s390/bits/atomic.h: Removed. Moved to glibc.
+ * sysdeps/sh/bits/atomic.h: Removed. Moved to glibc.
+ * sysdeps/ia64/bits/atomic.h: Removed. Moved to glibc.
+ * sysdeps/powerpc/bits/atomic.h: Removed. Moved to glibc.
+ * atomic.h: Removed. Moved to glibc.
+
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Add
support for clock selection.
diff --git a/nptl/atomic.h b/nptl/atomic.h
deleted file mode 100644
index 813fb80a03..0000000000
--- a/nptl/atomic.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _ATOMIC_H
-#define _ATOMIC_H 1
-
-#include <stdlib.h>
-
-#include <bits/atomic.h>
-
-
-#ifndef atomic_compare_and_exchange_acq
-# define atomic_compare_and_exchange_acq(mem, newval, oldval) \
- ({ __typeof (__arch_compare_and_exchange_32_acq (mem, newval, oldval)) \
- __result; \
- if (sizeof (*mem) == 1) \
- __result = __arch_compare_and_exchange_8_acq (mem, newval, oldval); \
- else if (sizeof (*mem) == 2) \
- __result = __arch_compare_and_exchange_16_acq (mem, newval, oldval); \
- else if (sizeof (*mem) == 4) \
- __result = __arch_compare_and_exchange_32_acq (mem, newval, oldval); \
- else if (sizeof (*mem) == 8) \
- __result = __arch_compare_and_exchange_64_acq (mem, newval, oldval); \
- else \
- abort (); \
- __result; })
-#endif
-
-
-#ifndef atomic_compare_and_exchange_rel
-# define atomic_compare_and_exchange_rel(mem, oldval, newval) \
- atomic_compare_and_exchange_acq (mem, oldval, newval)
-#endif
-
-
-#ifndef atomic_exchange_and_add
-# define atomic_exchange_and_add(mem, value) \
- ({ __typeof (*mem) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*mem) __value = (value); \
- \
- do \
- __oldval = (*__memp); \
- while (atomic_compare_and_exchange_acq (__memp, __oldval + __value, \
- __oldval)); \
- \
- __oldval + __value; })
-#endif
-
-
-#ifndef atomic_add
-# define atomic_add(mem, value) (void) atomic_exchange_and_add (mem, value)
-#endif
-
-
-#ifndef atomic_increment
-# define atomic_increment(mem) atomic_add (mem, 1)
-#endif
-
-
-#ifndef atomic_increment_and_test
-# define atomic_increment_and_test(mem) \
- (atomic_exchange_and_add (mem, 1) == 0)
-#endif
-
-
-#ifndef atomic_decrement
-# define atomic_decrement(mem) atomic_add (mem, -1)
-#endif
-
-
-#ifndef atomic_decrement_and_test
-# define atomic_decrement_and_test(mem) \
- (atomic_exchange_and_add (mem, -1) == 0)
-#endif
-
-
-#ifndef atomic_add_negative
-# define atomic_add_negative(mem, value) \
- (atomic_exchange_and_add (mem, value) < 0)
-#endif
-
-
-#ifndef atomic_add_zero
-# define atomic_add_zero(mem, value) \
- (atomic_exchange_and_add (mem, value) == 0)
-#endif
-
-
-#ifndef atomic_bit_set
-# define atomic_bit_set(mem, bit) \
- (void) atomic_bit_test_set(mem, bit)
-#endif
-
-
-#ifndef atomic_bit_test_set
-# define atomic_bit_test_set(mem, bit) \
- ({ __typeof (*mem) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*mem) __mask = (1 << (bit)); \
- \
- do \
- __oldval = (*__memp); \
- while (atomic_compare_and_exchange_acq (__memp, \
- __oldval | __mask, __oldval)); \
- \
- __oldval & __mask; })
-#endif
-
-
-#ifndef atomic_full_barrier
-# define atomic_full_barrier() __asm ("" ::: "memory")
-#endif
-
-
-#ifndef atomic_read_barrier
-# define atomic_read_barrier() atomic_full_barrier()
-#endif
-
-
-#ifndef atomic_write_barrier
-# define atomic_write_barrier() atomic_full_barrier()
-#endif
-
-#endif /* atomic.h */
diff --git a/nptl/sysdeps/i386/i486/bits/atomic.h b/nptl/sysdeps/i386/i486/bits/atomic.h
deleted file mode 100644
index 80a49872e1..0000000000
--- a/nptl/sysdeps/i386/i486/bits/atomic.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
-#ifndef LOCK
-# ifdef UP
-# define LOCK /* nothing */
-# else
-# define LOCK "lock;"
-# endif
-#endif
-
-
-#define __arch_compare_and_exchange_8_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- __asm __volatile (LOCK "cmpxchgb %b2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem) \
- : "q" (newval), "1" (*mem), "0" (oldval)); \
- ret; })
-
-#define __arch_compare_and_exchange_16_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- __asm __volatile (LOCK "cmpxchgw %w2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem) \
- : "r" (newval), "1" (*mem), "0" (oldval)); \
- ret; })
-
-#define __arch_compare_and_exchange_32_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- __asm __volatile (LOCK "cmpxchgl %2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem) \
- : "r" (newval), "1" (*mem), "0" (oldval)); \
- ret; })
-
-/* XXX We do not really need 64-bit compare-and-exchange. At least
- not in the moment. Using it would mean causing portability
- problems since not many other 32-bit architectures have support for
- such an operation. So don't define any code for now. If it is
- really going to be used the code below can be used on Intel Pentium
- and later, but NOT on i486. */
-#if 1
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- (abort (), 0)
-#else
-# ifdef __PIC__
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- int ignore; \
- __asm __volatile ("xchgl %3, %%ebx\n\t" \
- LOCK "cmpxchg8b %2, %1\n\t" \
- "setne %0\n\t" \
- "xchgl %3, %%ebx" \
- : "=a" (ret), "=m" (*mem), "=d" (ignore) \
- : "DS" (((unsigned long long int) (newval)) \
- & 0xffffffff), \
- "c" (((unsigned long long int) (newval)) >> 32), \
- "1" (*mem), "0" (((unsigned long long int) (oldval)) \
- & 0xffffffff), \
- "2" (((unsigned long long int) (oldval)) >> 32)); \
- ret; })
-# else
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- int ignore; \
- __asm __volatile (LOCK "cmpxchg8b %2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem), "=d" (ignore) \
- : "b" (((unsigned long long int) (newval)) \
- & 0xffffffff), \
- "c" (((unsigned long long int) (newval)) >> 32), \
- "1" (*mem), "0" (((unsigned long long int) (oldval)) \
- & 0xffffffff), \
- "2" (((unsigned long long int) (oldval)) >> 32)); \
- ret; })
-# endif
-#endif
-
-
-#define atomic_exchange_and_add(mem, value) \
- ({ __typeof (*mem) result; \
- __typeof (value) addval = (value); \
- if (sizeof (*mem) == 1) \
- { \
- __asm __volatile (LOCK "xaddb %b0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (addval), "1" (*mem)); \
- result += addval; \
- } \
- else if (sizeof (*mem) == 2) \
- { \
- __asm __volatile (LOCK "xaddw %w0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (addval), "1" (*mem)); \
- result += addval; \
- } \
- else if (sizeof (*mem) == 4) \
- { \
- __asm __volatile (LOCK "xaddl %0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (addval), "1" (*mem)); \
- result += addval; \
- } \
- else \
- { \
- __typeof (*mem) oldval; \
- __typeof (mem) memp = (mem); \
- do \
- result = (oldval = *memp) + addval; \
- while (__arch_compare_and_exchange_64_acq (memp, result, oldval)); \
- } \
- result; })
-
-
-#define atomic_add(mem, value) \
- (void) ({ if (__builtin_constant_p (value) && (value) == 1) \
- atomic_increment (mem); \
- else if (__builtin_constant_p (value) && (value) == 1) \
- atomic_decrement (mem); \
- else if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "addb %b1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "addw %w1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "addl %1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "0" (*mem)); \
- else \
- { \
- __typeof (value) addval = (value); \
- __typeof (*mem) oldval; \
- __typeof (mem) memp = (mem); \
- do \
- oldval = *memp; \
- while (__arch_compare_and_exchange_64_acq (memp, \
- oldval + addval, \
- oldval)); \
- } \
- })
-
-
-#define atomic_add_negative(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "addb %b2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "iq" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "addw %w2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "addl %2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_add_zero(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "addb %b2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "addw %w2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "addl %2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_increment(mem) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "incb %b0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "incw %w0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "incl %0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else \
- { \
- __typeof (*mem) oldval; \
- __typeof (mem) memp = (mem); \
- do \
- oldval = *memp; \
- while (__arch_compare_and_exchange_64_acq (memp, oldval + 1, \
- oldval)); \
- } \
- })
-
-
-#define atomic_increment_and_test(mem) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "incb %0; sete %b1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "incw %0; sete %w1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "incl %0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_decrement(mem) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "decb %b0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "decw %w0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "decl %0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else \
- { \
- __typeof (*mem) oldval; \
- __typeof (mem) memp = (mem); \
- do \
- oldval = *memp; \
- while (__arch_compare_and_exchange_64_acq (memp, oldval - 1, \
- oldval)); \
- } \
- })
-
-
-#define atomic_decrement_and_test(mem) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "decb %b0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "decw %w0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "decl %0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_bit_set(mem, bit) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "orb %b2, %0" \
- : "=m" (*mem) \
- : "0" (*mem), "i" (1 << (bit))); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "orw %w2, %0" \
- : "=m" (*mem) \
- : "0" (*mem), "i" (1 << (bit))); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "orl %2, %0" \
- : "=m" (*mem) \
- : "0" (*mem), "i" (1 << (bit))); \
- else \
- abort (); \
- })
-
-
-#define atomic_bit_test_set(mem, bit) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "btsb %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "1" (*mem), "i" (bit)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "btsw %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "1" (*mem), "i" (bit)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "btsl %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "1" (*mem), "i" (bit)); \
- else \
- abort (); \
- __result; })
diff --git a/nptl/sysdeps/i386/i586/bits/atomic.h b/nptl/sysdeps/i386/i586/bits/atomic.h
deleted file mode 100644
index 9cb58d5f32..0000000000
--- a/nptl/sysdeps/i386/i586/bits/atomic.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include "../../i486/bits/atomic.h"
diff --git a/nptl/sysdeps/i386/i686/bits/atomic.h b/nptl/sysdeps/i386/i686/bits/atomic.h
deleted file mode 100644
index 9cb58d5f32..0000000000
--- a/nptl/sysdeps/i386/i686/bits/atomic.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include "../../i486/bits/atomic.h"
diff --git a/nptl/sysdeps/ia64/bits/atomic.h b/nptl/sysdeps/ia64/bits/atomic.h
deleted file mode 100644
index fab23076cd..0000000000
--- a/nptl/sysdeps/ia64/bits/atomic.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-#include <ia64intrin.h>
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
-#define __arch_compare_and_exchange_8_acq(mem, newval, oldval) \
- (abort (), 0)
-
-#define __arch_compare_and_exchange_16_acq(mem, newval, oldval) \
- (abort (), 0)
-
-#define __arch_compare_and_exchange_32_acq(mem, newval, oldval) \
- (!__sync_bool_compare_and_swap_si ((int *) (mem), (int) (long) (oldval), \
- (int) (long) (newval)))
-
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- (!__sync_bool_compare_and_swap_di ((long *) (mem), (long) (oldval), \
- (long) (newval)))
-
-#define __arch_compare_and_exchange_32_val_acq(mem, newval, oldval) \
- __sync_val_compare_and_swap_si ((int *) (mem), (int) (long) (oldval), \
- (int) (long) (newval))
-
-# define __arch_compare_and_exchange_64_val_acq(mem, newval, oldval) \
- __sync_val_compare_and_swap_di ((long *) (mem), (long) (oldval), \
- (long) (newval))
-
-# define atomic_exchange_and_add(mem, value) \
- ({ \
- __typeof (*mem) __oldval, __val; \
- __typeof (mem) __memp = (mem); \
- __typeof (*mem) __value = (value); \
- \
- __val = *__memp; \
- if (sizeof (*mem) == 4) \
- do \
- { \
- __oldval = __val; \
- __val = __arch_compare_and_exchange_32_val_acq (__memp, \
- __oldval + __value, \
- __oldval); \
- } \
- while (__builtin_expect (__val != __oldval, 0)); \
- else if (sizeof (*mem) == 8) \
- do \
- { \
- __oldval = __val; \
- __val = __arch_compare_and_exchange_64_val_acq (__memp, \
- __oldval + __value, \
- __oldval); \
- } \
- while (__builtin_expect (__val != __oldval, 0)); \
- else \
- abort (); \
- __oldval + __value; })
diff --git a/nptl/sysdeps/powerpc/bits/atomic.h b/nptl/sysdeps/powerpc/bits/atomic.h
deleted file mode 100644
index af6156389f..0000000000
--- a/nptl/sysdeps/powerpc/bits/atomic.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Atomic operations. PowerPC version.
- Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
-#define __arch_compare_and_exchange_8_acq(mem, newval, oldval) \
- (abort (), 0)
-
-#define __arch_compare_and_exchange_16_acq(mem, newval, oldval) \
- (abort (), 0)
-
-#ifdef UP
-#define __ARCH_ACQ_INSTR ""
-#define __ARCH_REL_INSTR ""
-#else
-#define __ARCH_ACQ_INSTR "isync"
-#define __ARCH_REL_INSTR "sync"
-#endif
-
-/*
- * XXX At present these have both acquire and release semantics.
- * Ultimately we should do separate _acq and _rel versions.
- */
-
-/*
- * XXX this may not work properly on 64-bit if the register
- * containing oldval has the high half non-zero for some reason.
- */
-#define __arch_compare_and_exchange_32_acq(mem, newval, oldval) \
-({ \
- unsigned int __tmp; \
- __asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: lwarx %0,0,%1\n" \
- " subf. %0,%2,%0\n" \
- " bne 2f\n" \
- " stwcx. %3,0,%1\n" \
- " bne- 1b\n" \
- "2: " __ARCH_ACQ_INSTR \
- : "=&r" (__tmp) \
- : "r" (mem), "r" (oldval), "r" (newval) \
- : "cr0", "memory"); \
- __tmp != 0; \
-})
-
-#ifdef __powerpc64__
-#define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
-({ \
- unsigned long __tmp; \
- __asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: ldarx %0,0,%1\n" \
- " subf. %0,%2,%0\n" \
- " bne 2f\n" \
- " stdcx. %3,0,%1\n" \
- " bne- 1b\n" \
- "2: " __ARCH_ACQ_INSTR \
- : "=&r" (__tmp) \
- : "r" (mem), "r" (oldval), "r" (newval) \
- : "cr0", "memory"); \
- __tmp != 0; \
-})
-
-#else /* powerpc32 */
-#define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- (abort (), 0)
-#endif
-
-#define atomic_full_barrier() __asm ("sync" ::: "memory")
-#ifdef __powerpc64__
-#define atomic_read_barrier() __asm ("lwsync" ::: "memory")
-#else
-#define atomic_read_barrier() __asm ("sync" ::: "memory")
-#endif
-#define atomic_write_barrier() __asm ("eieio" ::: "memory")
diff --git a/nptl/sysdeps/s390/bits/atomic.h b/nptl/sysdeps/s390/bits/atomic.h
deleted file mode 100644
index 375ae0d5e7..0000000000
--- a/nptl/sysdeps/s390/bits/atomic.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
-#define __arch_compare_and_exchange_8_acq(mem, newval, oldval) \
- (abort (), 0)
-
-#define __arch_compare_and_exchange_16_acq(mem, newval, oldval) \
- (abort (), 0)
-
-#define __arch_compare_and_exchange_32_acq(mem, newval, oldval) \
- ({ unsigned int *__mem = (unsigned int *) (mem); \
- unsigned int __old = (unsigned int) (oldval); \
- unsigned int __cmp = __old; \
- __asm __volatile ("cs %0,%2,%1" \
- : "+d" (__old), "=Q" (*__mem) \
- : "d" (newval), "m" (*__mem) : "cc" ); \
- __cmp != __old; })
-
-#ifdef __s390x__
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- ({ unsigned long int *__mem = (unsigned long int *) (mem); \
- unsigned long int __old = (unsigned long int) (oldval); \
- unsigned long int __cmp = __old; \
- __asm __volatile ("csg %0,%2,%1" \
- : "+d" (__old), "=Q" (*__mem) \
- : "d" (newval), "m" (*__mem) : "cc" ); \
- __cmp != __old; })
-#else
-/* For 31 bit we do not really need 64-bit compare-and-exchange. We can
- implement them by use of the csd instruction. The straightforward
- implementation causes warnings so we skip the definition for now. */
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- (abort (), 0)
-#endif
diff --git a/nptl/sysdeps/sh/bits/atomic.h b/nptl/sysdeps/sh/bits/atomic.h
deleted file mode 100644
index de176ca2c5..0000000000
--- a/nptl/sysdeps/sh/bits/atomic.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
-#define __arch_compare_and_exchange_8_acq(mem, newval, oldval) \
- ({ unsigned char __result; \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- nop\n\
- mov r15,r1\n\
- mov #-8,r15\n\
- 0: mov.b @%1,r2\n\
- cmp/eq r2,%3\n\
- bf 1f\n\
- mov.b %2,@%1\n\
- 1: mov r1,r15\n\
- mov #-1,%0\n\
- negc %0,%0"\
- : "=r" (__result) : "r" (mem), "r" (newval), "r" (oldval) \
- : "r0", "r1", "r2", "t", "memory"); \
- __result; })
-
-#define __arch_compare_and_exchange_16_acq(mem, newval, oldval) \
- ({ unsigned char __result; \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- nop\n\
- mov r15,r1\n\
- mov #-8,r15\n\
- 0: mov.w @%1,r2\n\
- cmp/eq r2,%3\n\
- bf 1f\n\
- mov.w %2,@%1\n\
- 1: mov r1,r15\n\
- mov #-1,%0\n\
- negc %0,%0"\
- : "=r" (__result) : "r" (mem), "r" (newval), "r" (oldval) \
- : "r0", "r1", "r2", "t", "memory"); \
- __result; })
-
-#define __arch_compare_and_exchange_32_acq(mem, newval, oldval) \
- ({ unsigned char __result; \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- nop\n\
- mov r15,r1\n\
- mov #-8,r15\n\
- 0: mov.l @%1,r2\n\
- cmp/eq r2,%3\n\
- bf 1f\n\
- mov.l %2,@%1\n\
- 1: mov r1,r15\n\
- mov #-1,%0\n\
- negc %0,%0"\
- : "=r" (__result) : "r" (mem), "r" (newval), "r" (oldval) \
- : "r0", "r1", "r2", "t", "memory"); \
- __result; })
-
-/* XXX We do not really need 64-bit compare-and-exchange. At least
- not in the moment. Using it would mean causing portability
- problems since not many other 32-bit architectures have support for
- such an operation. So don't define any code for now. */
-
-# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- (abort (), 0)
-
-#define atomic_exchange_and_add(mem, value) \
- ({ __typeof (*mem) __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.b @%2,%0\n\
- add %0,%1\n\
- mov.b %1,@%2\n\
- 1: mov r1,r15"\
- : "=&r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "memory"); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.w @%2,%0\n\
- add %0,%1\n\
- mov.w %1,@%2\n\
- 1: mov r1,r15"\
- : "=&r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "memory"); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.l @%2,%0\n\
- add %0,%1\n\
- mov.l %1,@%2\n\
- 1: mov r1,r15"\
- : "=&r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "memory"); \
- else \
- { \
- __typeof (value) addval = (value); \
- __typeof (*mem) oldval; \
- __typeof (mem) memp = (mem); \
- do \
- __result = (oldval = *memp) + addval; \
- while (!__arch_compare_and_exchange_64_acq (memp, __result, oldval));\
- (void) addval; \
- } \
- __result; })
-
-#define atomic_add(mem, value) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.b @%1,r2\n\
- add r2,%0\n\
- mov.b %0,@%1\n\
- 1: mov r1,r15"\
- : "=&r" (value) : "r" (mem), "0" (value) \
- : "r0", "r1", "r2", "memory"); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.w @%1,r2\n\
- add r2,%0\n\
- mov.w %0,@%1\n\
- 1: mov r1,r15"\
- : "=&r" (value) : "r" (mem), "0" (value) \
- : "r0", "r1", "r2", "memory"); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.l @%1,r2\n\
- add r2,%0\n\
- mov.l %0,@%1\n\
- 1: mov r1,r15"\
- : "=&r" (value) : "r" (mem), "0" (value) \
- : "r0", "r1", "r2", "memory"); \
- else \
- { \
- __typeof (value) addval = (value); \
- __typeof (*mem) oldval; \
- __typeof (mem) memp = (mem); \
- do \
- oldval = *memp; \
- while (! __arch_compare_and_exchange_64_acq (memp, \
- oldval + addval, \
- oldval)); \
- (void) addval; \
- } \
- })
-
-#define atomic_add_negative(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.b @%2,r2\n\
- add r2,%1\n\
- mov.b %1,@%2\n\
- 1: mov r1,r15\n\
- shal %1\n\
- movt %0"\
- : "=r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "r2", "t", "memory"); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.w @%2,r2\n\
- add r2,%1\n\
- mov.w %1,@%2\n\
- 1: mov r1,r15\n\
- shal %1\n\
- movt %0"\
- : "=r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "r2", "t", "memory"); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.l @%2,r2\n\
- add r2,%1\n\
- mov.l %1,@%2\n\
- 1: mov r1,r15\n\
- shal %1\n\
- movt %0"\
- : "=r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "r2", "t", "memory"); \
- else \
- abort (); \
- __result; })
-
-#define atomic_add_zero(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.b @%2,r2\n\
- add r2,%1\n\
- mov.b %1,@%2\n\
- 1: mov r1,r15\n\
- tst %1,%1\n\
- movt %0"\
- : "=r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "r2", "t", "memory"); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.w @%2,r2\n\
- add r2,%1\n\
- mov.w %1,@%2\n\
- 1: mov r1,r15\n\
- tst %1,%1\n\
- movt %0"\
- : "=r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "r2", "t", "memory"); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.l @%2,r2\n\
- add r2,%1\n\
- mov.l %1,@%2\n\
- 1: mov r1,r15\n\
- tst %1,%1\n\
- movt %0"\
- : "=r" (__result), "=&r" (value) : "r" (mem), "1" (value) \
- : "r0", "r1", "r2", "t", "memory"); \
- else \
- abort (); \
- __result; })
-
-#define atomic_increment_and_test(mem) atomic_add_zero((mem), 1)
-#define atomic_decrement_and_test(mem) atomic_add_zero((mem), -1)
-
-#define atomic_bit_set(mem, bit) \
- (void) ({ unsigned int __mask = 1 << (bit); \
- if (sizeof (*mem) == 1) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.b @%0,r2\n\
- or %1,r2\n\
- mov.b r2,@%0\n\
- 1: mov r1,r15"\
- : : "r" (mem), "r" (__mask) \
- : "r0", "r1", "r2", "memory"); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.w @%0,r2\n\
- or %1,r2\n\
- mov.w r2,@%0\n\
- 1: mov r1,r15"\
- : : "r" (mem), "r" (__mask) \
- : "r0", "r1", "r2", "memory"); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- mov r15,r1\n\
- mov #-6,r15\n\
- 0: mov.l @%0,r2\n\
- or %1,r2\n\
- mov.l r2,@%0\n\
- 1: mov r1,r15"\
- : : "r" (mem), "r" (__mask) \
- : "r0", "r1", "r2", "memory"); \
- else \
- abort (); \
- })
-
-#define atomic_bit_test_set(mem, bit) \
- ({ unsigned int __mask = 1 << (bit); \
- unsigned int __result = __mask; \
- if (sizeof (*mem) == 1) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- nop\n\
- mov r15,r1\n\
- mov #-8,r15\n\
- 0: mov.b @%2,r2\n\
- or r2,%1\n\
- and r2,%0\n\
- mov.b %1,@%2\n\
- 1: mov r1,r15"\
- : "=&r" (__result), "=&r" (__mask) \
- : "r" (mem), "0" (__result), "1" (__mask) \
- : "r0", "r1", "r2", "memory"); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- nop\n\
- mov r15,r1\n\
- mov #-8,r15\n\
- 0: mov.w @%2,r2\n\
- or r2,%1\n\
- and r2,%0\n\
- mov.w %1,@%2\n\
- 1: mov r1,r15"\
- : "=&r" (__result), "=&r" (__mask) \
- : "r" (mem), "0" (__result), "1" (__mask) \
- : "r0", "r1", "r2", "memory"); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile ("\
- .align 2\n\
- mova 1f,r0\n\
- nop\n\
- mov r15,r1\n\
- mov #-8,r15\n\
- 0: mov.l @%2,r2\n\
- or r2,%1\n\
- and r2,%0\n\
- mov.l %1,@%2\n\
- 1: mov r1,r15"\
- : "=&r" (__result), "=&r" (__mask) \
- : "r" (mem), "0" (__result), "1" (__mask) \
- : "r0", "r1", "r2", "memory"); \
- else \
- abort (); \
- __result; })
diff --git a/nptl/sysdeps/x86_64/bits/atomic.h b/nptl/sysdeps/x86_64/bits/atomic.h
deleted file mode 100644
index f72f16c501..0000000000
--- a/nptl/sysdeps/x86_64/bits/atomic.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
-#ifndef LOCK
-# ifdef UP
-# define LOCK /* nothing */
-# else
-# define LOCK "lock;"
-# endif
-#endif
-
-
-#define __arch_compare_and_exchange_8_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- __asm __volatile (LOCK "cmpxchgb %b2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem) \
- : "q" (newval), "1" (*mem), "0" (oldval)); \
- ret; })
-
-#define __arch_compare_and_exchange_16_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- __asm __volatile (LOCK "cmpxchgw %w2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem) \
- : "r" (newval), "1" (*mem), "0" (oldval)); \
- ret; })
-
-#define __arch_compare_and_exchange_32_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- __asm __volatile (LOCK "cmpxchgl %2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem) \
- : "r" (newval), "1" (*mem), "0" (oldval)); \
- ret; })
-
-#define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
- ({ unsigned char ret; \
- __asm __volatile (LOCK "cmpxchgq %q2, %1; setne %0" \
- : "=a" (ret), "=m" (*mem) \
- : "r" (newval), "1" (*mem), "0" (oldval)); \
- ret; })
-
-
-#define atomic_exchange_and_add(mem, value) \
- ({ __typeof (*mem) result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "xaddb %b0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (value), "1" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "xaddw %w0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (value), "1" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "xaddl %0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (value), "1" (*mem)); \
- else \
- __asm __volatile (LOCK "xaddq %q0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (value), "1" (*mem)); \
- result; })
-
-
-#define atomic_add(mem, value) \
- (void) ({ if (__builtin_constant_p (value) && (value) == 1) \
- atomic_increment (mem); \
- else if (__builtin_constant_p (value) && (value) == 1) \
- atomic_decrement (mem); \
- else if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "addb %b1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "addw %w1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "addl %1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "0" (*mem)); \
- else \
- __asm __volatile (LOCK "addq %q1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "0" (*mem)); \
- })
-
-
-#define atomic_add_negative(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "addb %b2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "addw %w2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "addl %2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else \
- __asm __volatile (LOCK "addq %q2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- __result; })
-
-
-#define atomic_add_zero(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "addb %b2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "addw %w2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "addl %2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- else \
- __asm __volatile (LOCK "addq %q2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "0" (*mem)); \
- __result; })
-
-
-#define atomic_increment(mem) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "incb %b0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "incw %w0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "incl %0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else \
- __asm __volatile (LOCK "incq %q0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- })
-
-
-#define atomic_increment_and_test(mem) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "incb %b0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "incw %w0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "incl %0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else \
- __asm __volatile (LOCK "incq %q0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- __result; })
-
-
-#define atomic_decrement(mem) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "decb %b0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "decw %w0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "decl %0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- else \
- __asm __volatile (LOCK "decq %q0" \
- : "=m" (*mem) \
- : "0" (*mem)); \
- })
-
-
-#define atomic_decrement_and_test(mem) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "decb %b0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "decw %w0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "decl %0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- else \
- __asm __volatile (LOCK "decq %q0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "0" (*mem)); \
- __result; })
-
-
-#define atomic_bit_set(mem, bit) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "orb %b2, %0" \
- : "=m" (*mem) \
- : "0" (*mem), "i" (1 << (bit))); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "orw %w2, %0" \
- : "=m" (*mem) \
- : "0" (*mem), "i" (1 << (bit))); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "orl %2, %0" \
- : "=m" (*mem) \
- : "0" (*mem), "i" (1 << (bit))); \
- else \
- __asm __volatile (LOCK "orq %q2, %0" \
- : "=m" (*mem) \
- : "0" (*mem), "i" (1 << (bit))); \
- })
-
-
-#define atomic_bit_test_set(mem, bit) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK "btsb %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "1" (*mem), "i" (bit)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK "btsw %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "1" (*mem), "i" (bit)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK "btsl %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "1" (*mem), "i" (bit)); \
- else \
- __asm __volatile (LOCK "btsq %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "1" (*mem), "i" (bit)); \
- __result; })