react-native-executorch 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/lib/module/fetcher/telemetry.js +1 -1
  2. package/package.json +1 -1
  3. package/react-native-executorch.podspec +2 -0
  4. package/src/fetcher/telemetry.ts +1 -1
  5. package/third-party/common/phonemis/CMakeLists.txt +70 -14
  6. package/third-party/common/phonemis/README.md +183 -33
  7. package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
  8. package/third-party/common/phonemis/knowledge/code_style.md +642 -0
  9. package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
  10. package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
  11. package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
  12. package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
  13. package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
  14. package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
  15. package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
  16. package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
  17. package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
  18. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
  19. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
  20. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
  21. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
  22. package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
  23. package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
  24. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
  25. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
  26. package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
  27. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
  28. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
  29. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
  30. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
  31. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
  32. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
  33. package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
  34. package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
  35. package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
  36. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
  37. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
  38. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
  39. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
  40. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
  41. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
  42. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
  43. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
  44. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
  45. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
  46. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
  47. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
  48. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
  49. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
  50. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
  51. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
  52. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
  53. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
  54. package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
  55. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
  56. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
  57. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
  58. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
  59. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
  60. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
  61. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
  62. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
  63. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
  64. package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
  65. package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
  66. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
  67. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
  68. package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
  69. package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
  70. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
  71. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
  72. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
  73. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
  74. package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
  75. package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
  76. package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
  77. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
  78. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
  79. package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
  80. package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
  81. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
  82. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
  83. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
  84. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
  85. package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
  86. package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
  87. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
  88. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
  89. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
  90. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
  91. package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
  92. package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
  93. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
  94. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
  95. package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
  96. package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
  97. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
  98. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
  99. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
  100. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
  101. package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
  102. package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
  103. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
  104. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
  105. package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
  106. package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
  107. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
  108. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
  109. package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
  110. package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
  111. package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
  112. package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
  113. package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
  114. package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
  115. package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
  116. package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
  117. package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
  118. package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
  119. package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
  120. package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
  121. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
  122. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
  123. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
  124. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
  125. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
  126. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
  127. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
  128. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
  129. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
  130. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
  131. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
  132. package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
  133. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
  134. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
  135. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
  136. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
  137. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
  138. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
  139. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
  140. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
  141. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
  142. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
  143. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
  144. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
  145. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
  146. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
  147. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
  148. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
  149. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
  150. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
  151. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
  152. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
  153. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
  154. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
  155. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
  156. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
  157. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
  158. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
  159. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
  160. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
  161. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
  162. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
  163. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
  164. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
  165. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
  166. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
  167. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
  168. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
  169. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
  170. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
  171. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
  172. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
  173. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
  174. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
  175. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
  176. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
  177. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
  178. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
  179. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
  180. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
  181. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
  182. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
  183. package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
  184. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
  185. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
  186. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
  187. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
  188. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
  189. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
  190. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
  191. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
  192. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
  193. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
  194. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
  195. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
  196. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
  197. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
  198. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
  199. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
  200. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
  201. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
  202. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
  203. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
  204. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
  205. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
  206. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
  207. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
  208. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
  209. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
  210. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
  211. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
  212. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
  213. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
  214. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
  215. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
  216. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
  217. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
  218. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
  219. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
  220. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
  221. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
  222. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
  223. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
  224. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
  225. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
  226. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
  227. package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
  228. package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
  229. package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
  230. package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
  231. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
  232. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
  233. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
  234. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
  235. package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
  236. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
  237. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
