summaryrefslogtreecommitdiff
path: root/user/mariadb/gcc_builtins_ppc.h
blob: 8e492c58a62a2f6986170faeb6c6f5b64b347d0a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
#define ATOMIC_GCC_BUILTINS_INCLUDED

/* Copyright (c) 2017 MariaDB Foundation

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program 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 General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335  USA */


#define MY_MEMORY_ORDER_RELAXED __ATOMIC_RELAXED
#define MY_MEMORY_ORDER_CONSUME __ATOMIC_CONSUME
#define MY_MEMORY_ORDER_ACQUIRE __ATOMIC_ACQUIRE
#define MY_MEMORY_ORDER_RELEASE __ATOMIC_RELEASE
#define MY_MEMORY_ORDER_ACQ_REL __ATOMIC_ACQ_REL
#define MY_MEMORY_ORDER_SEQ_CST __ATOMIC_SEQ_CST

#define my_atomic_store32_explicit(P, D, O) __atomic_store_4((P), (D), (O))
#define my_atomic_store64_explicit(P, D, O) __atomic_store_8((P), (D), (O))
#define my_atomic_storeptr_explicit(P, D, O) __atomic_store_4((P), (unsigned int)(D), (O))

#define my_atomic_load32_explicit(P, O) __atomic_load_4((P), (O))
#define my_atomic_load64_explicit(P, O) __atomic_load_8((P), (O))
#define my_atomic_loadptr_explicit(P, O) __atomic_load_4((P), (O))

#define my_atomic_fas32_explicit(P, D, O) __atomic_exchange_4((P), (D), (O))
#define my_atomic_fas64_explicit(P, D, O) __atomic_exchange_8((P), (D), (O))
#define my_atomic_fasptr_explicit(P, D, O) __atomic_exchange_4((P), (D), (O))

#define my_atomic_add32_explicit(P, A, O) __atomic_fetch_add_4((P), (A), (O))
#define my_atomic_add64_explicit(P, A, O) __atomic_fetch_add_8((P), (A), (O))

#define my_atomic_cas32_weak_explicit(P, E, D, S, F) \
  __atomic_compare_exchange_4((P), (E), (D), 1, (S), (F))
#define my_atomic_cas64_weak_explicit(P, E, D, S, F) \
  __atomic_compare_exchange_8((P), (E), (D), 1, (S), (F))
#define my_atomic_casptr_weak_explicit(P, E, D, S, F) \
  __atomic_compare_exchange_4((P), (E), (D), 1, (S), (F))

#define my_atomic_cas32_strong_explicit(P, E, D, S, F) \
  __atomic_compare_exchange_4((P), (E), (D), 0, (S), (F))
#define my_atomic_cas64_strong_explicit(P, E, D, S, F) \
  __atomic_compare_exchange_8((P), (E), (D), 0, (S), (F))
#define my_atomic_casptr_strong_explicit(P, E, D, S, F) \
  __atomic_compare_exchange_4((P), (E), (D), 0, (S), (F))

#define my_atomic_store32(P, D) __atomic_store_4((P), (D), __ATOMIC_SEQ_CST)
#define my_atomic_store64(P, D) __atomic_store_8((P), (D), __ATOMIC_SEQ_CST)
#define my_atomic_storeptr(P, D) __atomic_store_4((P), (D), __ATOMIC_SEQ_CST)

#define my_atomic_load32(P) __atomic_load_4((P), __ATOMIC_SEQ_CST)
#define my_atomic_load64(P) __atomic_load_8((P), __ATOMIC_SEQ_CST)
#define my_atomic_loadptr(P) __atomic_load_4((P), __ATOMIC_SEQ_CST)

#define my_atomic_fas32(P, D) __atomic_exchange_4((P), (D), __ATOMIC_SEQ_CST)
#define my_atomic_fas64(P, D) __atomic_exchange_8((P), (D), __ATOMIC_SEQ_CST)
#define my_atomic_fasptr(P, D) __atomic_exchange_4((P), (D), __ATOMIC_SEQ_CST)

#define my_atomic_add32(P, A) __atomic_fetch_add_4((P), (A), __ATOMIC_SEQ_CST)
#define my_atomic_add64(P, A) __atomic_fetch_add_8((P), (A), __ATOMIC_SEQ_CST)

#define my_atomic_cas32(P, E, D) \
  __atomic_compare_exchange_4((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
#define my_atomic_cas64(P, E, D) \
  __atomic_compare_exchange_8((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
#define my_atomic_casptr(P, E, D) \
  __atomic_compare_exchange_4((P), (E), (D), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)

#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */