simde-features.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. /* SPDX-License-Identifier: MIT
  2. *
  3. * Permission is hereby granted, free of charge, to any person
  4. * obtaining a copy of this software and associated documentation
  5. * files (the "Software"), to deal in the Software without
  6. * restriction, including without limitation the rights to use, copy,
  7. * modify, merge, publish, distribute, sublicense, and/or sell copies
  8. * of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be
  12. * included in all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  18. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  19. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. *
  23. * Copyright:
  24. * 2020 Evan Nemerson <[email protected]>
  25. */
  26. /* simde-arch.h is used to determine which features are available according
  27. to the compiler. However, we want to make it possible to forcibly enable
  28. or disable APIs */
  29. #if !defined(SIMDE_FEATURES_H)
  30. #define SIMDE_FEATURES_H
  31. #include "simde-arch.h"
  32. #include "simde-diagnostic.h"
  33. #if !defined(SIMDE_X86_SVML_NATIVE) && !defined(SIMDE_X86_SVML_NO_NATIVE) && \
  34. !defined(SIMDE_NO_NATIVE)
  35. #if defined(SIMDE_ARCH_X86_SVML)
  36. #define SIMDE_X86_SVML_NATIVE
  37. #endif
  38. #endif
  39. #if defined(SIMDE_X86_SVML_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
  40. #define SIMDE_X86_AVX512F_NATIVE
  41. #endif
  42. #if !defined(SIMDE_X86_AVX512VP2INTERSECT_NATIVE) && \
  43. !defined(SIMDE_X86_AVX512VP2INTERSECT_NO_NATIVE) && \
  44. !defined(SIMDE_NO_NATIVE)
  45. #if defined(SIMDE_ARCH_X86_AVX512VP2INTERSECT)
  46. #define SIMDE_X86_AVX512VP2INTERSECT_NATIVE
  47. #endif
  48. #endif
  49. #if defined(SIMDE_X86_AVX512VP2INTERSECT_NATIVE) && \
  50. !defined(SIMDE_X86_AVX512F_NATIVE)
  51. #define SIMDE_X86_AVX512F_NATIVE
  52. #endif
  53. #if !defined(SIMDE_X86_AVX512VBMI_NATIVE) && \
  54. !defined(SIMDE_X86_AVX512VBMI_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  55. #if defined(SIMDE_ARCH_X86_AVX512VBMI)
  56. #define SIMDE_X86_AVX512VBMI_NATIVE
  57. #endif
  58. #endif
  59. #if defined(SIMDE_X86_AVX512VBMI_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
  60. #define SIMDE_X86_AVX512F_NATIVE
  61. #endif
  62. #if !defined(SIMDE_X86_AVX512CD_NATIVE) && \
  63. !defined(SIMDE_X86_AVX512CD_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  64. #if defined(SIMDE_ARCH_X86_AVX512CD)
  65. #define SIMDE_X86_AVX512CD_NATIVE
  66. #endif
  67. #endif
  68. #if defined(SIMDE_X86_AVX512CD_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
  69. #define SIMDE_X86_AVX512F_NATIVE
  70. #endif
  71. #if !defined(SIMDE_X86_AVX512DQ_NATIVE) && \
  72. !defined(SIMDE_X86_AVX512DQ_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  73. #if defined(SIMDE_ARCH_X86_AVX512DQ)
  74. #define SIMDE_X86_AVX512DQ_NATIVE
  75. #endif
  76. #endif
  77. #if defined(SIMDE_X86_AVX512DQ_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
  78. #define SIMDE_X86_AVX512F_NATIVE
  79. #endif
  80. #if !defined(SIMDE_X86_AVX512VL_NATIVE) && \
  81. !defined(SIMDE_X86_AVX512VL_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  82. #if defined(SIMDE_ARCH_X86_AVX512VL)
  83. #define SIMDE_X86_AVX512VL_NATIVE
  84. #endif
  85. #endif
  86. #if defined(SIMDE_X86_AVX512VL_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
  87. #define SIMDE_X86_AVX512F_NATIVE
  88. #endif
  89. #if !defined(SIMDE_X86_AVX512BW_NATIVE) && \
  90. !defined(SIMDE_X86_AVX512BW_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  91. #if defined(SIMDE_ARCH_X86_AVX512BW)
  92. #define SIMDE_X86_AVX512BW_NATIVE
  93. #endif
  94. #endif
  95. #if defined(SIMDE_X86_AVX512BW_NATIVE) && !defined(SIMDE_X86_AVX512F_NATIVE)
  96. #define SIMDE_X86_AVX512F_NATIVE
  97. #endif
  98. #if !defined(SIMDE_X86_AVX512F_NATIVE) && \
  99. !defined(SIMDE_X86_AVX512F_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  100. #if defined(SIMDE_ARCH_X86_AVX512F)
  101. #define SIMDE_X86_AVX512F_NATIVE
  102. #endif
  103. #endif
  104. #if defined(SIMDE_X86_AVX512F_NATIVE) && !defined(SIMDE_X86_AVX2_NATIVE)
  105. #define SIMDE_X86_AVX2_NATIVE
  106. #endif
  107. #if !defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_X86_FMA_NO_NATIVE) && \
  108. !defined(SIMDE_NO_NATIVE)
  109. #if defined(SIMDE_ARCH_X86_FMA)
  110. #define SIMDE_X86_FMA_NATIVE
  111. #endif
  112. #endif
  113. #if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_X86_AVX_NATIVE)
  114. #define SIMDE_X86_AVX_NATIVE
  115. #endif
  116. #if !defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_X86_AVX2_NO_NATIVE) && \
  117. !defined(SIMDE_NO_NATIVE)
  118. #if defined(SIMDE_ARCH_X86_AVX2)
  119. #define SIMDE_X86_AVX2_NATIVE
  120. #endif
  121. #endif
  122. #if defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_X86_AVX_NATIVE)
  123. #define SIMDE_X86_AVX_NATIVE
  124. #endif
  125. #if !defined(SIMDE_X86_AVX_NATIVE) && !defined(SIMDE_X86_AVX_NO_NATIVE) && \
  126. !defined(SIMDE_NO_NATIVE)
  127. #if defined(SIMDE_ARCH_X86_AVX)
  128. #define SIMDE_X86_AVX_NATIVE
  129. #endif
  130. #endif
  131. #if defined(SIMDE_X86_AVX_NATIVE) && !defined(SIMDE_X86_SSE4_1_NATIVE)
  132. #define SIMDE_X86_SSE4_2_NATIVE
  133. #endif
  134. #if !defined(SIMDE_X86_SSE4_2_NATIVE) && \
  135. !defined(SIMDE_X86_SSE4_2_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  136. #if defined(SIMDE_ARCH_X86_SSE4_2)
  137. #define SIMDE_X86_SSE4_2_NATIVE
  138. #endif
  139. #endif
  140. #if defined(SIMDE_X86_SSE4_2_NATIVE) && !defined(SIMDE_X86_SSE4_1_NATIVE)
  141. #define SIMDE_X86_SSE4_1_NATIVE
  142. #endif
  143. #if !defined(SIMDE_X86_SSE4_1_NATIVE) && \
  144. !defined(SIMDE_X86_SSE4_1_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  145. #if defined(SIMDE_ARCH_X86_SSE4_1)
  146. #define SIMDE_X86_SSE4_1_NATIVE
  147. #endif
  148. #endif
  149. #if defined(SIMDE_X86_SSE4_1_NATIVE) && !defined(SIMDE_X86_SSSE3_NATIVE)
  150. #define SIMDE_X86_SSSE3_NATIVE
  151. #endif
  152. #if !defined(SIMDE_X86_SSSE3_NATIVE) && !defined(SIMDE_X86_SSSE3_NO_NATIVE) && \
  153. !defined(SIMDE_NO_NATIVE)
  154. #if defined(SIMDE_ARCH_X86_SSSE3)
  155. #define SIMDE_X86_SSSE3_NATIVE
  156. #endif
  157. #endif
  158. #if defined(SIMDE_X86_SSSE3_NATIVE) && !defined(SIMDE_X86_SSE3_NATIVE)
  159. #define SIMDE_X86_SSE3_NATIVE
  160. #endif
  161. #if !defined(SIMDE_X86_SSE3_NATIVE) && !defined(SIMDE_X86_SSE3_NO_NATIVE) && \
  162. !defined(SIMDE_NO_NATIVE)
  163. #if defined(SIMDE_ARCH_X86_SSE3)
  164. #define SIMDE_X86_SSE3_NATIVE
  165. #endif
  166. #endif
  167. #if defined(SIMDE_X86_SSE3_NATIVE) && !defined(SIMDE_X86_SSE2_NATIVE)
  168. #define SIMDE_X86_SSE2_NATIVE
  169. #endif
  170. #if !defined(SIMDE_X86_SSE2_NATIVE) && !defined(SIMDE_X86_SSE2_NO_NATIVE) && \
  171. !defined(SIMDE_NO_NATIVE)
  172. #if defined(SIMDE_ARCH_X86_SSE2)
  173. #define SIMDE_X86_SSE2_NATIVE
  174. #endif
  175. #endif
  176. #if defined(SIMDE_X86_SSE2_NATIVE) && !defined(SIMDE_X86_SSE_NATIVE)
  177. #define SIMDE_X86_SSE_NATIVE
  178. #endif
  179. #if !defined(SIMDE_X86_SSE_NATIVE) && !defined(SIMDE_X86_SSE_NO_NATIVE) && \
  180. !defined(SIMDE_NO_NATIVE)
  181. #if defined(SIMDE_ARCH_X86_SSE)
  182. #define SIMDE_X86_SSE_NATIVE
  183. #endif
  184. #endif
  185. #if !defined(SIMDE_X86_MMX_NATIVE) && !defined(SIMDE_X86_MMX_NO_NATIVE) && \
  186. !defined(SIMDE_NO_NATIVE)
  187. #if defined(SIMDE_ARCH_X86_MMX)
  188. #define SIMDE_X86_MMX_NATIVE
  189. #endif
  190. #endif
  191. #if !defined(SIMDE_X86_GFNI_NATIVE) && !defined(SIMDE_X86_GFNI_NO_NATIVE) && \
  192. !defined(SIMDE_NO_NATIVE)
  193. #if defined(SIMDE_ARCH_X86_GFNI)
  194. #define SIMDE_X86_GFNI_NATIVE
  195. #endif
  196. #endif
  197. #if !defined(SIMDE_X86_PCLMUL_NATIVE) && \
  198. !defined(SIMDE_X86_PCLMUL_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  199. #if defined(SIMDE_ARCH_X86_PCLMUL)
  200. #define SIMDE_X86_PCLMUL_NATIVE
  201. #endif
  202. #endif
  203. #if !defined(SIMDE_X86_VPCLMULQDQ_NATIVE) && \
  204. !defined(SIMDE_X86_VPCLMULQDQ_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  205. #if defined(SIMDE_ARCH_X86_VPCLMULQDQ)
  206. #define SIMDE_X86_VPCLMULQDQ_NATIVE
  207. #endif
  208. #endif
  209. #if !defined(SIMDE_X86_SVML_NATIVE) && !defined(SIMDE_X86_SVML_NO_NATIVE) && \
  210. !defined(SIMDE_NO_NATIVE)
  211. #if defined(__INTEL_COMPILER)
  212. #define SIMDE_X86_SVML_NATIVE
  213. #endif
  214. #endif
  215. #if defined(HEDLEY_MSVC_VERSION)
  216. #pragma warning(push)
  217. #pragma warning(disable : 4799)
  218. #endif
  219. #if defined(SIMDE_X86_AVX_NATIVE) || defined(SIMDE_X86_GFNI_NATIVE)
  220. #include <immintrin.h>
  221. #elif defined(SIMDE_X86_SSE4_2_NATIVE)
  222. #include <nmmintrin.h>
  223. #elif defined(SIMDE_X86_SSE4_1_NATIVE)
  224. #include <smmintrin.h>
  225. #elif defined(SIMDE_X86_SSSE3_NATIVE)
  226. #include <tmmintrin.h>
  227. #elif defined(SIMDE_X86_SSE3_NATIVE)
  228. #include <pmmintrin.h>
  229. #elif defined(SIMDE_X86_SSE2_NATIVE)
  230. #include <emmintrin.h>
  231. #elif defined(SIMDE_X86_SSE_NATIVE)
  232. #include <xmmintrin.h>
  233. #elif defined(SIMDE_X86_MMX_NATIVE)
  234. #include <mmintrin.h>
  235. #endif
  236. #if defined(HEDLEY_MSVC_VERSION)
  237. #pragma warning(pop)
  238. #endif
  239. #if !defined(SIMDE_ARM_NEON_A64V8_NATIVE) && \
  240. !defined(SIMDE_ARM_NEON_A64V8_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  241. #if defined(SIMDE_ARCH_ARM_NEON) && defined(SIMDE_ARCH_AARCH64) && \
  242. SIMDE_ARCH_ARM_CHECK(80)
  243. #define SIMDE_ARM_NEON_A64V8_NATIVE
  244. #endif
  245. #endif
  246. #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && \
  247. !defined(SIMDE_ARM_NEON_A32V8_NATIVE)
  248. #define SIMDE_ARM_NEON_A32V8_NATIVE
  249. #endif
  250. #if !defined(SIMDE_ARM_NEON_A32V8_NATIVE) && \
  251. !defined(SIMDE_ARM_NEON_A32V8_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  252. #if defined(SIMDE_ARCH_ARM_NEON) && SIMDE_ARCH_ARM_CHECK(80) && \
  253. (__ARM_NEON_FP & 0x02)
  254. #define SIMDE_ARM_NEON_A32V8_NATIVE
  255. #endif
  256. #endif
  257. #if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && \
  258. !defined(SIMDE_ARM_NEON_A32V7_NATIVE)
  259. #define SIMDE_ARM_NEON_A32V7_NATIVE
  260. #endif
  261. #if !defined(SIMDE_ARM_NEON_A32V7_NATIVE) && \
  262. !defined(SIMDE_ARM_NEON_A32V7_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  263. #if defined(SIMDE_ARCH_ARM_NEON) && SIMDE_ARCH_ARM_CHECK(70)
  264. #define SIMDE_ARM_NEON_A32V7_NATIVE
  265. #endif
  266. #endif
  267. #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
  268. #include <arm_neon.h>
  269. #endif
  270. #if !defined(SIMDE_ARM_SVE_NATIVE) && !defined(SIMDE_ARM_SVE_NO_NATIVE) && \
  271. !defined(SIMDE_NO_NATIVE)
  272. #if defined(SIMDE_ARCH_ARM_SVE)
  273. #define SIMDE_ARM_SVE_NATIVE
  274. #include <arm_sve.h>
  275. #endif
  276. #endif
  277. #if !defined(SIMDE_WASM_SIMD128_NATIVE) && \
  278. !defined(SIMDE_WASM_SIMD128_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
  279. #if defined(SIMDE_ARCH_WASM_SIMD128)
  280. #define SIMDE_WASM_SIMD128_NATIVE
  281. #endif
  282. #endif
  283. #if defined(SIMDE_WASM_SIMD128_NATIVE)
  284. #if !defined(__wasm_unimplemented_simd128__)
  285. HEDLEY_DIAGNOSTIC_PUSH
  286. SIMDE_DIAGNOSTIC_DISABLE_RESERVED_ID_MACRO_
  287. #define __wasm_unimplemented_simd128__
  288. HEDLEY_DIAGNOSTIC_POP
  289. #endif
  290. #include <wasm_simd128.h>
  291. #endif
  292. #if !defined(SIMDE_POWER_ALTIVEC_P9_NATIVE) && \
  293. !defined(SIMDE_POWER_ALTIVEC_P9_NO_NATIVE) && \
  294. !defined(SIMDE_NO_NATIVE)
  295. #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(900)
  296. #define SIMDE_POWER_ALTIVEC_P9_NATIVE
  297. #endif
  298. #endif
  299. #if defined(SIMDE_POWER_ALTIVEC_P9_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P8)
  300. #define SIMDE_POWER_ALTIVEC_P8_NATIVE
  301. #endif
  302. #if !defined(SIMDE_POWER_ALTIVEC_P8_NATIVE) && \
  303. !defined(SIMDE_POWER_ALTIVEC_P8_NO_NATIVE) && \
  304. !defined(SIMDE_NO_NATIVE)
  305. #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(800)
  306. #define SIMDE_POWER_ALTIVEC_P8_NATIVE
  307. #endif
  308. #endif
  309. #if defined(SIMDE_POWER_ALTIVEC_P8_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P7)
  310. #define SIMDE_POWER_ALTIVEC_P7_NATIVE
  311. #endif
  312. #if !defined(SIMDE_POWER_ALTIVEC_P7_NATIVE) && \
  313. !defined(SIMDE_POWER_ALTIVEC_P7_NO_NATIVE) && \
  314. !defined(SIMDE_NO_NATIVE)
  315. #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(700)
  316. #define SIMDE_POWER_ALTIVEC_P7_NATIVE
  317. #endif
  318. #endif
  319. #if defined(SIMDE_POWER_ALTIVEC_P7_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P6)
  320. #define SIMDE_POWER_ALTIVEC_P6_NATIVE
  321. #endif
  322. #if !defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) && \
  323. !defined(SIMDE_POWER_ALTIVEC_P6_NO_NATIVE) && \
  324. !defined(SIMDE_NO_NATIVE)
  325. #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(600)
  326. #define SIMDE_POWER_ALTIVEC_P6_NATIVE
  327. #endif
  328. #endif
  329. #if defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) && !defined(SIMDE_POWER_ALTIVEC_P5)
  330. #define SIMDE_POWER_ALTIVEC_P5_NATIVE
  331. #endif
  332. #if !defined(SIMDE_POWER_ALTIVEC_P5_NATIVE) && \
  333. !defined(SIMDE_POWER_ALTIVEC_P5_NO_NATIVE) && \
  334. !defined(SIMDE_NO_NATIVE)
  335. #if SIMDE_ARCH_POWER_ALTIVEC_CHECK(500)
  336. #define SIMDE_POWER_ALTIVEC_P5_NATIVE
  337. #endif
  338. #endif
  339. #if defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
  340. /* AltiVec conflicts with lots of stuff. The bool keyword conflicts
  341. * with the bool keyword in C++ and the bool macro in C99+ (defined
  342. * in stdbool.h). The vector keyword conflicts with std::vector in
  343. * C++ if you are `using std;`.
  344. *
  345. * Luckily AltiVec allows you to use `__vector`/`__bool`/`__pixel`
  346. * instead, but altivec.h will unconditionally define
  347. * `vector`/`bool`/`pixel` so we need to work around that.
  348. *
  349. * Unfortunately this means that if your code uses AltiVec directly
  350. * it may break. If this is the case you'll want to define
  351. * `SIMDE_POWER_ALTIVEC_NO_UNDEF` before including SIMDe. Or, even
  352. * better, port your code to use the double-underscore versions. */
  353. #if defined(bool)
  354. #undef bool
  355. #endif
  356. #include <altivec.h>
  357. #if !defined(SIMDE_POWER_ALTIVEC_NO_UNDEF)
  358. #if defined(vector)
  359. #undef vector
  360. #endif
  361. #if defined(pixel)
  362. #undef pixel
  363. #endif
  364. #if defined(bool)
  365. #undef bool
  366. #endif
  367. #endif /* !defined(SIMDE_POWER_ALTIVEC_NO_UNDEF) */
  368. /* Use these intsead of vector/pixel/bool in SIMDe. */
  369. #define SIMDE_POWER_ALTIVEC_VECTOR(T) __vector T
  370. #define SIMDE_POWER_ALTIVEC_PIXEL __pixel
  371. #define SIMDE_POWER_ALTIVEC_BOOL __bool
  372. /* Re-define bool if we're using stdbool.h */
  373. #if !defined(__cplusplus) && defined(__bool_true_false_are_defined) && \
  374. !defined(SIMDE_POWER_ALTIVEC_NO_UNDEF)
  375. #define bool _Bool
  376. #endif
  377. #endif
  378. #if !defined(SIMDE_MIPS_LOONGSON_MMI_NATIVE) && \
  379. !defined(SIMDE_MIPS_LOONGSON_MMI_NO_NATIVE) && \
  380. !defined(SIMDE_NO_NATIVE)
  381. #if defined(SIMDE_ARCH_MIPS_LOONGSON_MMI)
  382. #define SIMDE_MIPS_LOONGSON_MMI_NATIVE 1
  383. #endif
  384. #endif
  385. #if defined(SIMDE_MIPS_LOONGSON_MMI_NATIVE)
  386. #include <loongson-mmiintrin.h>
  387. #endif
  388. /* This is used to determine whether or not to fall back on a vector
  389. * function in an earlier ISA extensions, as well as whether
  390. * we expected any attempts at vectorization to be fruitful or if we
  391. * expect to always be running serial code. */
  392. #if !defined(SIMDE_NATURAL_VECTOR_SIZE)
  393. #if defined(SIMDE_X86_AVX512F_NATIVE)
  394. #define SIMDE_NATURAL_VECTOR_SIZE (512)
  395. #elif defined(SIMDE_X86_AVX_NATIVE)
  396. #define SIMDE_NATURAL_VECTOR_SIZE (256)
  397. #elif defined(SIMDE_X86_SSE_NATIVE) || defined(SIMDE_ARM_NEON_A32V7_NATIVE) || \
  398. defined(SIMDE_WASM_SIMD128_NATIVE) || \
  399. defined(SIMDE_POWER_ALTIVEC_P5_NATIVE)
  400. #define SIMDE_NATURAL_VECTOR_SIZE (128)
  401. #endif
  402. #if !defined(SIMDE_NATURAL_VECTOR_SIZE)
  403. #define SIMDE_NATURAL_VECTOR_SIZE (0)
  404. #endif
  405. #endif
  406. #define SIMDE_NATURAL_VECTOR_SIZE_LE(x) \
  407. ((SIMDE_NATURAL_VECTOR_SIZE > 0) && (SIMDE_NATURAL_VECTOR_SIZE <= (x)))
  408. #define SIMDE_NATURAL_VECTOR_SIZE_GE(x) \
  409. ((SIMDE_NATURAL_VECTOR_SIZE > 0) && (SIMDE_NATURAL_VECTOR_SIZE >= (x)))
  410. /* Native aliases */
  411. #if defined(SIMDE_ENABLE_NATIVE_ALIASES)
  412. #if !defined(SIMDE_X86_MMX_NATIVE)
  413. #define SIMDE_X86_MMX_ENABLE_NATIVE_ALIASES
  414. #endif
  415. #if !defined(SIMDE_X86_SSE_NATIVE)
  416. #define SIMDE_X86_SSE_ENABLE_NATIVE_ALIASES
  417. #endif
  418. #if !defined(SIMDE_X86_SSE2_NATIVE)
  419. #define SIMDE_X86_SSE2_ENABLE_NATIVE_ALIASES
  420. #endif
  421. #if !defined(SIMDE_X86_SSE3_NATIVE)
  422. #define SIMDE_X86_SSE3_ENABLE_NATIVE_ALIASES
  423. #endif
  424. #if !defined(SIMDE_X86_SSSE3_NATIVE)
  425. #define SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES
  426. #endif
  427. #if !defined(SIMDE_X86_SSE4_1_NATIVE)
  428. #define SIMDE_X86_SSE4_1_ENABLE_NATIVE_ALIASES
  429. #endif
  430. #if !defined(SIMDE_X86_SSE4_2_NATIVE)
  431. #define SIMDE_X86_SSE4_2_ENABLE_NATIVE_ALIASES
  432. #endif
  433. #if !defined(SIMDE_X86_AVX_NATIVE)
  434. #define SIMDE_X86_AVX_ENABLE_NATIVE_ALIASES
  435. #endif
  436. #if !defined(SIMDE_X86_AVX2_NATIVE)
  437. #define SIMDE_X86_AVX2_ENABLE_NATIVE_ALIASES
  438. #endif
  439. #if !defined(SIMDE_X86_FMA_NATIVE)
  440. #define SIMDE_X86_FMA_ENABLE_NATIVE_ALIASES
  441. #endif
  442. #if !defined(SIMDE_X86_AVX512F_NATIVE)
  443. #define SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES
  444. #endif
  445. #if !defined(SIMDE_X86_AVX512VL_NATIVE)
  446. #define SIMDE_X86_AVX512VL_ENABLE_NATIVE_ALIASES
  447. #endif
  448. #if !defined(SIMDE_X86_AVX512BW_NATIVE)
  449. #define SIMDE_X86_AVX512BW_ENABLE_NATIVE_ALIASES
  450. #endif
  451. #if !defined(SIMDE_X86_AVX512DQ_NATIVE)
  452. #define SIMDE_X86_AVX512DQ_ENABLE_NATIVE_ALIASES
  453. #endif
  454. #if !defined(SIMDE_X86_AVX512CD_NATIVE)
  455. #define SIMDE_X86_AVX512CD_ENABLE_NATIVE_ALIASES
  456. #endif
  457. #if !defined(SIMDE_X86_GFNI_NATIVE)
  458. #define SIMDE_X86_GFNI_ENABLE_NATIVE_ALIASES
  459. #endif
  460. #if !defined(SIMDE_X86_PCLMUL_NATIVE)
  461. #define SIMDE_X86_PCLMUL_ENABLE_NATIVE_ALIASES
  462. #endif
  463. #if !defined(SIMDE_X86_VPCLMULQDQ_NATIVE)
  464. #define SIMDE_X86_VPCLMULQDQ_ENABLE_NATIVE_ALIASES
  465. #endif
  466. #if !defined(SIMDE_ARM_NEON_A32V7_NATIVE)
  467. #define SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES
  468. #endif
  469. #if !defined(SIMDE_ARM_NEON_A32V8_NATIVE)
  470. #define SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES
  471. #endif
  472. #if !defined(SIMDE_ARM_NEON_A64V8_NATIVE)
  473. #define SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES
  474. #endif
  475. #endif
  476. /* Are floating point values stored using IEEE 754? Knowing
  477. * this at during preprocessing is a bit tricky, mostly because what
  478. * we're curious about is how values are stored and not whether the
  479. * implementation is fully conformant in terms of rounding, NaN
  480. * handling, etc.
  481. *
  482. * For example, if you use -ffast-math or -Ofast on
  483. * GCC or clang IEEE 754 isn't strictly followed, therefore IEE 754
  484. * support is not advertised (by defining __STDC_IEC_559__).
  485. *
  486. * However, what we care about is whether it is safe to assume that
  487. * floating point values are stored in IEEE 754 format, in which case
  488. * we can provide faster implementations of some functions.
  489. *
  490. * Luckily every vaugely modern architecture I'm aware of uses IEEE 754-
  491. * so we just assume IEEE 754 for now. There is a test which verifies
  492. * this, if that test fails sowewhere please let us know and we'll add
  493. * an exception for that platform. Meanwhile, you can define
  494. * SIMDE_NO_IEEE754_STORAGE. */
  495. #if !defined(SIMDE_IEEE754_STORAGE) && !defined(SIMDE_NO_IEE754_STORAGE)
  496. #define SIMDE_IEEE754_STORAGE
  497. #endif
  498. #endif /* !defined(SIMDE_FEATURES_H) */