1 // SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
3 // SPDX-License-Identifier: LGPL-2.1-or-later
9 * Architecture detection using compiler defines.
11 * The following defines are used internally for architecture specific code.
13 * URCU_ARCH_X86 : All x86 variants 32 and 64 bits
14 * URCU_ARCH_I386 : Specific to the i386
15 * URCU_ARCH_AMD64 : All 64 bits x86 variants
16 * URCU_ARCH_K1OM : Specific to the Xeon Phi / MIC
18 * URCU_ARCH_PPC : All PowerPC variants 32 and 64 bits
19 * URCU_ARCH_PPC64 : Specific to 64 bits variants
21 * URCU_ARCH_S390 : All IBM s390 / s390x variants
23 * URCU_ARCH_SPARC64 : All Sun SPARC variants
25 * URCU_ARCH_ALPHA : All DEC Alpha variants
26 * URCU_ARCH_IA64 : All Intel Itanium variants
27 * URCU_ARCH_ARM : All ARM 32 bits variants
28 * URCU_ARCH_ARMV7 : All ARMv7 ISA variants
29 * URCU_ARCH_AARCH64 : All ARM 64 bits variants
30 * URCU_ARCH_MIPS : All MIPS variants
31 * URCU_ARCH_NIOS2 : All Intel / Altera NIOS II variants
32 * URCU_ARCH_TILE : All Tilera TILE variants
33 * URCU_ARCH_HPPA : All HP PA-RISC variants
34 * URCU_ARCH_M68K : All Motorola 68000 variants
35 * URCU_ARCH_RISCV : All RISC-V variants
36 * URCU_ARCH_LOONGARCH : All LoongArch variants
39 #if (defined(__INTEL_OFFLOAD) || defined(__TARGET_ARCH_MIC) || defined(__MIC__))
41 #define URCU_ARCH_X86 1
42 #define URCU_ARCH_AMD64 1
43 #define URCU_ARCH_K1OM 1
44 #include <urcu/arch/x86.h>
46 #elif (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64))
48 #define URCU_ARCH_X86 1
49 #define URCU_ARCH_AMD64 1
50 #include <urcu/arch/x86.h>
52 #elif (defined(__i386__) || defined(__i386))
54 #define URCU_ARCH_X86 1
57 * URCU_ARCH_X86_NO_CAS enables a compat layer that will detect the presence of
58 * the cmpxchg instructions at runtime and provide a compat mode based on a
59 * pthread mutex when it isn't.
61 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 was introduced in GCC 4.3 and Clang 3.3,
62 * building with older compilers will result in the compat layer always being
65 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
66 #define URCU_ARCH_X86_NO_CAS 1
67 /* For backwards compat */
68 #define URCU_ARCH_I386 1
71 #include <urcu/arch/x86.h>
73 #elif (defined(__powerpc64__) || defined(__ppc64__))
75 #define URCU_ARCH_PPC 1
76 #define URCU_ARCH_PPC64 1
77 #include <urcu/arch/ppc.h>
79 #elif (defined(__powerpc__) || defined(__powerpc) || defined(__ppc__))
81 #define URCU_ARCH_PPC 1
82 #include <urcu/arch/ppc.h>
84 #elif (defined(__s390__) || defined(__s390x__) || defined(__zarch__))
86 #define URCU_ARCH_S390 1
87 #include <urcu/arch/s390.h>
89 #elif (defined(__sparc__) || defined(__sparc) || defined(__sparc64__))
91 #define URCU_ARCH_SPARC64 1
92 #include <urcu/arch/sparc64.h>
94 #elif (defined(__alpha__) || defined(__alpha))
96 #define URCU_ARCH_ALPHA 1
97 #include <urcu/arch/alpha.h>
99 #elif (defined(__ia64__) || defined(__ia64))
101 #define URCU_ARCH_IA64 1
102 #include <urcu/arch/ia64.h>
104 #elif (defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__))
106 #define URCU_ARCH_ARMV7 1
107 #define URCU_ARCH_ARM 1
108 #include <urcu/arch/arm.h>
110 #elif (defined(__arm__) || defined(__arm))
112 #define URCU_ARCH_ARM 1
113 #include <urcu/arch/arm.h>
115 #elif defined(__aarch64__)
117 #define URCU_ARCH_AARCH64 1
118 #include <urcu/arch/aarch64.h>
120 #elif (defined(__mips__) || defined(__mips))
122 #define URCU_ARCH_MIPS 1
123 #include <urcu/arch/mips.h>
125 #elif (defined(__nios2__) || defined(__nios2))
127 #define URCU_ARCH_NIOS2 1
128 #include <urcu/arch/nios2.h>
130 #elif defined(__tilegx__)
132 * URCU has only been tested on the TileGx architecture. For other Tile*
133 * architectures, please run the tests first and report the results to the
134 * maintainer so that proper support can be added.
137 #define URCU_ARCH_TILE 1
138 #include <urcu/arch/tile.h>
140 #elif (defined(__hppa__) || defined(__HPPA__) || defined(__hppa))
142 #define URCU_ARCH_HPPA 1
143 #include <urcu/arch/hppa.h>
145 #elif defined(__m68k__)
147 #define URCU_ARCH_M68K 1
148 #include <urcu/arch/m68k.h>
150 #elif defined(__riscv)
152 #define URCU_ARCH_RISCV 1
153 #include <urcu/arch/riscv.h>
155 #elif defined(__loongarch__)
157 #define URCU_ARCH_LOONGARCH 1
158 #include <urcu/arch/loongarch.h>
161 #error "Cannot build: unrecognized architecture, see <urcu/arch.h>."
164 #ifdef CONFIG_RCU_EMIT_LEGACY_MB
165 # define cmm_emit_legacy_smp_mb() cmm_smp_mb()
167 # define cmm_emit_legacy_smp_mb() do { } while (0)
171 #endif /* _URCU_ARCH_H */
This page took 0.045672 seconds and 4 git commands to generate.