summaryrefslogtreecommitdiff
path: root/user/mariadb/gcc_builtins_ppc.h
diff options
context:
space:
mode:
Diffstat (limited to 'user/mariadb/gcc_builtins_ppc.h')
-rw-r--r--user/mariadb/gcc_builtins_ppc.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/user/mariadb/gcc_builtins_ppc.h b/user/mariadb/gcc_builtins_ppc.h
new file mode 100644
index 000000000..8e492c58a
--- /dev/null
+++ b/user/mariadb/gcc_builtins_ppc.h
@@ -0,0 +1,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 */