Open Broadcaster Software
Free, open source software for live streaming and recording
simde-arch.h
Go to the documentation of this file.
1 /* Architecture detection
2  * Created by Evan Nemerson <evan@nemerson.com>
3  *
4  * To the extent possible under law, the authors have waived all
5  * copyright and related or neighboring rights to this code. For
6  * details, see the Creative Commons Zero 1.0 Universal license at
7  * <https://creativecommons.org/publicdomain/zero/1.0/>
8  *
9  * Different compilers define different preprocessor macros for the
10  * same architecture. This is an attempt to provide a single
11  * interface which is usable on any compiler.
12  *
13  * In general, a macro named SIMDE_ARCH_* is defined for each
14  * architecture the CPU supports. When there are multiple possible
15  * versions, we try to define the macro to the target version. For
16  * example, if you want to check for i586+, you could do something
17  * like:
18  *
19  * #if defined(SIMDE_ARCH_X86) && (SIMDE_ARCH_X86 >= 5)
20  * ...
21  * #endif
22  *
23  * You could also just check that SIMDE_ARCH_X86 >= 5 without checking
24  * if it's defined first, but some compilers may emit a warning about
25  * an undefined macro being used (e.g., GCC with -Wundef).
26  *
27  * This was originally created for SIMDe
28  * <https://github.com/nemequ/simde> (hence the prefix), but this
29  * header has no dependencies and may be used anywhere. It is
30  * originally based on information from
31  * <https://sourceforge.net/p/predef/wiki/Architectures/>, though it
32  * has been enhanced with additional information.
33  *
34  * If you improve this file, or find a bug, please file the issue at
35  * <https://github.com/nemequ/simde/issues>. If you copy this into
36  * your project, even if you change the prefix, please keep the links
37  * to SIMDe intact so others know where to report issues, submit
38  * enhancements, and find the latest version. */
39 
40 #if !defined(SIMDE_ARCH_H)
41 #define SIMDE_ARCH_H
42 
43 /* Alpha
44  <https://en.wikipedia.org/wiki/DEC_Alpha> */
45 #if defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
46 #if defined(__alpha_ev6__)
47 #define SIMDE_ARCH_ALPHA 6
48 #elif defined(__alpha_ev5__)
49 #define SIMDE_ARCH_ALPHA 5
50 #elif defined(__alpha_ev4__)
51 #define SIMDE_ARCH_ALPHA 4
52 #else
53 #define SIMDE_ARCH_ALPHA 1
54 #endif
55 #endif
56 
57 /* Atmel AVR
58  <https://en.wikipedia.org/wiki/Atmel_AVR> */
59 #if defined(__AVR_ARCH__)
60 #define SIMDE_ARCH_AVR __AVR_ARCH__
61 #endif
62 
63 /* AMD64 / x86_64
64  <https://en.wikipedia.org/wiki/X86-64> */
65 #if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || \
66  defined(__x86_64) || defined(_M_X66) || defined(_M_AMD64)
67 #define SIMDE_ARCH_AMD64 1
68 #endif
69 
70 /* ARM
71  <https://en.wikipedia.org/wiki/ARM_architecture> */
72 #if defined(__ARM_ARCH_8A__)
73 #define SIMDE_ARCH_ARM 82
74 #elif defined(__ARM_ARCH_8R__)
75 #define SIMDE_ARCH_ARM 81
76 #elif defined(__ARM_ARCH_8__)
77 #define SIMDE_ARCH_ARM 80
78 #elif defined(__ARM_ARCH_7S__)
79 #define SIMDE_ARCH_ARM 74
80 #elif defined(__ARM_ARCH_7M__)
81 #define SIMDE_ARCH_ARM 73
82 #elif defined(__ARM_ARCH_7R__)
83 #define SIMDE_ARCH_ARM 72
84 #elif defined(__ARM_ARCH_7A__)
85 #define SIMDE_ARCH_ARM 71
86 #elif defined(__ARM_ARCH_7__)
87 #define SIMDE_ARCH_ARM 70
88 #elif defined(__ARM_ARCH)
89 #define SIMDE_ARCH_ARM (__ARM_ARCH * 10)
90 #elif defined(_M_ARM)
91 #define SIMDE_ARCH_ARM (_M_ARM * 10)
92 #elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \
93  defined(_ARM) || defined(_M_ARM) || defined(_M_ARM)
94 #define SIMDE_ARCH_ARM 1
95 #endif
96 
97 /* AArch64
98  <https://en.wikipedia.org/wiki/ARM_architecture> */
99 #if defined(__aarch64__) || defined(_M_ARM64)
100 #define SIMDE_ARCH_AARCH64 10
101 #endif
102 
103 /* Blackfin
104  <https://en.wikipedia.org/wiki/Blackfin> */
105 #if defined(__bfin) || defined(__BFIN__) || defined(__bfin__)
106 #define SIMDE_ARCH_BLACKFIN 1
107 #endif
108 
109 /* CRIS
110  <https://en.wikipedia.org/wiki/ETRAX_CRIS> */
111 #if defined(__CRIS_arch_version)
112 #define SIMDE_ARCH_CRIS __CRIS_arch_version
113 #elif defined(__cris__) || defined(__cris) || defined(__CRIS) || \
114  defined(__CRIS__)
115 #define SIMDE_ARCH_CRIS 1
116 #endif
117 
118 /* Convex
119  <https://en.wikipedia.org/wiki/Convex_Computer> */
120 #if defined(__convex_c38__)
121 #define SIMDE_ARCH_CONVEX 38
122 #elif defined(__convex_c34__)
123 #define SIMDE_ARCH_CONVEX 34
124 #elif defined(__convex_c32__)
125 #define SIMDE_ARCH_CONVEX 32
126 #elif defined(__convex_c2__)
127 #define SIMDE_ARCH_CONVEX 2
128 #elif defined(__convex__)
129 #define SIMDE_ARCH_CONVEX 1
130 #endif
131 
132 /* Adapteva Epiphany
133  <https://en.wikipedia.org/wiki/Adapteva_Epiphany> */
134 #if defined(__epiphany__)
135 #define SIMDE_ARCH_EPIPHANY 1
136 #endif
137 
138 /* Fujitsu FR-V
139  <https://en.wikipedia.org/wiki/FR-V_(microprocessor)> */
140 #if defined(__frv__)
141 #define SIMDE_ARCH_FRV 1
142 #endif
143 
144 /* H8/300
145  <https://en.wikipedia.org/wiki/H8_Family> */
146 #if defined(__H8300__)
147 #define SIMDE_ARCH_H8300
148 #endif
149 
150 /* HP/PA / PA-RISC
151  <https://en.wikipedia.org/wiki/PA-RISC> */
152 #if defined(__PA8000__) || defined(__HPPA20__) || defined(__RISC2_0__) || \
153  defined(_PA_RISC2_0)
154 #define SIMDE_ARCH_HPPA 20
155 #elif defined(__PA7100__) || defined(__HPPA11__) || defined(_PA_RISC1_1)
156 #define SIMDE_ARCH_HPPA 11
157 #elif defined(_PA_RISC1_0)
158 #define SIMDE_ARCH_HPPA 10
159 #elif defined(__hppa__) || defined(__HPPA__) || defined(__hppa)
160 #define SIMDE_ARCH_HPPA 1
161 #endif
162 
163 /* x86
164  <https://en.wikipedia.org/wiki/X86> */
165 #if defined(_M_IX86)
166 #define SIMDE_ARCH_X86 (_M_IX86 / 100)
167 #elif defined(__I86__)
168 #define SIMDE_ARCH_X86 __I86__
169 #elif defined(i686) || defined(__i686) || defined(__i686__)
170 #define SIMDE_ARCH_X86 6
171 #elif defined(i586) || defined(__i586) || defined(__i586__)
172 #define SIMDE_ARCH_X86 5
173 #elif defined(i486) || defined(__i486) || defined(__i486__)
174 #define SIMDE_ARCH_X86 4
175 #elif defined(i386) || defined(__i386) || defined(__i386__)
176 #define SIMDE_ARCH_X86 3
177 #elif defined(_X86_) || defined(__X86__) || defined(__THW_INTEL__)
178 #define SIMDE_ARCH_X86 3
179 #endif
180 
181 /* Itanium
182  <https://en.wikipedia.org/wiki/Itanium> */
183 #if defined(__ia64__) || defined(_IA64) || defined(__IA64__) || \
184  defined(__ia64) || defined(_M_IA64) || defined(__itanium__)
185 #define SIMDE_ARCH_IA64 1
186 #endif
187 
188 /* Renesas M32R
189  <https://en.wikipedia.org/wiki/M32R> */
190 #if defined(__m32r__) || defined(__M32R__)
191 #define SIMDE_ARCH_M32R
192 #endif
193 
194 /* Motorola 68000
195  <https://en.wikipedia.org/wiki/Motorola_68000> */
196 #if defined(__mc68060__) || defined(__MC68060__)
197 #define SIMDE_ARCH_M68K 68060
198 #elif defined(__mc68040__) || defined(__MC68040__)
199 #define SIMDE_ARCH_M68K 68040
200 #elif defined(__mc68030__) || defined(__MC68030__)
201 #define SIMDE_ARCH_M68K 68030
202 #elif defined(__mc68020__) || defined(__MC68020__)
203 #define SIMDE_ARCH_M68K 68020
204 #elif defined(__mc68010__) || defined(__MC68010__)
205 #define SIMDE_ARCH_M68K 68010
206 #elif defined(__mc68000__) || defined(__MC68000__)
207 #define SIMDE_ARCH_M68K 68000
208 #endif
209 
210 /* Xilinx MicroBlaze
211  <https://en.wikipedia.org/wiki/MicroBlaze> */
212 #if defined(__MICROBLAZE__) || defined(__microblaze__)
213 #define SIMDE_ARCH_MICROBLAZE
214 #endif
215 
216 /* MIPS
217  <https://en.wikipedia.org/wiki/MIPS_architecture> */
218 #if defined(_MIPS_ISA_MIPS64R2)
219 #define SIMDE_ARCH_MIPS 642
220 #elif defined(_MIPS_ISA_MIPS64)
221 #define SIMDE_ARCH_MIPS 640
222 #elif defined(_MIPS_ISA_MIPS32R2)
223 #define SIMDE_ARCH_MIPS 322
224 #elif defined(_MIPS_ISA_MIPS32)
225 #define SIMDE_ARCH_MIPS 320
226 #elif defined(_MIPS_ISA_MIPS4)
227 #define SIMDE_ARCH_MIPS 4
228 #elif defined(_MIPS_ISA_MIPS3)
229 #define SIMDE_ARCH_MIPS 3
230 #elif defined(_MIPS_ISA_MIPS2)
231 #define SIMDE_ARCH_MIPS 2
232 #elif defined(_MIPS_ISA_MIPS1)
233 #define SIMDE_ARCH_MIPS 1
234 #elif defined(_MIPS_ISA_MIPS) || defined(__mips) || defined(__MIPS__)
235 #define SIMDE_ARCH_MIPS 1
236 #endif
237 
238 /* Matsushita MN10300
239  <https://en.wikipedia.org/wiki/MN103> */
240 #if defined(__MN10300__) || defined(__mn10300__)
241 #define SIMDE_ARCH_MN10300 1
242 #endif
243 
244 /* POWER
245  <https://en.wikipedia.org/wiki/IBM_POWER_Instruction_Set_Architecture> */
246 #if defined(_M_PPC)
247 #define SIMDE_ARCH_POWER _M_PPC
248 #elif defined(_ARCH_PWR8)
249 #define SIMDE_ARCH_POWER 800
250 #elif defined(_ARCH_PWR7)
251 #define SIMDE_ARCH_POWER 700
252 #elif defined(_ARCH_PWR6)
253 #define SIMDE_ARCH_POWER 600
254 #elif defined(_ARCH_PWR5)
255 #define SIMDE_ARCH_POWER 500
256 #elif defined(_ARCH_PWR4)
257 #define SIMDE_ARCH_POWER 400
258 #elif defined(_ARCH_440) || defined(__ppc440__)
259 #define SIMDE_ARCH_POWER 440
260 #elif defined(_ARCH_450) || defined(__ppc450__)
261 #define SIMDE_ARCH_POWER 450
262 #elif defined(_ARCH_601) || defined(__ppc601__)
263 #define SIMDE_ARCH_POWER 601
264 #elif defined(_ARCH_603) || defined(__ppc603__)
265 #define SIMDE_ARCH_POWER 603
266 #elif defined(_ARCH_604) || defined(__ppc604__)
267 #define SIMDE_ARCH_POWER 604
268 #elif defined(_ARCH_605) || defined(__ppc605__)
269 #define SIMDE_ARCH_POWER 605
270 #elif defined(_ARCH_620) || defined(__ppc620__)
271 #define SIMDE_ARCH_POWER 620
272 #elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || \
273  defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC) || \
274  defined(__ppc)
275 #define SIMDE_ARCH_POWER 1
276 #endif
277 
278 /* SPARC
279  <https://en.wikipedia.org/wiki/SPARC> */
280 #if defined(__sparc_v9__) || defined(__sparcv9)
281 #define SIMDE_ARCH_SPARC 9
282 #elif defined(__sparc_v8__) || defined(__sparcv8)
283 #define SIMDE_ARCH_SPARC 8
284 #elif defined(__sparc_v7__) || defined(__sparcv7)
285 #define SIMDE_ARCH_SPARC 7
286 #elif defined(__sparc_v6__) || defined(__sparcv6)
287 #define SIMDE_ARCH_SPARC 6
288 #elif defined(__sparc_v5__) || defined(__sparcv5)
289 #define SIMDE_ARCH_SPARC 5
290 #elif defined(__sparc_v4__) || defined(__sparcv4)
291 #define SIMDE_ARCH_SPARC 4
292 #elif defined(__sparc_v3__) || defined(__sparcv3)
293 #define SIMDE_ARCH_SPARC 3
294 #elif defined(__sparc_v2__) || defined(__sparcv2)
295 #define SIMDE_ARCH_SPARC 2
296 #elif defined(__sparc_v1__) || defined(__sparcv1)
297 #define SIMDE_ARCH_SPARC 1
298 #elif defined(__sparc__) || defined(__sparc)
299 #define SIMDE_ARCH_SPARC 1
300 #endif
301 
302 /* SuperH
303  <https://en.wikipedia.org/wiki/SuperH> */
304 #if defined(__sh5__) || defined(__SH5__)
305 #define SIMDE_ARCH_SUPERH 5
306 #elif defined(__sh4__) || defined(__SH4__)
307 #define SIMDE_ARCH_SUPERH 4
308 #elif defined(__sh3__) || defined(__SH3__)
309 #define SIMDE_ARCH_SUPERH 3
310 #elif defined(__sh2__) || defined(__SH2__)
311 #define SIMDE_ARCH_SUPERH 2
312 #elif defined(__sh1__) || defined(__SH1__)
313 #define SIMDE_ARCH_SUPERH 1
314 #elif defined(__sh__) || defined(__SH__)
315 #define SIMDE_ARCH_SUPERH 1
316 #endif
317 
318 /* IBM System z
319  <https://en.wikipedia.org/wiki/IBM_System_z> */
320 #if defined(__370__) || defined(__THW_370__) || defined(__s390__) || \
321  defined(__s390x__) || defined(__zarch__) || defined(__SYSC_ZARCH__)
322 #define SIMDE_ARCH_SYSTEMZ
323 #endif
324 
325 /* TMS320 DSP
326  <https://en.wikipedia.org/wiki/Texas_Instruments_TMS320> */
327 #if defined(_TMS320C6740) || defined(__TMS320C6740__)
328 #define SIMDE_ARCH_TMS320 6740
329 #elif defined(_TMS320C6700_PLUS) || defined(__TMS320C6700_PLUS__)
330 #define SIMDE_ARCH_TMS320 6701
331 #elif defined(_TMS320C6700) || defined(__TMS320C6700__)
332 #define SIMDE_ARCH_TMS320 6700
333 #elif defined(_TMS320C6600) || defined(__TMS320C6600__)
334 #define SIMDE_ARCH_TMS320 6600
335 #elif defined(_TMS320C6400_PLUS) || defined(__TMS320C6400_PLUS__)
336 #define SIMDE_ARCH_TMS320 6401
337 #elif defined(_TMS320C6400) || defined(__TMS320C6400__)
338 #define SIMDE_ARCH_TMS320 6400
339 #elif defined(_TMS320C6200) || defined(__TMS320C6200__)
340 #define SIMDE_ARCH_TMS320 6200
341 #elif defined(_TMS320C55X) || defined(__TMS320C55X__)
342 #define SIMDE_ARCH_TMS320 550
343 #elif defined(_TMS320C54X) || defined(__TMS320C54X__)
344 #define SIMDE_ARCH_TMS320 540
345 #elif defined(_TMS320C28X) || defined(__TMS320C28X__)
346 #define SIMDE_ARCH_TMS320 280
347 #endif
348 
349 /* Xtensa
350  <https://en.wikipedia.org/wiki/> */
351 #if defined(__xtensa__) || defined(__XTENSA__)
352 #define SIMDE_ARCH_XTENSA 1
353 #endif
354 
355 #endif /* !defined(SIMDE_ARCH_H) */