]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/tile/atomic-machine.h
Remove atomic_compare_and_exchange_bool_rel.
[thirdparty/glibc.git] / sysdeps / tile / atomic-machine.h
CommitLineData
f7a9f785 1/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
63d143a2
CM
2 This file is part of the GNU C Library.
3 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
ab84e3ff
PE
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
63d143a2
CM
18
19/* The sub-architecture headers provide definitions for these macros
20 that work for "int" and "long" size values only:
21
22 atomic_compare_and_exchange_val_acq()
23 atomic_exchange_acq()
24 atomic_exchange_and_add()
25 atomic_and_val()
26 atomic_or_val()
27 atomic_decrement_if_positive() [tilegx only]
28
29 Here we provide generic definitions true for all Tilera chips. */
30
31#include <stdint.h>
32#include <features.h>
33
34typedef int32_t atomic32_t;
35typedef uint32_t uatomic32_t;
36typedef int_fast32_t atomic_fast32_t;
37typedef uint_fast32_t uatomic_fast32_t;
38
39typedef int64_t atomic64_t;
40typedef uint64_t uatomic64_t;
41typedef int_fast64_t atomic_fast64_t;
42typedef uint_fast64_t uatomic_fast64_t;
43
44typedef intptr_t atomicptr_t;
45typedef uintptr_t uatomicptr_t;
46typedef intmax_t atomic_max_t;
47typedef uintmax_t uatomic_max_t;
48
49/* Barrier macro. */
50#define atomic_full_barrier() __sync_synchronize()
51
52/* APIs with "release" semantics. */
53#define atomic_compare_and_exchange_val_rel(mem, n, o) \
54 ({ \
55 atomic_full_barrier (); \
56 atomic_compare_and_exchange_val_acq ((mem), (n), (o)); \
57 })
63d143a2
CM
58#define atomic_exchange_rel(mem, n) \
59 ({ \
60 atomic_full_barrier (); \
61 atomic_exchange_acq ((mem), (n)); \
62 })
63
64/* Various macros that should just be synonyms. */
65#define catomic_exchange_and_add atomic_exchange_and_add
66#define atomic_and(mem, mask) ((void) atomic_and_val ((mem), (mask)))
67#define catomic_and atomic_and
68#define atomic_or(mem, mask) ((void) atomic_or_val ((mem), (mask)))
69#define catomic_or atomic_or
70
71/* atomic_bit_test_set in terms of atomic_or_val. */
72#define atomic_bit_test_set(mem, bit) \
73 ({ __typeof (*(mem)) __att0_mask = ((__typeof (*(mem))) 1 << (bit)); \
74 atomic_or_val ((mem), __att0_mask) & __att0_mask; })
75
76/*
77 * This non-existent symbol is called for unsupporrted sizes,
78 * indicating a bug in the caller.
79 */
80extern int __atomic_error_bad_argument_size(void)
81 __attribute__ ((warning ("bad sizeof atomic argument")));