@@ -0,0 +1,1666 @@
1
+ /***************************************************************************
2
+ * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3
+ * Martin Renou *
4
+ * Copyright (c) QuantStack *
5
+ * Copyright (c) Serge Guelton *
6
+ * *
7
+ * Distributed under the terms of the BSD 3-Clause License. *
8
+ * *
9
+ * The full license is in the file LICENSE, distributed with this software. *
10
+ ****************************************************************************/
11
+
12
+ #ifndef XSIMD_BATCH_HPP
13
+ #define XSIMD_BATCH_HPP
14
+
15
+ #include <cassert>
16
+ #include <complex>
17
+
18
+ #include "../config/xsimd_arch.hpp"
19
+ #include "../config/xsimd_config.hpp"
20
+ #include "../config/xsimd_macros.hpp"
21
+ #include "../memory/xsimd_alignment.hpp"
22
+ #include "./xsimd_batch_fwd.hpp"
23
+ #include "./xsimd_utils.hpp"
24
+
25
+ namespace xsimd
26
+ {
27
+ namespace types
28
+ {
29
+ template <class T, class A>
30
+ struct integral_only_operators
31
+ {
32
+ XSIMD_INLINE batch<T, A>& operator%=(batch<T, A> const& other) noexcept;
33
+ XSIMD_INLINE batch<T, A>& operator>>=(int32_t other) noexcept;
34
+ XSIMD_INLINE batch<T, A>& operator>>=(batch<T, A> const& other) noexcept;
35
+ XSIMD_INLINE batch<T, A>& operator<<=(int32_t other) noexcept;
36
+ XSIMD_INLINE batch<T, A>& operator<<=(batch<T, A> const& other) noexcept;
37
+
38
+ /** Shorthand for xsimd::mod() */
39
+ friend XSIMD_INLINE batch<T, A> operator%(batch<T, A> const& self, batch<T, A> const& other) noexcept
40
+ {
41
+ return batch<T, A>(self) %= other;
42
+ }
43
+
44
+ /** Shorthand for xsimd::bitwise_rshift() */
45
+ friend XSIMD_INLINE batch<T, A> operator>>(batch<T, A> const& self, batch<T, A> const& other) noexcept
46
+ {
47
+ return batch<T, A>(self) >>= other;
48
+ }
49
+
50
+ /** Shorthand for xsimd::bitwise_lshift() */
51
+ friend XSIMD_INLINE batch<T, A> operator<<(batch<T, A> const& self, batch<T, A> const& other) noexcept
52
+ {
53
+ return batch<T, A>(self) <<= other;
54
+ }
55
+
56
+ /** Shorthand for xsimd::bitwise_rshift() */
57
+ friend XSIMD_INLINE batch<T, A> operator>>(batch<T, A> const& self, int32_t other) noexcept
58
+ {
59
+ return batch<T, A>(self) >>= other;
60
+ }
61
+
62
+ /** Shorthand for xsimd::bitwise_lshift() */
63
+ friend XSIMD_INLINE batch<T, A> operator<<(batch<T, A> const& self, int32_t other) noexcept
64
+ {
65
+ return batch<T, A>(self) <<= other;
66
+ }
67
+ };
68
+ template <class A>
69
+ struct integral_only_operators<float, A>
70
+ {
71
+ };
72
+ template <class A>
73
+ struct integral_only_operators<double, A>
74
+ {
75
+ };
76
+
77
+ }
78
+
79
+ namespace details
80
+ {
81
+ // These functions are forwarded declared here so that they can be used by friend functions
82
+ // with batch<T, A>. Their implementation must appear only once the
83
+ // kernel implementations have been included.
84
+ template <class T, class A>
85
+ XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other) noexcept;
86
+
87
+ template <class T, class A>
88
+ XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other) noexcept;
89
+
90
+ template <class T, class A>
91
+ XSIMD_INLINE batch_bool<T, A> ge(batch<T, A> const& self, batch<T, A> const& other) noexcept;
92
+
93
+ template <class T, class A>
94
+ XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other) noexcept;
95
+
96
+ template <class T, class A>
97
+ XSIMD_INLINE batch_bool<T, A> gt(batch<T, A> const& self, batch<T, A> const& other) noexcept;
98
+
99
+ template <class T, class A>
100
+ XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& self, batch<T, A> const& other) noexcept;
101
+ }
102
+
103
+ /**
104
+ * @brief batch of integer or floating point values.
105
+ *
106
+ * Abstract representation of an SIMD register for floating point or integral
107
+ * value.
108
+ *
109
+ * @tparam T the type of the underlying values.
110
+ * @tparam A the architecture this batch is tied too.
111
+ **/
112
+ template <class T, class A>
113
+ class batch : public types::simd_register<T, A>, public types::integral_only_operators<T, A>
114
+ {
115
+ static_assert(!std::is_same<T, bool>::value, "use xsimd::batch_bool<T, A> instead of xsimd::batch<bool, A>");
116
+
117
+ public:
118
+ static constexpr std::size_t size = sizeof(types::simd_register<T, A>) / sizeof(T); ///< Number of scalar elements in this batch.
119
+
120
+ using value_type = T; ///< Type of the scalar elements within this batch.
121
+ using arch_type = A; ///< SIMD Architecture abstracted by this batch.
122
+ using register_type = typename types::simd_register<T, A>::register_type; ///< SIMD register type abstracted by this batch.
123
+ using batch_bool_type = batch_bool<T, A>; ///< Associated batch type used to represented logical operations on this batch.
124
+
125
+ // constructors
126
+ XSIMD_INLINE batch() = default; ///< Create a batch initialized with undefined values.
127
+ XSIMD_INLINE batch(T val) noexcept;
128
+ template <class... Ts>
129
+ XSIMD_INLINE batch(T val0, T val1, Ts... vals) noexcept;
130
+ XSIMD_INLINE explicit batch(batch_bool_type const& b) noexcept;
131
+ XSIMD_INLINE batch(register_type reg) noexcept;
132
+
133
+ template <class U>
134
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch broadcast(U val) noexcept;
135
+
136
+ // memory operators
137
+ template <class U>
138
+ XSIMD_INLINE void store_aligned(U* mem) const noexcept;
139
+ template <class U>
140
+ XSIMD_INLINE void store_unaligned(U* mem) const noexcept;
141
+ template <class U>
142
+ XSIMD_INLINE void store(U* mem, aligned_mode) const noexcept;
143
+ template <class U>
144
+ XSIMD_INLINE void store(U* mem, unaligned_mode) const noexcept;
145
+ template <class U>
146
+ XSIMD_INLINE void store(U* mem, stream_mode) const noexcept;
147
+
148
+ // Compile-time mask overloads
149
+ template <class U, bool... Values, class Mode = aligned_mode>
150
+ XSIMD_INLINE void store(U* mem, batch_bool_constant<T, A, Values...> mask, Mode) const noexcept;
151
+
152
+ template <class U>
153
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_aligned(U const* mem) noexcept;
154
+ template <class U>
155
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_unaligned(U const* mem) noexcept;
156
+ template <class U>
157
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, aligned_mode) noexcept;
158
+ template <class U>
159
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, unaligned_mode) noexcept;
160
+ // Compile-time mask overloads
161
+ template <class U, bool... Values, class Mode = aligned_mode>
162
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, batch_bool_constant<T, A, Values...> mask, Mode = {}) noexcept;
163
+ template <class U>
164
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, stream_mode) noexcept;
165
+
166
+ template <class U, class V>
167
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch gather(U const* src, batch<V, arch_type> const& index) noexcept;
168
+ template <class U, class V>
169
+ XSIMD_INLINE void scatter(U* dst, batch<V, arch_type> const& index) const noexcept;
170
+
171
+ XSIMD_INLINE T get(std::size_t i) const noexcept;
172
+
173
+ XSIMD_INLINE T first() const noexcept;
174
+
175
+ // comparison operators. Defined as friend to enable automatic
176
+ // conversion of parameters from scalar to batch, at the cost of using a
177
+ // proxy implementation from details::.
178
+ friend XSIMD_INLINE batch_bool<T, A> operator==(batch const& self, batch const& other) noexcept
179
+ {
180
+ return details::eq<T, A>(self, other);
181
+ }
182
+ friend XSIMD_INLINE batch_bool<T, A> operator!=(batch const& self, batch const& other) noexcept
183
+ {
184
+ return details::neq<T, A>(self, other);
185
+ }
186
+ friend XSIMD_INLINE batch_bool<T, A> operator>=(batch const& self, batch const& other) noexcept
187
+ {
188
+ return details::ge<T, A>(self, other);
189
+ }
190
+ friend XSIMD_INLINE batch_bool<T, A> operator<=(batch const& self, batch const& other) noexcept
191
+ {
192
+ return details::le<T, A>(self, other);
193
+ }
194
+ friend XSIMD_INLINE batch_bool<T, A> operator>(batch const& self, batch const& other) noexcept
195
+ {
196
+ return details::gt<T, A>(self, other);
197
+ }
198
+ friend XSIMD_INLINE batch_bool<T, A> operator<(batch const& self, batch const& other) noexcept
199
+ {
200
+ return details::lt<T, A>(self, other);
201
+ }
202
+
203
+ // Update operators
204
+ XSIMD_INLINE batch& operator+=(batch const& other) noexcept;
205
+ XSIMD_INLINE batch& operator-=(batch const& other) noexcept;
206
+ XSIMD_INLINE batch& operator*=(batch const& other) noexcept;
207
+ XSIMD_INLINE batch& operator/=(batch const& other) noexcept;
208
+ XSIMD_INLINE batch& operator&=(batch const& other) noexcept;
209
+ XSIMD_INLINE batch& operator|=(batch const& other) noexcept;
210
+ XSIMD_INLINE batch& operator^=(batch const& other) noexcept;
211
+
212
+ // incr/decr operators
213
+ XSIMD_INLINE batch& operator++() noexcept;
214
+ XSIMD_INLINE batch& operator--() noexcept;
215
+ XSIMD_INLINE batch operator++(int) noexcept;
216
+ XSIMD_INLINE batch operator--(int) noexcept;
217
+
218
+ // unary operators
219
+ XSIMD_INLINE batch_bool_type operator!() const noexcept;
220
+ XSIMD_INLINE batch operator~() const noexcept;
221
+ XSIMD_INLINE batch operator-() const noexcept;
222
+ XSIMD_INLINE batch operator+() const noexcept;
223
+
224
+ // arithmetic operators. They are defined as friend to enable automatic
225
+ // conversion of parameters from scalar to batch. Inline implementation
226
+ // is required to avoid warnings.
227
+
228
+ /** Shorthand for xsimd::add() */
229
+ friend XSIMD_INLINE batch operator+(batch const& self, batch const& other) noexcept
230
+ {
231
+ return batch(self) += other;
232
+ }
233
+
234
+ /** Shorthand for xsimd::sub() */
235
+ friend XSIMD_INLINE batch operator-(batch const& self, batch const& other) noexcept
236
+ {
237
+ return batch(self) -= other;
238
+ }
239
+
240
+ /** Shorthand for xsimd::mul() */
241
+ friend XSIMD_INLINE batch operator*(batch const& self, batch const& other) noexcept
242
+ {
243
+ return batch(self) *= other;
244
+ }
245
+
246
+ /** Shorthand for xsimd::div() */
247
+ friend XSIMD_INLINE batch operator/(batch const& self, batch const& other) noexcept
248
+ {
249
+ return batch(self) /= other;
250
+ }
251
+
252
+ /** Shorthand for xsimd::bitwise_and() */
253
+ friend XSIMD_INLINE batch operator&(batch const& self, batch const& other) noexcept
254
+ {
255
+ return batch(self) &= other;
256
+ }
257
+
258
+ /** Shorthand for xsimd::bitwise_or() */
259
+ friend XSIMD_INLINE batch operator|(batch const& self, batch const& other) noexcept
260
+ {
261
+ return batch(self) |= other;
262
+ }
263
+
264
+ /** Shorthand for xsimd::bitwise_xor() */
265
+ friend XSIMD_INLINE batch operator^(batch const& self, batch const& other) noexcept
266
+ {
267
+ return batch(self) ^= other;
268
+ }
269
+
270
+ /** Shorthand for xsimd::logical_and() */
271
+ friend XSIMD_INLINE batch operator&&(batch const& self, batch const& other) noexcept
272
+ {
273
+ return batch(self).logical_and(other);
274
+ }
275
+
276
+ /** Shorthand for xsimd::logical_or() */
277
+ friend XSIMD_INLINE batch operator||(batch const& self, batch const& other) noexcept
278
+ {
279
+ return batch(self).logical_or(other);
280
+ }
281
+
282
+ private:
283
+ XSIMD_INLINE batch logical_and(batch const& other) const noexcept;
284
+ XSIMD_INLINE batch logical_or(batch const& other) const noexcept;
285
+ };
286
+
287
+ #if XSIMD_CPP_VERSION < 201703L
288
+ template <class T, class A>
289
+ constexpr std::size_t batch<T, A>::size;
290
+ #endif
291
+
292
+ /**
293
+ * @brief batch of predicate over scalar or complex values.
294
+ *
295
+ * Abstract representation of a predicate over SIMD register for scalar or
296
+ * complex values.
297
+ *
298
+ * @tparam T the type of the predicated values.
299
+ * @tparam A the architecture this batch is tied too.
300
+ **/
301
+ template <class T, class A>
302
+ class batch_bool : public types::get_bool_simd_register_t<T, A>
303
+ {
304
+ using base_type = types::get_bool_simd_register_t<T, A>;
305
+
306
+ public:
307
+ static constexpr std::size_t size = sizeof(types::simd_register<T, A>) / sizeof(T); ///< Number of scalar elements in this batch.
308
+
309
+ using value_type = bool; ///< Type of the scalar elements within this batch.
310
+ using operand_type = T;
311
+ using arch_type = A; ///< SIMD Architecture abstracted by this batch.
312
+ using register_type = typename base_type::register_type; ///< SIMD register type abstracted by this batch.
313
+ using batch_type = batch<T, A>; ///< Associated batch type this batch represents logical operations for.
314
+
315
+ // constructors
316
+ XSIMD_INLINE batch_bool() = default; ///< Create a batch initialized with undefined values.
317
+ XSIMD_INLINE batch_bool(bool val) noexcept;
318
+ XSIMD_INLINE batch_bool(register_type reg) noexcept;
319
+ template <class... Ts>
320
+ XSIMD_INLINE batch_bool(bool val0, bool val1, Ts... vals) noexcept;
321
+
322
+ template <class Tp>
323
+ XSIMD_INLINE batch_bool(Tp const*) = delete;
324
+
325
+ // memory operators
326
+ XSIMD_INLINE void store_aligned(bool* mem) const noexcept;
327
+ XSIMD_INLINE void store_unaligned(bool* mem) const noexcept;
328
+ XSIMD_INLINE void store_stream(bool* mem) const noexcept;
329
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch_bool load_aligned(bool const* mem) noexcept;
330
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch_bool load_unaligned(bool const* mem) noexcept;
331
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch_bool load_stream(bool const* mem) noexcept;
332
+
333
+ XSIMD_INLINE bool get(std::size_t i) const noexcept;
334
+
335
+ XSIMD_INLINE bool first() const noexcept;
336
+
337
+ // mask operations
338
+ XSIMD_INLINE uint64_t mask() const noexcept;
339
+ XSIMD_INLINE static batch_bool from_mask(uint64_t mask) noexcept;
340
+
341
+ // comparison operators
342
+ XSIMD_INLINE batch_bool operator==(batch_bool const& other) const noexcept;
343
+ XSIMD_INLINE batch_bool operator!=(batch_bool const& other) const noexcept;
344
+
345
+ // logical operators
346
+ XSIMD_INLINE batch_bool operator~() const noexcept;
347
+ XSIMD_INLINE batch_bool operator!() const noexcept;
348
+ XSIMD_INLINE batch_bool operator&(batch_bool const& other) const noexcept;
349
+ XSIMD_INLINE batch_bool operator|(batch_bool const& other) const noexcept;
350
+ XSIMD_INLINE batch_bool operator^(batch_bool const& other) const noexcept;
351
+ XSIMD_INLINE batch_bool operator&&(batch_bool const& other) const noexcept;
352
+ XSIMD_INLINE batch_bool operator||(batch_bool const& other) const noexcept;
353
+
354
+ // update operators
355
+ XSIMD_INLINE batch_bool& operator&=(batch_bool const& other) noexcept { return (*this) = (*this) & other; }
356
+ XSIMD_INLINE batch_bool& operator|=(batch_bool const& other) noexcept { return (*this) = (*this) | other; }
357
+ XSIMD_INLINE batch_bool& operator^=(batch_bool const& other) noexcept { return (*this) = (*this) ^ other; }
358
+
359
+ private:
360
+ template <class U, class... V, size_t I, size_t... Is>
361
+ static XSIMD_INLINE register_type make_register(std::index_sequence<I, Is...>, U u, V... v) noexcept;
362
+
363
+ template <class... V>
364
+ static XSIMD_INLINE register_type make_register(std::index_sequence<>, V... v) noexcept;
365
+ };
366
+
367
+ #if XSIMD_CPP_VERSION < 201703L
368
+ template <class T, class A>
369
+ constexpr std::size_t batch_bool<T, A>::size;
370
+ #endif
371
+
372
+ /**
373
+ * @brief batch of complex values.
374
+ *
375
+ * Abstract representation of an SIMD register for complex values.
376
+ *
377
+ * @tparam T the type of the underlying values.
378
+ * @tparam A the architecture this batch is tied too.
379
+ **/
380
+ template <class T, class A>
381
+ class batch<std::complex<T>, A>
382
+ {
383
+ public:
384
+ using value_type = std::complex<T>; ///< Type of the complex elements within this batch.
385
+ using real_batch = batch<T, A>; ///< Type of the scalar elements within this batch.
386
+ using arch_type = A; ///< SIMD Architecture abstracted by this batch.
387
+ using batch_bool_type = batch_bool<T, A>; ///< Associated batch type used to represented logical operations on this batch.
388
+
389
+ static constexpr std::size_t size = real_batch::size; ///< Number of complex elements in this batch.
390
+
391
+ // constructors
392
+ XSIMD_INLINE batch() = default; ///< Create a batch initialized with undefined values.
393
+ XSIMD_INLINE batch(value_type const& val) noexcept;
394
+ XSIMD_INLINE batch(real_batch const& real, real_batch const& imag) noexcept;
395
+
396
+ XSIMD_INLINE batch(real_batch const& real) noexcept;
397
+ XSIMD_INLINE batch(T val) noexcept;
398
+ template <class... Ts>
399
+ XSIMD_INLINE batch(value_type val0, value_type val1, Ts... vals) noexcept;
400
+ XSIMD_INLINE explicit batch(batch_bool_type const& b) noexcept;
401
+
402
+ template <class U>
403
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch broadcast(U val) noexcept;
404
+
405
+ // memory operators
406
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_aligned(const T* real_src, const T* imag_src = nullptr) noexcept;
407
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_unaligned(const T* real_src, const T* imag_src = nullptr) noexcept;
408
+ XSIMD_INLINE void store_aligned(T* real_dst, T* imag_dst) const noexcept;
409
+ XSIMD_INLINE void store_unaligned(T* real_dst, T* imag_dst) const noexcept;
410
+
411
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_aligned(const value_type* src) noexcept;
412
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_unaligned(const value_type* src) noexcept;
413
+ XSIMD_INLINE void store_aligned(value_type* dst) const noexcept;
414
+ XSIMD_INLINE void store_unaligned(value_type* dst) const noexcept;
415
+
416
+ template <class U>
417
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, aligned_mode) noexcept;
418
+ template <class U>
419
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, unaligned_mode) noexcept;
420
+ // Compile-time mask overloads
421
+ template <class U, bool... Values, class Mode = aligned_mode>
422
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, batch_bool_constant<value_type, A, Values...> mask, Mode = {}) noexcept;
423
+ template <class U>
424
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load(U const* mem, stream_mode) noexcept;
425
+ template <class U>
426
+ XSIMD_INLINE void store(U* mem, aligned_mode) const noexcept;
427
+ template <class U>
428
+ XSIMD_INLINE void store(U* mem, unaligned_mode) const noexcept;
429
+ // Compile-time mask overloads
430
+ template <class U, bool... Values, class Mode = aligned_mode>
431
+ XSIMD_INLINE void store(U* mem, batch_bool_constant<value_type, A, Values...> mask, Mode = {}) const noexcept;
432
+ template <class U>
433
+ XSIMD_INLINE void store(U* mem, stream_mode) const noexcept;
434
+
435
+ XSIMD_INLINE real_batch real() const noexcept;
436
+ XSIMD_INLINE real_batch imag() const noexcept;
437
+
438
+ XSIMD_INLINE value_type get(std::size_t i) const noexcept;
439
+
440
+ XSIMD_INLINE value_type first() const noexcept;
441
+
442
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
443
+ // xtl-related methods
444
+ template <bool i3ec>
445
+ XSIMD_INLINE batch(xtl::xcomplex<T, T, i3ec> const& val) noexcept;
446
+ template <bool i3ec, class... Ts>
447
+ XSIMD_INLINE batch(xtl::xcomplex<T, T, i3ec> val0, xtl::xcomplex<T, T, i3ec> val1, Ts... vals) noexcept;
448
+
449
+ template <bool i3ec>
450
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_aligned(const xtl::xcomplex<T, T, i3ec>* src) noexcept;
451
+ template <bool i3ec>
452
+ XSIMD_NO_DISCARD static XSIMD_INLINE batch load_unaligned(const xtl::xcomplex<T, T, i3ec>* src) noexcept;
453
+ template <bool i3ec>
454
+ XSIMD_INLINE void store_aligned(xtl::xcomplex<T, T, i3ec>* dst) const noexcept;
455
+ template <bool i3ec>
456
+ XSIMD_INLINE void store_unaligned(xtl::xcomplex<T, T, i3ec>* dst) const noexcept;
457
+ #endif
458
+
459
+ // comparison operators
460
+ XSIMD_INLINE batch_bool<T, A> operator==(batch const& other) const noexcept;
461
+ XSIMD_INLINE batch_bool<T, A> operator!=(batch const& other) const noexcept;
462
+
463
+ // Update operators
464
+ XSIMD_INLINE batch& operator+=(batch const& other) noexcept;
465
+ XSIMD_INLINE batch& operator-=(batch const& other) noexcept;
466
+ XSIMD_INLINE batch& operator*=(batch const& other) noexcept;
467
+ XSIMD_INLINE batch& operator/=(batch const& other) noexcept;
468
+
469
+ // incr/decr operators
470
+ XSIMD_INLINE batch& operator++() noexcept;
471
+ XSIMD_INLINE batch& operator--() noexcept;
472
+ XSIMD_INLINE batch operator++(int) noexcept;
473
+ XSIMD_INLINE batch operator--(int) noexcept;
474
+
475
+ // unary operators
476
+ XSIMD_INLINE batch_bool_type operator!() const noexcept;
477
+ XSIMD_INLINE batch operator~() const noexcept;
478
+ XSIMD_INLINE batch operator-() const noexcept;
479
+ XSIMD_INLINE batch operator+() const noexcept;
480
+
481
+ // arithmetic operators. They are defined as friend to enable automatic
482
+ // conversion of parameters from scalar to batch
483
+
484
+ /** Shorthand for xsimd::add() */
485
+ friend XSIMD_INLINE batch operator+(batch const& self, batch const& other) noexcept
486
+ {
487
+ return batch(self) += other;
488
+ }
489
+
490
+ /** Shorthand for xsimd::sub() */
491
+ friend XSIMD_INLINE batch operator-(batch const& self, batch const& other) noexcept
492
+ {
493
+ return batch(self) -= other;
494
+ }
495
+
496
+ /** Shorthand for xsimd::mul() */
497
+ friend XSIMD_INLINE batch operator*(batch const& self, batch const& other) noexcept
498
+ {
499
+ return batch(self) *= other;
500
+ }
501
+
502
+ /** Shorthand for xsimd::div() */
503
+ friend XSIMD_INLINE batch operator/(batch const& self, batch const& other) noexcept
504
+ {
505
+ return batch(self) /= other;
506
+ }
507
+
508
+ private:
509
+ real_batch m_real;
510
+ real_batch m_imag;
511
+ };
512
+
513
+ #if XSIMD_CPP_VERSION < 201703L
514
+ template <class T, class A>
515
+ constexpr std::size_t batch<std::complex<T>, A>::size;
516
+ #endif
517
+
518
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
519
+ template <typename T, bool i3ec, typename A>
520
+ struct batch<xtl::xcomplex<T, T, i3ec>, A>
521
+ {
522
+ static_assert(std::is_same<T, void>::value,
523
+ "Please use batch<std::complex<T>, A> initialized from xtl::xcomplex instead");
524
+ };
525
+ #endif
526
+ }
527
+
528
+ #include "../arch/xsimd_isa.hpp"
529
+ #include "./xsimd_batch_constant.hpp"
530
+ #include "./xsimd_traits.hpp"
531
+
532
+ namespace xsimd
533
+ {
534
+
535
+ /**
536
+ * Create a batch with all element initialized to \c val.
537
+ */
538
+ template <class T, class A>
539
+ XSIMD_INLINE batch<T, A>::batch(T val) noexcept
540
+ : types::simd_register<T, A>(kernel::broadcast<A>(val, A {}))
541
+ {
542
+ detail::static_check_supported_config<T, A>();
543
+ }
544
+
545
+ /**
546
+ * Create a batch with elements initialized from \c val0, \c val1, \c vals...
547
+ * There must be exactly \c size elements in total.
548
+ */
549
+ template <class T, class A>
550
+ template <class... Ts>
551
+ XSIMD_INLINE batch<T, A>::batch(T val0, T val1, Ts... vals) noexcept
552
+ : batch(kernel::set<A>(batch {}, A {}, val0, val1, static_cast<T>(vals)...))
553
+ {
554
+ detail::static_check_supported_config<T, A>();
555
+ static_assert(sizeof...(Ts) + 2 == size, "The constructor requires as many arguments as batch elements.");
556
+ }
557
+
558
+ /**
559
+ * Converts a \c bool_batch to a \c batch where each element is
560
+ * set to 1 (resp. 0) if the corresponding element is `true`
561
+ * (resp. `false`).
562
+ */
563
+ template <class T, class A>
564
+ XSIMD_INLINE batch<T, A>::batch(batch_bool<T, A> const& b) noexcept
565
+ : batch(kernel::from_bool(b, A {}))
566
+ {
567
+ }
568
+
569
+ /**
570
+ * Wraps a compatible native simd register as a \c batch. This is generally not needed but
571
+ * becomes handy when doing architecture-specific operations.
572
+ */
573
+ template <class T, class A>
574
+ XSIMD_INLINE batch<T, A>::batch(register_type reg) noexcept
575
+ : types::simd_register<T, A>({ reg })
576
+ {
577
+ detail::static_check_supported_config<T, A>();
578
+ }
579
+
580
+ /**
581
+ * Equivalent to batch::batch(T val).
582
+ */
583
+ template <class T, class A>
584
+ template <class U>
585
+ XSIMD_NO_DISCARD XSIMD_INLINE batch<T, A> batch<T, A>::broadcast(U val) noexcept
586
+ {
587
+ detail::static_check_supported_config<T, A>();
588
+ return batch(static_cast<T>(val));
589
+ }
590
+
591
+ /**************************
592
+ * batch memory operators *
593
+ **************************/
594
+
595
+ /**
596
+ * Copy content of this batch to the buffer \c mem. The
597
+ * memory needs to be aligned.
598
+ */
599
+ template <class T, class A>
600
+ template <class U>
601
+ XSIMD_INLINE void batch<T, A>::store_aligned(U* mem) const noexcept
602
+ {
603
+ detail::static_check_supported_config<T, A>();
604
+ assert(((reinterpret_cast<uintptr_t>(mem) % A::alignment()) == 0)
605
+ && "store location is not properly aligned");
606
+ kernel::store_aligned<A>(mem, *this, A {});
607
+ }
608
+
609
+ /**
610
+ * Copy content of this batch to the buffer \c mem. The
611
+ * memory does not need to be aligned.
612
+ */
613
+ template <class T, class A>
614
+ template <class U>
615
+ XSIMD_INLINE void batch<T, A>::store_unaligned(U* mem) const noexcept
616
+ {
617
+ detail::static_check_supported_config<T, A>();
618
+ kernel::store_unaligned<A>(mem, *this, A {});
619
+ }
620
+
621
+ /**
622
+ * Equivalent to batch::store_aligned()
623
+ */
624
+ template <class T, class A>
625
+ template <class U>
626
+ XSIMD_INLINE void batch<T, A>::store(U* mem, aligned_mode) const noexcept
627
+ {
628
+ detail::static_check_supported_config<T, A>();
629
+ return store_aligned(mem);
630
+ }
631
+
632
+ /**
633
+ * Equivalent to batch::store_unaligned()
634
+ */
635
+ template <class T, class A>
636
+ template <class U>
637
+ XSIMD_INLINE void batch<T, A>::store(U* mem, unaligned_mode) const noexcept
638
+ {
639
+ detail::static_check_supported_config<T, A>();
640
+ return store_unaligned(mem);
641
+ }
642
+
643
+ // masked store free functions are provided in xsimd_api.hpp
644
+
645
+ template <class T, class A>
646
+ template <class U>
647
+ XSIMD_INLINE void batch<T, A>::store(U* mem, stream_mode) const noexcept
648
+ {
649
+ detail::static_check_supported_config<T, A>();
650
+ assert(((reinterpret_cast<uintptr_t>(mem) % A::alignment()) == 0)
651
+ && "store location is not properly aligned");
652
+ kernel::store_stream<A>(mem, *this, A {});
653
+ }
654
+
655
+ /**
656
+ * Loading from aligned memory. May involve a conversion if \c U is different
657
+ * from \c T.
658
+ */
659
+ template <class T, class A>
660
+ template <class U>
661
+ XSIMD_INLINE batch<T, A> batch<T, A>::load_aligned(U const* mem) noexcept
662
+ {
663
+ assert(((reinterpret_cast<uintptr_t>(mem) % A::alignment()) == 0)
664
+ && "loaded pointer is not properly aligned");
665
+ detail::static_check_supported_config<T, A>();
666
+ return kernel::load_aligned<A>(mem, kernel::convert<T> {}, A {});
667
+ }
668
+
669
+ /**
670
+ * Loading from unaligned memory. May involve a conversion if \c U is different
671
+ * from \c T.
672
+ */
673
+ template <class T, class A>
674
+ template <class U>
675
+ XSIMD_INLINE batch<T, A> batch<T, A>::load_unaligned(U const* mem) noexcept
676
+ {
677
+ detail::static_check_supported_config<T, A>();
678
+ return kernel::load_unaligned<A>(mem, kernel::convert<T> {}, A {});
679
+ }
680
+
681
+ /**
682
+ * Equivalent to batch::load_aligned()
683
+ */
684
+ template <class T, class A>
685
+ template <class U>
686
+ XSIMD_INLINE batch<T, A> batch<T, A>::load(U const* mem, aligned_mode) noexcept
687
+ {
688
+ detail::static_check_supported_config<T, A>();
689
+ return load_aligned(mem);
690
+ }
691
+
692
+ /**
693
+ * Equivalent to batch::load_unaligned()
694
+ */
695
+ template <class T, class A>
696
+ template <class U>
697
+ XSIMD_INLINE batch<T, A> batch<T, A>::load(U const* mem, unaligned_mode) noexcept
698
+ {
699
+ detail::static_check_supported_config<T, A>();
700
+ return load_unaligned(mem);
701
+ }
702
+
703
+ template <class T, class A>
704
+ template <class U, bool... Values, class Mode>
705
+ XSIMD_INLINE batch<T, A> batch<T, A>::load(U const* mem,
706
+ batch_bool_constant<T, A, Values...> mask,
707
+ Mode mode) noexcept
708
+ {
709
+ detail::static_check_supported_config<T, A>();
710
+ static_assert(std::is_same<Mode, aligned_mode>::value || std::is_same<Mode, unaligned_mode>::value,
711
+ "supported load mode");
712
+ XSIMD_IF_CONSTEXPR(mask.all())
713
+ {
714
+ return load(mem, mode);
715
+ }
716
+ else XSIMD_IF_CONSTEXPR(mask.none())
717
+ {
718
+ return broadcast<T>(0);
719
+ }
720
+ else
721
+ {
722
+ return kernel::load_masked<A>(mem, mask, kernel::convert<T> {}, mode, A {});
723
+ }
724
+ }
725
+
726
+ template <class T, class A>
727
+ template <class U, bool... Values, class Mode>
728
+ XSIMD_INLINE void batch<T, A>::store(U* mem,
729
+ batch_bool_constant<T, A, Values...> mask,
730
+ Mode mode) const noexcept
731
+ {
732
+ detail::static_check_supported_config<T, A>();
733
+ static_assert(std::is_same<Mode, aligned_mode>::value || std::is_same<Mode, unaligned_mode>::value,
734
+ "supported store mode");
735
+ XSIMD_IF_CONSTEXPR(mask.none())
736
+ {
737
+ return;
738
+ }
739
+ else XSIMD_IF_CONSTEXPR(mask.all())
740
+ {
741
+ store(mem, mode);
742
+ }
743
+ else
744
+ {
745
+ kernel::store_masked<A, T, U, Values...>(mem, *this, mask, mode, A {});
746
+ }
747
+ }
748
+
749
+ template <class T, class A>
750
+ template <class U>
751
+ XSIMD_INLINE batch<T, A> batch<T, A>::load(U const* mem, stream_mode) noexcept
752
+ {
753
+ detail::static_check_supported_config<T, A>();
754
+ assert(((reinterpret_cast<uintptr_t>(mem) % A::alignment()) == 0)
755
+ && "loaded pointer is not properly aligned");
756
+ return kernel::load_stream<A>(mem, kernel::convert<T> {}, A {});
757
+ }
758
+
759
+ /**
760
+ * Create a new batch gathering elements starting at address \c src and
761
+ * offset by each element in \c index.
762
+ * If \c T is not of the same size as \c U, a \c static_cast is performed
763
+ * at element gather time.
764
+ */
765
+ template <class T, class A>
766
+ template <typename U, typename V>
767
+ XSIMD_INLINE batch<T, A> batch<T, A>::gather(U const* src, batch<V, A> const& index) noexcept
768
+ {
769
+ detail::static_check_supported_config<T, A>();
770
+ static_assert(std::is_convertible<T, U>::value, "Can't convert from src to this batch's type!");
771
+ return kernel::gather(batch {}, src, index, A {});
772
+ }
773
+
774
+ /**
775
+ * Scatter elements from this batch into addresses starting at \c dst
776
+ * and offset by each element in \c index.
777
+ * If \c T is not of the same size as \c U, a \c static_cast is performed
778
+ * at element scatter time.
779
+ */
780
+ template <class T, class A>
781
+ template <class U, class V>
782
+ XSIMD_INLINE void batch<T, A>::scatter(U* dst, batch<V, A> const& index) const noexcept
783
+ {
784
+ detail::static_check_supported_config<T, A>();
785
+ static_assert(std::is_convertible<T, U>::value, "Can't convert from this batch's type to dst!");
786
+ kernel::scatter<A>(*this, dst, index, A {});
787
+ }
788
+
789
+ /**
790
+ * Retrieve the \c i th scalar element in this batch.
791
+ *
792
+ * \c warning This is very inefficient and should only be used for debugging purpose.
793
+ */
794
+ template <class T, class A>
795
+ XSIMD_INLINE T batch<T, A>::get(std::size_t i) const noexcept
796
+ {
797
+ return kernel::get(*this, i, A {});
798
+ }
799
+
800
+ /**
801
+ * Retrieve the first scalar element in this batch.
802
+ */
803
+ template <class T, class A>
804
+ XSIMD_INLINE T batch<T, A>::first() const noexcept
805
+ {
806
+ detail::static_check_supported_config<T, A>();
807
+ return kernel::first(*this, A {});
808
+ }
809
+
810
+ /******************************
811
+ * batch comparison operators *
812
+ ******************************/
813
+ namespace details
814
+ {
815
+ /**
816
+ * Shorthand for xsimd::eq()
817
+ */
818
+ template <class T, class A>
819
+ XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other) noexcept
820
+ {
821
+ detail::static_check_supported_config<T, A>();
822
+ return kernel::eq<A>(self, other, A {});
823
+ }
824
+
825
+ /**
826
+ * Shorthand for xsimd::neq()
827
+ */
828
+ template <class T, class A>
829
+ XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other) noexcept
830
+ {
831
+ detail::static_check_supported_config<T, A>();
832
+ return kernel::neq<A>(self, other, A {});
833
+ }
834
+
835
+ /**
836
+ * Shorthand for xsimd::ge()
837
+ */
838
+ template <class T, class A>
839
+ XSIMD_INLINE batch_bool<T, A> ge(batch<T, A> const& self, batch<T, A> const& other) noexcept
840
+ {
841
+ detail::static_check_supported_config<T, A>();
842
+ return kernel::ge<A>(self, other, A {});
843
+ }
844
+
845
+ /**
846
+ * Shorthand for xsimd::le()
847
+ */
848
+ template <class T, class A>
849
+ XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other) noexcept
850
+ {
851
+ detail::static_check_supported_config<T, A>();
852
+ return kernel::le<A>(self, other, A {});
853
+ }
854
+
855
+ /**
856
+ * Shorthand for xsimd::gt()
857
+ */
858
+ template <class T, class A>
859
+ XSIMD_INLINE batch_bool<T, A> gt(batch<T, A> const& self, batch<T, A> const& other) noexcept
860
+ {
861
+ detail::static_check_supported_config<T, A>();
862
+ return kernel::gt<A>(self, other, A {});
863
+ }
864
+
865
+ /**
866
+ * Shorthand for xsimd::lt()
867
+ */
868
+ template <class T, class A>
869
+ XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& self, batch<T, A> const& other) noexcept
870
+ {
871
+ detail::static_check_supported_config<T, A>();
872
+ return kernel::lt<A>(self, other, A {});
873
+ }
874
+ }
875
+
876
+ /**************************
877
+ * batch update operators *
878
+ **************************/
879
+
880
+ template <class T, class A>
881
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator+=(batch<T, A> const& other) noexcept
882
+ {
883
+ detail::static_check_supported_config<T, A>();
884
+ return *this = kernel::add<A>(*this, other, A {});
885
+ }
886
+
887
+ template <class T, class A>
888
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator-=(batch<T, A> const& other) noexcept
889
+ {
890
+ detail::static_check_supported_config<T, A>();
891
+ return *this = kernel::sub<A>(*this, other, A {});
892
+ }
893
+
894
+ template <class T, class A>
895
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator*=(batch<T, A> const& other) noexcept
896
+ {
897
+ detail::static_check_supported_config<T, A>();
898
+ return *this = kernel::mul<A>(*this, other, A {});
899
+ }
900
+
901
+ template <class T, class A>
902
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator/=(batch<T, A> const& other) noexcept
903
+ {
904
+ detail::static_check_supported_config<T, A>();
905
+ return *this = kernel::div<A>(*this, other, A {});
906
+ }
907
+
908
+ template <class T, class A>
909
+ XSIMD_INLINE batch<T, A>& types::integral_only_operators<T, A>::operator%=(batch<T, A> const& other) noexcept
910
+ {
911
+ ::xsimd::detail::static_check_supported_config<T, A>();
912
+ return *static_cast<batch<T, A>*>(this) = kernel::mod<A>(*static_cast<batch<T, A>*>(this), other, A {});
913
+ }
914
+
915
+ template <class T, class A>
916
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator&=(batch<T, A> const& other) noexcept
917
+ {
918
+ detail::static_check_supported_config<T, A>();
919
+ return *this = kernel::bitwise_and<A>(*this, other, A {});
920
+ }
921
+
922
+ template <class T, class A>
923
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator|=(batch<T, A> const& other) noexcept
924
+ {
925
+ detail::static_check_supported_config<T, A>();
926
+ return *this = kernel::bitwise_or<A>(*this, other, A {});
927
+ }
928
+
929
+ template <class T, class A>
930
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator^=(batch<T, A> const& other) noexcept
931
+ {
932
+ detail::static_check_supported_config<T, A>();
933
+ return *this = kernel::bitwise_xor<A>(*this, other, A {});
934
+ }
935
+
936
+ template <class T, class A>
937
+ XSIMD_INLINE batch<T, A>& kernel::integral_only_operators<T, A>::operator>>=(batch<T, A> const& other) noexcept
938
+ {
939
+ ::xsimd::detail::static_check_supported_config<T, A>();
940
+ return *static_cast<batch<T, A>*>(this) = kernel::bitwise_rshift<A>(*static_cast<batch<T, A>*>(this), other, A {});
941
+ }
942
+
943
+ template <class T, class A>
944
+ XSIMD_INLINE batch<T, A>& kernel::integral_only_operators<T, A>::operator<<=(batch<T, A> const& other) noexcept
945
+ {
946
+ ::xsimd::detail::static_check_supported_config<T, A>();
947
+ return *static_cast<batch<T, A>*>(this) = kernel::bitwise_lshift<A>(*static_cast<batch<T, A>*>(this), other, A {});
948
+ }
949
+
950
+ template <class T, class A>
951
+ XSIMD_INLINE batch<T, A>& kernel::integral_only_operators<T, A>::operator>>=(int32_t other) noexcept
952
+ {
953
+ ::xsimd::detail::static_check_supported_config<T, A>();
954
+ return *static_cast<batch<T, A>*>(this) = kernel::bitwise_rshift<A>(*static_cast<batch<T, A>*>(this), other, A {});
955
+ }
956
+
957
+ template <class T, class A>
958
+ XSIMD_INLINE batch<T, A>& kernel::integral_only_operators<T, A>::operator<<=(int32_t other) noexcept
959
+ {
960
+ ::xsimd::detail::static_check_supported_config<T, A>();
961
+ return *static_cast<batch<T, A>*>(this) = kernel::bitwise_lshift<A>(*static_cast<batch<T, A>*>(this), other, A {});
962
+ }
963
+
964
+ /*****************************
965
+ * batch incr/decr operators *
966
+ *****************************/
967
+
968
+ template <class T, class A>
969
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator++() noexcept
970
+ {
971
+ detail::static_check_supported_config<T, A>();
972
+ return operator+=(1);
973
+ }
974
+
975
+ template <class T, class A>
976
+ XSIMD_INLINE batch<T, A>& batch<T, A>::operator--() noexcept
977
+ {
978
+ detail::static_check_supported_config<T, A>();
979
+ return operator-=(1);
980
+ }
981
+
982
+ template <class T, class A>
983
+ XSIMD_INLINE batch<T, A> batch<T, A>::operator++(int) noexcept
984
+ {
985
+ detail::static_check_supported_config<T, A>();
986
+ batch<T, A> copy(*this);
987
+ operator+=(1);
988
+ return copy;
989
+ }
990
+
991
+ template <class T, class A>
992
+ XSIMD_INLINE batch<T, A> batch<T, A>::operator--(int) noexcept
993
+ {
994
+ detail::static_check_supported_config<T, A>();
995
+ batch copy(*this);
996
+ operator-=(1);
997
+ return copy;
998
+ }
999
+
1000
+ /*************************
1001
+ * batch unary operators *
1002
+ *************************/
1003
+
1004
+ template <class T, class A>
1005
+ XSIMD_INLINE batch_bool<T, A> batch<T, A>::operator!() const noexcept
1006
+ {
1007
+ detail::static_check_supported_config<T, A>();
1008
+ return kernel::eq<A>(*this, batch(0), A {});
1009
+ }
1010
+
1011
+ template <class T, class A>
1012
+ XSIMD_INLINE batch<T, A> batch<T, A>::operator~() const noexcept
1013
+ {
1014
+ detail::static_check_supported_config<T, A>();
1015
+ return kernel::bitwise_not<A>(*this, A {});
1016
+ }
1017
+
1018
+ template <class T, class A>
1019
+ XSIMD_INLINE batch<T, A> batch<T, A>::operator-() const noexcept
1020
+ {
1021
+ detail::static_check_supported_config<T, A>();
1022
+ return kernel::neg<A>(*this, A {});
1023
+ }
1024
+
1025
+ template <class T, class A>
1026
+ XSIMD_INLINE batch<T, A> batch<T, A>::operator+() const noexcept
1027
+ {
1028
+ detail::static_check_supported_config<T, A>();
1029
+ return *this;
1030
+ }
1031
+
1032
+ /************************
1033
+ * batch private method *
1034
+ ************************/
1035
+
1036
+ template <class T, class A>
1037
+ XSIMD_INLINE batch<T, A> batch<T, A>::logical_and(batch<T, A> const& other) const noexcept
1038
+ {
1039
+ return kernel::logical_and<A>(*this, other, A());
1040
+ }
1041
+
1042
+ template <class T, class A>
1043
+ XSIMD_INLINE batch<T, A> batch<T, A>::logical_or(batch<T, A> const& other) const noexcept
1044
+ {
1045
+ return kernel::logical_or<A>(*this, other, A());
1046
+ }
1047
+
1048
+ /***************************
1049
+ * batch_bool constructors *
1050
+ ***************************/
1051
+
1052
+ template <class T, class A>
1053
+ XSIMD_INLINE batch_bool<T, A>::batch_bool(register_type reg) noexcept
1054
+ : types::get_bool_simd_register_t<T, A>({ reg })
1055
+ {
1056
+ }
1057
+
1058
+ template <class T, class A>
1059
+ template <class... Ts>
1060
+ XSIMD_INLINE batch_bool<T, A>::batch_bool(bool val0, bool val1, Ts... vals) noexcept
1061
+ : batch_bool(kernel::set<A>(batch_bool {}, A {}, val0, val1, static_cast<bool>(vals)...))
1062
+ {
1063
+ static_assert(sizeof...(Ts) + 2 == size, "The constructor requires as many arguments as batch elements.");
1064
+ }
1065
+
1066
+ /*******************************
1067
+ * batch_bool memory operators *
1068
+ *******************************/
1069
+
1070
+ template <class T, class A>
1071
+ XSIMD_INLINE void batch_bool<T, A>::store_aligned(bool* mem) const noexcept
1072
+ {
1073
+ kernel::store(*this, mem, A {});
1074
+ }
1075
+
1076
+ template <class T, class A>
1077
+ XSIMD_INLINE void batch_bool<T, A>::store_unaligned(bool* mem) const noexcept
1078
+ {
1079
+ store_aligned(mem);
1080
+ }
1081
+
1082
+ template <class T, class A>
1083
+ XSIMD_INLINE void batch_bool<T, A>::store_stream(bool* mem) const noexcept
1084
+ {
1085
+ kernel::store_stream<A>(*this, mem, A {});
1086
+ }
1087
+
1088
+ template <class T, class A>
1089
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::load_aligned(bool const* mem) noexcept
1090
+ {
1091
+ return kernel::load_aligned<A>(mem, batch_bool<T, A>(), A {});
1092
+ }
1093
+
1094
+ template <class T, class A>
1095
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::load_unaligned(bool const* mem) noexcept
1096
+ {
1097
+ return kernel::load_unaligned<A>(mem, batch_bool<T, A>(), A {});
1098
+ }
1099
+
1100
+ template <class T, class A>
1101
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::load_stream(bool const* mem) noexcept
1102
+ {
1103
+ return kernel::load_stream<A>(mem, batch_bool<T, A>(), A {});
1104
+ }
1105
+
1106
+ /**
1107
+ * Extract a scalar mask representation from this @c batch_bool.
1108
+ *
1109
+ * @return bit mask
1110
+ */
1111
+ template <class T, class A>
1112
+ XSIMD_INLINE uint64_t batch_bool<T, A>::mask() const noexcept
1113
+ {
1114
+ return kernel::mask(*this, A {});
1115
+ }
1116
+
1117
+ /**
1118
+ * Extract a scalar mask representation from this @c batch_bool.
1119
+ *
1120
+ * @return bit mask
1121
+ */
1122
+ template <class T, class A>
1123
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::from_mask(uint64_t mask) noexcept
1124
+ {
1125
+ return kernel::from_mask(batch_bool<T, A>(), mask, A {});
1126
+ }
1127
+
1128
+ template <class T, class A>
1129
+ XSIMD_INLINE bool batch_bool<T, A>::get(std::size_t i) const noexcept
1130
+ {
1131
+ return kernel::get(*this, i, A {});
1132
+ }
1133
+
1134
+ template <class T, class A>
1135
+ XSIMD_INLINE bool batch_bool<T, A>::first() const noexcept
1136
+ {
1137
+ detail::static_check_supported_config<T, A>();
1138
+ return kernel::first(*this, A {});
1139
+ }
1140
+
1141
+ /***********************************
1142
+ * batch_bool comparison operators *
1143
+ ***********************************/
1144
+
1145
+ template <class T, class A>
1146
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator==(batch_bool<T, A> const& other) const noexcept
1147
+ {
1148
+ return kernel::eq<A>(*this, other, A {}).data;
1149
+ }
1150
+
1151
+ template <class T, class A>
1152
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator!=(batch_bool<T, A> const& other) const noexcept
1153
+ {
1154
+ return kernel::neq<A>(*this, other, A {}).data;
1155
+ }
1156
+
1157
+ /********************************
1158
+ * batch_bool logical operators *
1159
+ ********************************/
1160
+
1161
+ template <class T, class A>
1162
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator~() const noexcept
1163
+ {
1164
+ return kernel::bitwise_not<A>(*this, A {}).data;
1165
+ }
1166
+
1167
+ template <class T, class A>
1168
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator!() const noexcept
1169
+ {
1170
+ return operator==(batch_bool(false));
1171
+ }
1172
+
1173
+ template <class T, class A>
1174
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator&(batch_bool<T, A> const& other) const noexcept
1175
+ {
1176
+ return kernel::bitwise_and<A>(*this, other, A {}).data;
1177
+ }
1178
+
1179
+ template <class T, class A>
1180
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator|(batch_bool<T, A> const& other) const noexcept
1181
+ {
1182
+ return kernel::bitwise_or<A>(*this, other, A {}).data;
1183
+ }
1184
+
1185
+ template <class T, class A>
1186
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator^(batch_bool<T, A> const& other) const noexcept
1187
+ {
1188
+ return kernel::bitwise_xor<A>(*this, other, A {}).data;
1189
+ }
1190
+
1191
+ template <class T, class A>
1192
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator&&(batch_bool const& other) const noexcept
1193
+ {
1194
+ return operator&(other);
1195
+ }
1196
+
1197
+ template <class T, class A>
1198
+ XSIMD_INLINE batch_bool<T, A> batch_bool<T, A>::operator||(batch_bool const& other) const noexcept
1199
+ {
1200
+ return operator|(other);
1201
+ }
1202
+
1203
+ /******************************
1204
+ * batch_bool private methods *
1205
+ ******************************/
1206
+
1207
+ template <class T, class A>
1208
+ XSIMD_INLINE batch_bool<T, A>::batch_bool(bool val) noexcept
1209
+ : base_type { make_register(std::make_index_sequence<size - 1>(), val) }
1210
+ {
1211
+ }
1212
+
1213
+ template <class T, class A>
1214
+ template <class U, class... V, size_t I, size_t... Is>
1215
+ XSIMD_INLINE auto batch_bool<T, A>::make_register(std::index_sequence<I, Is...>, U u, V... v) noexcept -> register_type
1216
+ {
1217
+ return make_register(std::index_sequence<Is...>(), u, u, v...);
1218
+ }
1219
+
1220
+ template <class T, class A>
1221
+ template <class... V>
1222
+ XSIMD_INLINE auto batch_bool<T, A>::make_register(std::index_sequence<>, V... v) noexcept -> register_type
1223
+ {
1224
+ return kernel::set<A>(batch_bool<T, A>(), A {}, v...).data;
1225
+ }
1226
+
1227
+ /*******************************
1228
+ * batch<complex> constructors *
1229
+ *******************************/
1230
+
1231
+ template <class T, class A>
1232
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(value_type const& val) noexcept
1233
+ : m_real(val.real())
1234
+ , m_imag(val.imag())
1235
+ {
1236
+ }
1237
+
1238
+ template <class T, class A>
1239
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(real_batch const& real, real_batch const& imag) noexcept
1240
+ : m_real(real)
1241
+ , m_imag(imag)
1242
+ {
1243
+ }
1244
+
1245
+ template <class T, class A>
1246
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(real_batch const& real) noexcept
1247
+ : m_real(real)
1248
+ , m_imag(0)
1249
+ {
1250
+ }
1251
+
1252
+ template <class T, class A>
1253
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(T val) noexcept
1254
+ : m_real(val)
1255
+ , m_imag(0)
1256
+ {
1257
+ }
1258
+
1259
+ template <class T, class A>
1260
+ template <class... Ts>
1261
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(value_type val0, value_type val1, Ts... vals) noexcept
1262
+ : batch(kernel::set<A>(batch {}, A {}, val0, val1, static_cast<value_type>(vals)...))
1263
+ {
1264
+ static_assert(sizeof...(Ts) + 2 == size, "as many arguments as batch elements");
1265
+ }
1266
+
1267
+ template <class T, class A>
1268
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(batch_bool_type const& b) noexcept
1269
+ : m_real(b)
1270
+ , m_imag(0)
1271
+ {
1272
+ }
1273
+
1274
+ template <class T, class A>
1275
+ template <class U>
1276
+ XSIMD_NO_DISCARD XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::broadcast(U val) noexcept
1277
+ {
1278
+ return batch(static_cast<std::complex<T>>(val));
1279
+ }
1280
+
1281
+ /***********************************
1282
+ * batch<complex> memory operators *
1283
+ ***********************************/
1284
+
1285
+ template <class T, class A>
1286
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load_aligned(const T* real_src, const T* imag_src) noexcept
1287
+ {
1288
+ return { batch<T, A>::load_aligned(real_src), imag_src ? batch<T, A>::load_aligned(imag_src) : batch<T, A>(0) };
1289
+ }
1290
+ template <class T, class A>
1291
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load_unaligned(const T* real_src, const T* imag_src) noexcept
1292
+ {
1293
+ return { batch<T, A>::load_unaligned(real_src), imag_src ? batch<T, A>::load_unaligned(imag_src) : batch<T, A>(0) };
1294
+ }
1295
+
1296
+ template <class T, class A>
1297
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load_aligned(const value_type* src) noexcept
1298
+ {
1299
+ assert(((reinterpret_cast<uintptr_t>(src) % A::alignment()) == 0)
1300
+ && "loaded pointer is not properly aligned");
1301
+ return kernel::load_complex_aligned<A>(src, kernel::convert<value_type> {}, A {});
1302
+ }
1303
+
1304
+ template <class T, class A>
1305
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load_unaligned(const value_type* src) noexcept
1306
+ {
1307
+ return kernel::load_complex_unaligned<A>(src, kernel::convert<value_type> {}, A {});
1308
+ }
1309
+
1310
+ template <class T, class A>
1311
+ XSIMD_INLINE void batch<std::complex<T>, A>::store_aligned(value_type* dst) const noexcept
1312
+ {
1313
+ assert(((reinterpret_cast<uintptr_t>(dst) % A::alignment()) == 0)
1314
+ && "store location is not properly aligned");
1315
+ return kernel::store_complex_aligned(dst, *this, A {});
1316
+ }
1317
+
1318
+ template <class T, class A>
1319
+ XSIMD_INLINE void batch<std::complex<T>, A>::store_unaligned(value_type* dst) const noexcept
1320
+ {
1321
+ return kernel::store_complex_unaligned(dst, *this, A {});
1322
+ }
1323
+
1324
+ // Compile-time mask overloads for complex store
1325
+ template <class T, class A>
1326
+ template <class U, bool... Values, class Mode>
1327
+ XSIMD_INLINE void batch<std::complex<T>, A>::store(U* mem, batch_bool_constant<value_type, A, Values...> mask, Mode mode) const noexcept
1328
+ {
1329
+ kernel::store_masked<A>(mem, *this, mask, mode, A {});
1330
+ }
1331
+
1332
+ template <class T, class A>
1333
+ XSIMD_INLINE void batch<std::complex<T>, A>::store_aligned(T* real_dst, T* imag_dst) const noexcept
1334
+ {
1335
+ m_real.store_aligned(real_dst);
1336
+ m_imag.store_aligned(imag_dst);
1337
+ }
1338
+
1339
+ template <class T, class A>
1340
+ XSIMD_INLINE void batch<std::complex<T>, A>::store_unaligned(T* real_dst, T* imag_dst) const noexcept
1341
+ {
1342
+ m_real.store_unaligned(real_dst);
1343
+ m_imag.store_unaligned(imag_dst);
1344
+ }
1345
+
1346
+ template <class T, class A>
1347
+ template <class U>
1348
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load(U const* mem, aligned_mode) noexcept
1349
+ {
1350
+ return load_aligned(mem);
1351
+ }
1352
+
1353
+ template <class T, class A>
1354
+ template <class U>
1355
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load(U const* mem, unaligned_mode) noexcept
1356
+ {
1357
+ return load_unaligned(mem);
1358
+ }
1359
+
1360
+ // Compile-time mask overloads for complex load
1361
+ template <class T, class A>
1362
+ template <class U, bool... Values, class Mode>
1363
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load(U const* mem,
1364
+ batch_bool_constant<value_type, A, Values...> mask,
1365
+ Mode mode) noexcept
1366
+ {
1367
+ return kernel::load_masked<A>(mem, mask, kernel::convert<value_type> {}, mode, A {});
1368
+ }
1369
+
1370
+ template <class T, class A>
1371
+ template <class U>
1372
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load(U const* mem, stream_mode) noexcept
1373
+ {
1374
+ assert(((reinterpret_cast<uintptr_t>(mem) % A::alignment()) == 0)
1375
+ && "loaded pointer is not properly aligned");
1376
+ auto* ptr = reinterpret_cast<value_type const*>(mem);
1377
+ return kernel::load_complex_stream<A>(ptr, kernel::convert<value_type> {}, A {});
1378
+ }
1379
+
1380
+ template <class T, class A>
1381
+ template <class U>
1382
+ XSIMD_INLINE void batch<std::complex<T>, A>::store(U* mem, aligned_mode) const noexcept
1383
+ {
1384
+ return store_aligned(mem);
1385
+ }
1386
+
1387
+ template <class T, class A>
1388
+ template <class U>
1389
+ XSIMD_INLINE void batch<std::complex<T>, A>::store(U* mem, unaligned_mode) const noexcept
1390
+ {
1391
+ return store_unaligned(mem);
1392
+ }
1393
+
1394
+ template <class T, class A>
1395
+ template <class U>
1396
+ XSIMD_INLINE void batch<std::complex<T>, A>::store(U* mem, stream_mode) const noexcept
1397
+ {
1398
+ assert(((reinterpret_cast<uintptr_t>(mem) % A::alignment()) == 0)
1399
+ && "store location is not properly aligned");
1400
+ auto* ptr = reinterpret_cast<value_type*>(mem);
1401
+ return kernel::store_complex_stream(ptr, *this, A {});
1402
+ }
1403
+
1404
+ template <class T, class A>
1405
+ XSIMD_INLINE auto batch<std::complex<T>, A>::real() const noexcept -> real_batch
1406
+ {
1407
+ return m_real;
1408
+ }
1409
+
1410
+ template <class T, class A>
1411
+ XSIMD_INLINE auto batch<std::complex<T>, A>::imag() const noexcept -> real_batch
1412
+ {
1413
+ return m_imag;
1414
+ }
1415
+
1416
+ template <class T, class A>
1417
+ XSIMD_INLINE auto batch<std::complex<T>, A>::get(std::size_t i) const noexcept -> value_type
1418
+ {
1419
+ return kernel::get(*this, i, A {});
1420
+ }
1421
+
1422
+ template <class T, class A>
1423
+ XSIMD_INLINE auto batch<std::complex<T>, A>::first() const noexcept -> value_type
1424
+ {
1425
+ detail::static_check_supported_config<std::complex<T>, A>();
1426
+ return kernel::first(*this, A {});
1427
+ }
1428
+
1429
+ /**************************************
1430
+ * batch<complex> xtl-related methods *
1431
+ **************************************/
1432
+
1433
+ #ifdef XSIMD_ENABLE_XTL_COMPLEX
1434
+
1435
+ template <class T, class A>
1436
+ template <bool i3ec>
1437
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(xtl::xcomplex<T, T, i3ec> const& val) noexcept
1438
+ : m_real(val.real())
1439
+ , m_imag(val.imag())
1440
+ {
1441
+ }
1442
+
1443
+ template <class T, class A>
1444
+ template <bool i3ec, class... Ts>
1445
+ XSIMD_INLINE batch<std::complex<T>, A>::batch(xtl::xcomplex<T, T, i3ec> val0, xtl::xcomplex<T, T, i3ec> val1, Ts... vals) noexcept
1446
+ : batch(kernel::set<A>(batch {}, A {}, val0, val1, static_cast<xtl::xcomplex<T, T, i3ec>>(vals)...))
1447
+ {
1448
+ static_assert(sizeof...(Ts) + 2 == size, "as many arguments as batch elements");
1449
+ }
1450
+
1451
+ // Memory layout of an xcomplex and std::complex are the same when xcomplex
1452
+ // stores values and not reference. Unfortunately, this breaks strict
1453
+ // aliasing...
1454
+
1455
+ template <class T, class A>
1456
+ template <bool i3ec>
1457
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load_aligned(const xtl::xcomplex<T, T, i3ec>* src) noexcept
1458
+ {
1459
+ return load_aligned(reinterpret_cast<std::complex<T> const*>(src));
1460
+ }
1461
+
1462
+ template <class T, class A>
1463
+ template <bool i3ec>
1464
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::load_unaligned(const xtl::xcomplex<T, T, i3ec>* src) noexcept
1465
+ {
1466
+ return load_unaligned(reinterpret_cast<std::complex<T> const*>(src));
1467
+ }
1468
+
1469
+ template <class T, class A>
1470
+ template <bool i3ec>
1471
+ XSIMD_INLINE void batch<std::complex<T>, A>::store_aligned(xtl::xcomplex<T, T, i3ec>* dst) const noexcept
1472
+ {
1473
+ store_aligned(reinterpret_cast<std::complex<T>*>(dst));
1474
+ }
1475
+
1476
+ template <class T, class A>
1477
+ template <bool i3ec>
1478
+ XSIMD_INLINE void batch<std::complex<T>, A>::store_unaligned(xtl::xcomplex<T, T, i3ec>* dst) const noexcept
1479
+ {
1480
+ store_unaligned(reinterpret_cast<std::complex<T>*>(dst));
1481
+ }
1482
+
1483
+ #endif
1484
+
1485
+ /***************************************
1486
+ * batch<complex> comparison operators *
1487
+ ***************************************/
1488
+
1489
+ template <class T, class A>
1490
+ XSIMD_INLINE batch_bool<T, A> batch<std::complex<T>, A>::operator==(batch const& other) const noexcept
1491
+ {
1492
+ return m_real == other.m_real && m_imag == other.m_imag;
1493
+ }
1494
+
1495
+ template <class T, class A>
1496
+ XSIMD_INLINE batch_bool<T, A> batch<std::complex<T>, A>::operator!=(batch const& other) const noexcept
1497
+ {
1498
+ return m_real != other.m_real || m_imag != other.m_imag;
1499
+ }
1500
+
1501
+ /***********************************
1502
+ * batch<complex> update operators *
1503
+ ***********************************/
1504
+
1505
+ template <class T, class A>
1506
+ XSIMD_INLINE batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator+=(batch const& other) noexcept
1507
+ {
1508
+ m_real += other.m_real;
1509
+ m_imag += other.m_imag;
1510
+ return *this;
1511
+ }
1512
+
1513
+ template <class T, class A>
1514
+ XSIMD_INLINE batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator-=(batch const& other) noexcept
1515
+ {
1516
+ m_real -= other.m_real;
1517
+ m_imag -= other.m_imag;
1518
+ return *this;
1519
+ }
1520
+
1521
+ template <class T, class A>
1522
+ XSIMD_INLINE batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator*=(batch const& other) noexcept
1523
+ {
1524
+ real_batch new_real = fms(real(), other.real(), imag() * other.imag());
1525
+ real_batch new_imag = fma(real(), other.imag(), imag() * other.real());
1526
+ m_real = new_real;
1527
+ m_imag = new_imag;
1528
+ return *this;
1529
+ }
1530
+
1531
+ template <class T, class A>
1532
+ XSIMD_INLINE batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator/=(batch const& other) noexcept
1533
+ {
1534
+ real_batch a = real();
1535
+ real_batch b = imag();
1536
+ real_batch c = other.real();
1537
+ real_batch d = other.imag();
1538
+ real_batch e = c * c + d * d;
1539
+ m_real = (c * a + d * b) / e;
1540
+ m_imag = (c * b - d * a) / e;
1541
+ return *this;
1542
+ }
1543
+
1544
+ /**************************************
1545
+ * batch<complex> incr/decr operators *
1546
+ **************************************/
1547
+
1548
+ template <class T, class A>
1549
+ XSIMD_INLINE batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator++() noexcept
1550
+ {
1551
+ return operator+=(1);
1552
+ }
1553
+
1554
+ template <class T, class A>
1555
+ XSIMD_INLINE batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator--() noexcept
1556
+ {
1557
+ return operator-=(1);
1558
+ }
1559
+
1560
+ template <class T, class A>
1561
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::operator++(int) noexcept
1562
+ {
1563
+ batch copy(*this);
1564
+ operator+=(1);
1565
+ return copy;
1566
+ }
1567
+
1568
+ template <class T, class A>
1569
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::operator--(int) noexcept
1570
+ {
1571
+ batch copy(*this);
1572
+ operator-=(1);
1573
+ return copy;
1574
+ }
1575
+
1576
+ /**********************************
1577
+ * batch<complex> unary operators *
1578
+ **********************************/
1579
+
1580
+ template <class T, class A>
1581
+ XSIMD_INLINE batch_bool<T, A> batch<std::complex<T>, A>::operator!() const noexcept
1582
+ {
1583
+ return operator==(batch(0));
1584
+ }
1585
+
1586
+ template <class T, class A>
1587
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::operator~() const noexcept
1588
+ {
1589
+ return { ~m_real, ~m_imag };
1590
+ }
1591
+
1592
+ template <class T, class A>
1593
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::operator-() const noexcept
1594
+ {
1595
+ return { -m_real, -m_imag };
1596
+ }
1597
+
1598
+ template <class T, class A>
1599
+ XSIMD_INLINE batch<std::complex<T>, A> batch<std::complex<T>, A>::operator+() const noexcept
1600
+ {
1601
+ return { +m_real, +m_imag };
1602
+ }
1603
+
1604
+ /**********************************
1605
+ * size type aliases
1606
+ **********************************/
1607
+
1608
+ namespace details
1609
+ {
1610
+ template <typename T, std::size_t N, class ArchList>
1611
+ struct sized_batch;
1612
+
1613
+ template <typename T, std::size_t N>
1614
+ struct sized_batch<T, N, xsimd::arch_list<>>
1615
+ {
1616
+ using type = void;
1617
+ };
1618
+
1619
+ template <typename T, class Arch, bool BatchExists = xsimd::has_simd_register<T, Arch>::value>
1620
+ struct batch_trait;
1621
+
1622
+ template <typename T, class Arch>
1623
+ struct batch_trait<T, Arch, true>
1624
+ {
1625
+ using type = xsimd::batch<T, Arch>;
1626
+ static constexpr std::size_t size = xsimd::batch<T, Arch>::size;
1627
+ };
1628
+
1629
+ template <typename T, class Arch>
1630
+ struct batch_trait<T, Arch, false>
1631
+ {
1632
+ using type = void;
1633
+ static constexpr std::size_t size = 0;
1634
+ };
1635
+
1636
+ template <typename T, std::size_t N, class Arch, class... Archs>
1637
+ struct sized_batch<T, N, xsimd::arch_list<Arch, Archs...>>
1638
+ {
1639
+ using type = std::conditional_t<
1640
+ batch_trait<T, Arch>::size == N,
1641
+ typename batch_trait<T, Arch>::type,
1642
+ typename sized_batch<T, N, xsimd::arch_list<Archs...>>::type>;
1643
+ };
1644
+ }
1645
+
1646
+ /**
1647
+ * @brief type utility to select a batch of given type and size
1648
+ *
1649
+ * If one of the available architectures has a native vector type of the
1650
+ * given type and size, sets the @p type member to the appropriate batch
1651
+ * type. Otherwise set its to @p void.
1652
+ *
1653
+ * @tparam T the type of the underlying values.
1654
+ * @tparam N the number of elements of that type in the batch.
1655
+ **/
1656
+ template <typename T, std::size_t N>
1657
+ struct make_sized_batch
1658
+ {
1659
+ using type = typename details::sized_batch<T, N, supported_architectures>::type;
1660
+ };
1661
+
1662
+ template <typename T, std::size_t N>
1663
+ using make_sized_batch_t = typename make_sized_batch<T, N>::type;
1664
+ }
1665
+
1666
+ #endif