summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-01-05 11:29:56 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-01-05 11:29:56 +0300
commit7914f5358fa9588f9234ec50180e6a10b4ffad1b (patch)
tree6640824230bdf707d08018187d1a0cc94576f019
parent1668e46c23abfc57f6b6babfda71fffb33d0bca9 (diff)
downloadlibatomic_ops-7914f5358fa9588f9234ec50180e6a10b4ffad1b.tar.gz
Support Elbrus 2000 (gcc/e2k)
This commit adds support of the clang compiler (in addition to gcc) for E2K architecture. * CMakeLists.txt [install_headers] (FILES): Install also gcc/e2k.h. * src/atomic_ops.h [__GNUC__ && !AO_USE_PTHREAD_DEFS && !__INTEL_COMPILER && __e2k__]: Include gcc/e2k.h. * src/atomic_ops/sysdeps/gcc/e2k.h: New file.
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/atomic_ops.h2
-rw-r--r--src/atomic_ops/sysdeps/gcc/e2k.h28
4 files changed, 32 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0131849..f99b08c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -215,6 +215,7 @@ if (install_headers)
src/atomic_ops/sysdeps/gcc/arm.h
src/atomic_ops/sysdeps/gcc/avr32.h
src/atomic_ops/sysdeps/gcc/cris.h
+ src/atomic_ops/sysdeps/gcc/e2k.h
src/atomic_ops/sysdeps/gcc/generic-arithm.h
src/atomic_ops/sysdeps/gcc/generic-small.h
src/atomic_ops/sysdeps/gcc/generic.h
diff --git a/src/Makefile.am b/src/Makefile.am
index a392477..40ec57f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,6 +88,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/arm.h \
atomic_ops/sysdeps/gcc/avr32.h \
atomic_ops/sysdeps/gcc/cris.h \
+ atomic_ops/sysdeps/gcc/e2k.h \
atomic_ops/sysdeps/gcc/generic.h \
atomic_ops/sysdeps/gcc/hexagon.h \
atomic_ops/sysdeps/gcc/hppa.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index f9251bf..29c6a31 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -364,6 +364,8 @@
# define AO_CAN_EMUL_CAS
# elif defined(__avr32__)
# include "atomic_ops/sysdeps/gcc/avr32.h"
+# elif defined(__e2k__)
+# include "atomic_ops/sysdeps/gcc/e2k.h"
# elif defined(__hexagon__)
# include "atomic_ops/sysdeps/gcc/hexagon.h"
# elif defined(__nios2__)
diff --git a/src/atomic_ops/sysdeps/gcc/e2k.h b/src/atomic_ops/sysdeps/gcc/e2k.h
new file mode 100644
index 0000000..087584b
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/e2k.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2022 Ivan Maidanski
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* As of clang-9, all __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n are missing. */
+#define AO_GCC_FORCE_HAVE_CAS
+
+#include "generic.h"
+
+#undef AO_GCC_FORCE_HAVE_CAS