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,1186 @@
1
+ /***************************************************************************
2
+ * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3
+ * Martin Renou *
4
+ * Copyright (c) QuantStack *
5
+ * Copyright (c) Serge Guelton *
6
+ * Copyright (c) Yibo Cai *
7
+ * *
8
+ * Distributed under the terms of the BSD 3-Clause License. *
9
+ * *
10
+ * The full license is in the file LICENSE, distributed with this software. *
11
+ ****************************************************************************/
12
+
13
+ #ifndef XSIMD_SVE_HPP
14
+ #define XSIMD_SVE_HPP
15
+
16
+ #include <complex>
17
+ #include <type_traits>
18
+
19
+ #include "../config/xsimd_config.hpp"
20
+ #include "../config/xsimd_macros.hpp"
21
+ #include "../types/xsimd_sve_register.hpp"
22
+
23
+ // Define a inline namespace with the explicit SVE vector size to avoid ODR violation
24
+ // When dynamically dispatching between different SVE sizes.
25
+ // While most code is safe from ODR violation as the size is already encoded in the
26
+ // register (and hence batch) types, utilities can quickly fall prone to this issue.
27
+ #define XSIMD_SVE_NAMESPACE XSIMD_CONCAT(sve, XSIMD_SVE_BITS)
28
+
29
+ namespace xsimd
30
+ {
31
+ template <typename T, class A, T... Values>
32
+ struct batch_constant;
33
+
34
+ namespace kernel
35
+ {
36
+ namespace detail_sve
37
+ {
38
+ inline namespace XSIMD_SVE_NAMESPACE
39
+ {
40
+ using xsimd::index;
41
+ using xsimd::types::detail::sve_vector_type;
42
+
43
+ // predicate creation
44
+ XSIMD_INLINE svbool_t ptrue_impl(index<1>) noexcept { return svptrue_b8(); }
45
+ XSIMD_INLINE svbool_t ptrue_impl(index<2>) noexcept { return svptrue_b16(); }
46
+ XSIMD_INLINE svbool_t ptrue_impl(index<4>) noexcept { return svptrue_b32(); }
47
+ XSIMD_INLINE svbool_t ptrue_impl(index<8>) noexcept { return svptrue_b64(); }
48
+
49
+ template <class T>
50
+ XSIMD_INLINE svbool_t ptrue() noexcept { return ptrue_impl(index<sizeof(T)> {}); }
51
+
52
+ // predicate loading
53
+ template <bool M0, bool M1>
54
+ XSIMD_INLINE svbool_t pmask() noexcept { return svdupq_b64(M0, M1); }
55
+ template <bool M0, bool M1, bool M2, bool M3>
56
+ XSIMD_INLINE svbool_t pmask() noexcept { return svdupq_b32(M0, M1, M2, M3); }
57
+ template <bool M0, bool M1, bool M2, bool M3, bool M4, bool M5, bool M6, bool M7>
58
+ XSIMD_INLINE svbool_t pmask() noexcept { return svdupq_b16(M0, M1, M2, M3, M4, M5, M6, M7); }
59
+ template <bool M0, bool M1, bool M2, bool M3, bool M4, bool M5, bool M6, bool M7,
60
+ bool M8, bool M9, bool M10, bool M11, bool M12, bool M13, bool M14, bool M15>
61
+ XSIMD_INLINE svbool_t pmask() noexcept { return svdupq_b8(M0, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15); }
62
+
63
+ // count active lanes in a predicate
64
+ XSIMD_INLINE uint64_t pcount_impl(svbool_t p, index<1>) noexcept { return svcntp_b8(p, p); }
65
+ XSIMD_INLINE uint64_t pcount_impl(svbool_t p, index<2>) noexcept { return svcntp_b16(p, p); }
66
+ XSIMD_INLINE uint64_t pcount_impl(svbool_t p, index<4>) noexcept { return svcntp_b32(p, p); }
67
+ XSIMD_INLINE uint64_t pcount_impl(svbool_t p, index<8>) noexcept { return svcntp_b64(p, p); }
68
+
69
+ template <class T>
70
+ XSIMD_INLINE uint64_t pcount(svbool_t p) noexcept { return pcount_impl(p, index<sizeof(T)> {}); }
71
+
72
+ // enable for signed integers or floating points
73
+ template <class T>
74
+ using enable_signed_int_or_floating_point_t = std::enable_if_t<std::is_signed<T>::value, int>;
75
+
76
+ // `sizeless` is the matching sizeless SVE type. xsimd stores SVE
77
+ // vectors as fixed-size attributed types (arm_sve_vector_bits),
78
+ // which clang treats as implicitly convertible to every sizeless
79
+ // SVE type — including multi-vector tuples — making the overloaded
80
+ // svreinterpret_*/svsel/etc. intrinsics ambiguous. Static-casting
81
+ // to `sizeless` first collapses the overload set to the single
82
+ // 1-vector candidate.
83
+ template <class T>
84
+ using sizeless_t = xsimd::types::detail::sizeless_sve_vector_type<T>;
85
+ } // namespace XSIMD_SVE_NAMESPACE
86
+ } // namespace detail_sve
87
+
88
+ /*********
89
+ * Load *
90
+ *********/
91
+
92
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
93
+ XSIMD_INLINE batch<T, A> load_aligned(T const* src, convert<T>, requires_arch<sve>) noexcept
94
+ {
95
+ return svld1(detail_sve::ptrue<T>(), reinterpret_cast<map_to_sized_type_t<T> const*>(src));
96
+ }
97
+
98
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
99
+ XSIMD_INLINE batch<T, A> load_unaligned(T const* src, convert<T>, requires_arch<sve>) noexcept
100
+ {
101
+ return load_aligned<A>(src, convert<T>(), sve {});
102
+ }
103
+
104
+ // load_masked
105
+ template <class A, class T, bool... Values, class Mode, detail::enable_arithmetic_t<T> = 0>
106
+ XSIMD_INLINE batch<T, A> load_masked(T const* mem, batch_bool_constant<float, A, Values...>, Mode, requires_arch<sve>) noexcept
107
+ {
108
+ return svld1(detail_sve::pmask<Values...>(), reinterpret_cast<map_to_sized_type_t<T> const*>(mem));
109
+ }
110
+
111
+ // load_complex
112
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
113
+ XSIMD_INLINE batch<std::complex<T>, A> load_complex_aligned(std::complex<T> const* mem, convert<std::complex<T>>, requires_arch<sve>) noexcept
114
+ {
115
+ const T* buf = reinterpret_cast<const T*>(mem);
116
+ const auto tmp = svld2(detail_sve::ptrue<T>(), buf);
117
+ const auto real = svget2(tmp, 0);
118
+ const auto imag = svget2(tmp, 1);
119
+ return batch<std::complex<T>, A> { real, imag };
120
+ }
121
+
122
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
123
+ XSIMD_INLINE batch<std::complex<T>, A> load_complex_unaligned(std::complex<T> const* mem, convert<std::complex<T>>, requires_arch<sve>) noexcept
124
+ {
125
+ return load_complex_aligned<A>(mem, convert<std::complex<T>> {}, sve {});
126
+ }
127
+
128
+ /*********
129
+ * Store *
130
+ *********/
131
+
132
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
133
+ XSIMD_INLINE void store_aligned(T* dst, batch<T, A> const& src, requires_arch<sve>) noexcept
134
+ {
135
+ svst1(detail_sve::ptrue<T>(), reinterpret_cast<map_to_sized_type_t<T>*>(dst), src);
136
+ }
137
+
138
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
139
+ XSIMD_INLINE void store_unaligned(T* dst, batch<T, A> const& src, requires_arch<sve>) noexcept
140
+ {
141
+ store_aligned<A>(dst, src, sve {});
142
+ }
143
+
144
+ // store_complex
145
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
146
+ XSIMD_INLINE void store_complex_aligned(std::complex<T>* dst, batch<std::complex<T>, A> const& src, requires_arch<sve>) noexcept
147
+ {
148
+ using v2type = std::conditional_t<(sizeof(T) == 4), svfloat32x2_t, svfloat64x2_t>;
149
+ v2type tmp {};
150
+ tmp = svset2(tmp, 0, src.real());
151
+ tmp = svset2(tmp, 1, src.imag());
152
+ T* buf = reinterpret_cast<T*>(dst);
153
+ svst2(detail_sve::ptrue<T>(), buf, tmp);
154
+ }
155
+
156
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
157
+ XSIMD_INLINE void store_complex_unaligned(std::complex<T>* dst, batch<std::complex<T>, A> const& src, requires_arch<sve>) noexcept
158
+ {
159
+ store_complex_aligned(dst, src, sve {});
160
+ }
161
+
162
+ /******************
163
+ * scatter/gather *
164
+ ******************/
165
+
166
+ namespace detail_sve
167
+ {
168
+ template <class T, class U>
169
+ using enable_sg_t = std::enable_if_t<(sizeof(T) == sizeof(U) && (sizeof(T) == 4 || sizeof(T) == 8)), int>;
170
+ }
171
+
172
+ // scatter
173
+ template <class A, class T, class U, detail_sve::enable_sg_t<T, U> = 0>
174
+ XSIMD_INLINE void scatter(batch<T, A> const& src, T* dst, batch<U, A> const& index, kernel::requires_arch<sve>) noexcept
175
+ {
176
+ svst1_scatter_index(detail_sve::ptrue<T>(), dst, index.data, src.data);
177
+ }
178
+
179
+ // gather
180
+ template <class A, class T, class U, detail_sve::enable_sg_t<T, U> = 0>
181
+ XSIMD_INLINE batch<T, A> gather(batch<T, A> const&, T const* src, batch<U, A> const& index, kernel::requires_arch<sve>) noexcept
182
+ {
183
+ return svld1_gather_index(detail_sve::ptrue<T>(), src, index.data);
184
+ }
185
+
186
+ /********************
187
+ * Scalar to vector *
188
+ ********************/
189
+
190
+ // broadcast
191
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 1> = 0>
192
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
193
+ {
194
+ return svdup_n_u8(uint8_t(arg));
195
+ }
196
+
197
+ template <class A, class T, detail::enable_sized_signed_t<T, 1> = 0>
198
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
199
+ {
200
+ return svdup_n_s8(int8_t(arg));
201
+ }
202
+
203
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 2> = 0>
204
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
205
+ {
206
+ return svdup_n_u16(uint16_t(arg));
207
+ }
208
+
209
+ template <class A, class T, detail::enable_sized_signed_t<T, 2> = 0>
210
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
211
+ {
212
+ return svdup_n_s16(int16_t(arg));
213
+ }
214
+
215
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 4> = 0>
216
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
217
+ {
218
+ return svdup_n_u32(uint32_t(arg));
219
+ }
220
+
221
+ template <class A, class T, detail::enable_sized_signed_t<T, 4> = 0>
222
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
223
+ {
224
+ return svdup_n_s32(int32_t(arg));
225
+ }
226
+
227
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 8> = 0>
228
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
229
+ {
230
+ return svdup_n_u64(uint64_t(arg));
231
+ }
232
+
233
+ template <class A, class T, detail::enable_sized_signed_t<T, 8> = 0>
234
+ XSIMD_INLINE batch<T, A> broadcast(T arg, requires_arch<sve>) noexcept
235
+ {
236
+ return svdup_n_s64(int64_t(arg));
237
+ }
238
+
239
+ template <class A>
240
+ XSIMD_INLINE batch<float, A> broadcast(float arg, requires_arch<sve>) noexcept
241
+ {
242
+ return svdup_n_f32(arg);
243
+ }
244
+
245
+ template <class A>
246
+ XSIMD_INLINE batch<double, A> broadcast(double arg, requires_arch<sve>) noexcept
247
+ {
248
+ return svdup_n_f64(arg);
249
+ }
250
+
251
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
252
+ XSIMD_INLINE batch<T, A> broadcast(T val, requires_arch<sve>) noexcept
253
+ {
254
+ return broadcast<sve>(val, sve {});
255
+ }
256
+
257
+ /**************
258
+ * Arithmetic *
259
+ **************/
260
+
261
+ // add
262
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
263
+ XSIMD_INLINE batch<T, A> add(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
264
+ {
265
+ return svadd_x(detail_sve::ptrue<T>(), lhs, rhs);
266
+ }
267
+
268
+ // sadd
269
+ template <class A, class T, detail::enable_integral_t<T> = 0>
270
+ XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
271
+ {
272
+ return svqadd(lhs, rhs);
273
+ }
274
+
275
+ // sub
276
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
277
+ XSIMD_INLINE batch<T, A> sub(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
278
+ {
279
+ return svsub_x(detail_sve::ptrue<T>(), lhs, rhs);
280
+ }
281
+
282
+ // ssub
283
+ template <class A, class T, detail::enable_integral_t<T> = 0>
284
+ XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
285
+ {
286
+ return svqsub(lhs, rhs);
287
+ }
288
+
289
+ // mul
290
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
291
+ XSIMD_INLINE batch<T, A> mul(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
292
+ {
293
+ return svmul_x(detail_sve::ptrue<T>(), lhs, rhs);
294
+ }
295
+
296
+ // div
297
+ template <class A, class T, std::enable_if_t<sizeof(T) >= 4, int> = 0>
298
+ XSIMD_INLINE batch<T, A> div(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
299
+ {
300
+ return svdiv_x(detail_sve::ptrue<T>(), lhs, rhs);
301
+ }
302
+
303
+ // max
304
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
305
+ XSIMD_INLINE batch<T, A> max(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
306
+ {
307
+ return svmax_x(detail_sve::ptrue<T>(), lhs, rhs);
308
+ }
309
+
310
+ // min
311
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
312
+ XSIMD_INLINE batch<T, A> min(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
313
+ {
314
+ return svmin_x(detail_sve::ptrue<T>(), lhs, rhs);
315
+ }
316
+
317
+ // neg
318
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 1> = 0>
319
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& arg, requires_arch<sve>) noexcept
320
+ {
321
+ return svreinterpret_u8(svneg_x(detail_sve::ptrue<T>(), svreinterpret_s8(static_cast<detail_sve::sizeless_t<T>>(arg))));
322
+ }
323
+
324
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 2> = 0>
325
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& arg, requires_arch<sve>) noexcept
326
+ {
327
+ return svreinterpret_u16(svneg_x(detail_sve::ptrue<T>(), svreinterpret_s16(static_cast<detail_sve::sizeless_t<T>>(arg))));
328
+ }
329
+
330
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 4> = 0>
331
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& arg, requires_arch<sve>) noexcept
332
+ {
333
+ return svreinterpret_u32(svneg_x(detail_sve::ptrue<T>(), svreinterpret_s32(static_cast<detail_sve::sizeless_t<T>>(arg))));
334
+ }
335
+
336
+ template <class A, class T, detail::enable_sized_unsigned_t<T, 8> = 0>
337
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& arg, requires_arch<sve>) noexcept
338
+ {
339
+ return svreinterpret_u64(svneg_x(detail_sve::ptrue<T>(), svreinterpret_s64(static_cast<detail_sve::sizeless_t<T>>(arg))));
340
+ }
341
+
342
+ template <class A, class T, detail::enable_signed_numeral_t<T> = 0>
343
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& arg, requires_arch<sve>) noexcept
344
+ {
345
+ return svneg_x(detail_sve::ptrue<T>(), arg);
346
+ }
347
+
348
+ // abs
349
+ template <class A, class T, detail::enable_unsigned_integral_t<T> = 0>
350
+ XSIMD_INLINE batch<T, A> abs(batch<T, A> const& arg, requires_arch<sve>) noexcept
351
+ {
352
+ return arg;
353
+ }
354
+
355
+ template <class A, class T, detail::enable_signed_numeral_t<T> = 0>
356
+ XSIMD_INLINE batch<T, A> abs(batch<T, A> const& arg, requires_arch<sve>) noexcept
357
+ {
358
+ return svabs_x(detail_sve::ptrue<T>(), arg);
359
+ }
360
+
361
+ // fma: x * y + z
362
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
363
+ XSIMD_INLINE batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<sve>) noexcept
364
+ {
365
+ return svmad_x(detail_sve::ptrue<T>(), x, y, z);
366
+ }
367
+
368
+ // fnma: z - x * y
369
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
370
+ XSIMD_INLINE batch<T, A> fnma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<sve>) noexcept
371
+ {
372
+ return svmsb_x(detail_sve::ptrue<T>(), x, y, z);
373
+ }
374
+
375
+ // fms: x * y - z
376
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
377
+ XSIMD_INLINE batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<sve>) noexcept
378
+ {
379
+ return -fnma(x, y, z, sve {});
380
+ }
381
+
382
+ // fnms: - x * y - z
383
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
384
+ XSIMD_INLINE batch<T, A> fnms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<sve>) noexcept
385
+ {
386
+ return -fma(x, y, z, sve {});
387
+ }
388
+
389
+ /**********************
390
+ * Logical operations *
391
+ **********************/
392
+
393
+ // bitwise_and
394
+ template <class A, class T, detail::enable_integral_t<T> = 0>
395
+ XSIMD_INLINE batch<T, A> bitwise_and(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
396
+ {
397
+ return svand_x(detail_sve::ptrue<T>(), lhs, rhs);
398
+ }
399
+
400
+ template <class A>
401
+ XSIMD_INLINE batch<float, A> bitwise_and(batch<float, A> const& lhs, batch<float, A> const& rhs, requires_arch<sve>) noexcept
402
+ {
403
+ const auto lhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(lhs));
404
+ const auto rhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(rhs));
405
+ const auto result_bits = svand_x(detail_sve::ptrue<float>(), lhs_bits, rhs_bits);
406
+ return svreinterpret_f32(result_bits);
407
+ }
408
+
409
+ template <class A>
410
+ XSIMD_INLINE batch<double, A> bitwise_and(batch<double, A> const& lhs, batch<double, A> const& rhs, requires_arch<sve>) noexcept
411
+ {
412
+ const auto lhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(lhs));
413
+ const auto rhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(rhs));
414
+ const auto result_bits = svand_x(detail_sve::ptrue<double>(), lhs_bits, rhs_bits);
415
+ return svreinterpret_f64(result_bits);
416
+ }
417
+
418
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
419
+ XSIMD_INLINE batch_bool<T, A> bitwise_and(batch_bool<T, A> const& lhs, batch_bool<T, A> const& rhs, requires_arch<sve>) noexcept
420
+ {
421
+ return svand_z(detail_sve::ptrue<T>(), lhs, rhs);
422
+ }
423
+
424
+ // bitwise_andnot
425
+ template <class A, class T, detail::enable_integral_t<T> = 0>
426
+ XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
427
+ {
428
+ return svbic_x(detail_sve::ptrue<T>(), lhs, rhs);
429
+ }
430
+
431
+ template <class A>
432
+ XSIMD_INLINE batch<float, A> bitwise_andnot(batch<float, A> const& lhs, batch<float, A> const& rhs, requires_arch<sve>) noexcept
433
+ {
434
+ const auto lhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(lhs));
435
+ const auto rhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(rhs));
436
+ const auto result_bits = svbic_x(detail_sve::ptrue<float>(), lhs_bits, rhs_bits);
437
+ return svreinterpret_f32(result_bits);
438
+ }
439
+
440
+ template <class A>
441
+ XSIMD_INLINE batch<double, A> bitwise_andnot(batch<double, A> const& lhs, batch<double, A> const& rhs, requires_arch<sve>) noexcept
442
+ {
443
+ const auto lhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(lhs));
444
+ const auto rhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(rhs));
445
+ const auto result_bits = svbic_x(detail_sve::ptrue<double>(), lhs_bits, rhs_bits);
446
+ return svreinterpret_f64(result_bits);
447
+ }
448
+
449
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
450
+ XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& lhs, batch_bool<T, A> const& rhs, requires_arch<sve>) noexcept
451
+ {
452
+ return svbic_z(detail_sve::ptrue<T>(), lhs, rhs);
453
+ }
454
+
455
+ // bitwise_or
456
+ template <class A, class T, detail::enable_integral_t<T> = 0>
457
+ XSIMD_INLINE batch<T, A> bitwise_or(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
458
+ {
459
+ return svorr_x(detail_sve::ptrue<T>(), lhs, rhs);
460
+ }
461
+
462
+ template <class A>
463
+ XSIMD_INLINE batch<float, A> bitwise_or(batch<float, A> const& lhs, batch<float, A> const& rhs, requires_arch<sve>) noexcept
464
+ {
465
+ const auto lhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(lhs));
466
+ const auto rhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(rhs));
467
+ const auto result_bits = svorr_x(detail_sve::ptrue<float>(), lhs_bits, rhs_bits);
468
+ return svreinterpret_f32(result_bits);
469
+ }
470
+
471
+ template <class A>
472
+ XSIMD_INLINE batch<double, A> bitwise_or(batch<double, A> const& lhs, batch<double, A> const& rhs, requires_arch<sve>) noexcept
473
+ {
474
+ const auto lhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(lhs));
475
+ const auto rhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(rhs));
476
+ const auto result_bits = svorr_x(detail_sve::ptrue<double>(), lhs_bits, rhs_bits);
477
+ return svreinterpret_f64(result_bits);
478
+ }
479
+
480
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
481
+ XSIMD_INLINE batch_bool<T, A> bitwise_or(batch_bool<T, A> const& lhs, batch_bool<T, A> const& rhs, requires_arch<sve>) noexcept
482
+ {
483
+ return svorr_z(detail_sve::ptrue<T>(), lhs, rhs);
484
+ }
485
+
486
+ // bitwise_xor
487
+ template <class A, class T, detail::enable_integral_t<T> = 0>
488
+ XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
489
+ {
490
+ return sveor_x(detail_sve::ptrue<T>(), lhs, rhs);
491
+ }
492
+
493
+ template <class A>
494
+ XSIMD_INLINE batch<float, A> bitwise_xor(batch<float, A> const& lhs, batch<float, A> const& rhs, requires_arch<sve>) noexcept
495
+ {
496
+ const auto lhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(lhs));
497
+ const auto rhs_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(rhs));
498
+ const auto result_bits = sveor_x(detail_sve::ptrue<float>(), lhs_bits, rhs_bits);
499
+ return svreinterpret_f32(result_bits);
500
+ }
501
+
502
+ template <class A>
503
+ XSIMD_INLINE batch<double, A> bitwise_xor(batch<double, A> const& lhs, batch<double, A> const& rhs, requires_arch<sve>) noexcept
504
+ {
505
+ const auto lhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(lhs));
506
+ const auto rhs_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(rhs));
507
+ const auto result_bits = sveor_x(detail_sve::ptrue<double>(), lhs_bits, rhs_bits);
508
+ return svreinterpret_f64(result_bits);
509
+ }
510
+
511
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
512
+ XSIMD_INLINE batch_bool<T, A> bitwise_xor(batch_bool<T, A> const& lhs, batch_bool<T, A> const& rhs, requires_arch<sve>) noexcept
513
+ {
514
+ return sveor_z(detail_sve::ptrue<T>(), lhs, rhs);
515
+ }
516
+
517
+ // bitwise_not
518
+ template <class A, class T, detail::enable_integral_t<T> = 0>
519
+ XSIMD_INLINE batch<T, A> bitwise_not(batch<T, A> const& arg, requires_arch<sve>) noexcept
520
+ {
521
+ return svnot_x(detail_sve::ptrue<T>(), arg);
522
+ }
523
+
524
+ template <class A>
525
+ XSIMD_INLINE batch<float, A> bitwise_not(batch<float, A> const& arg, requires_arch<sve>) noexcept
526
+ {
527
+ const auto arg_bits = svreinterpret_u32(static_cast<detail_sve::sizeless_t<float>>(arg));
528
+ const auto result_bits = svnot_x(detail_sve::ptrue<float>(), arg_bits);
529
+ return svreinterpret_f32(result_bits);
530
+ }
531
+
532
+ template <class A>
533
+ XSIMD_INLINE batch<double, A> bitwise_not(batch<double, A> const& arg, requires_arch<sve>) noexcept
534
+ {
535
+ const auto arg_bits = svreinterpret_u64(static_cast<detail_sve::sizeless_t<double>>(arg));
536
+ const auto result_bits = svnot_x(detail_sve::ptrue<double>(), arg_bits);
537
+ return svreinterpret_f64(result_bits);
538
+ }
539
+
540
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
541
+ XSIMD_INLINE batch_bool<T, A> bitwise_not(batch_bool<T, A> const& arg, requires_arch<sve>) noexcept
542
+ {
543
+ return svnot_z(detail_sve::ptrue<T>(), arg);
544
+ }
545
+
546
+ /**********
547
+ * Shifts *
548
+ **********/
549
+
550
+ namespace detail_sve
551
+ {
552
+ inline namespace XSIMD_SVE_NAMESPACE
553
+ {
554
+ template <class A, class T, class U>
555
+ XSIMD_INLINE batch<U, A> to_unsigned_batch_impl(batch<T, A> const& arg, index<1>) noexcept
556
+ {
557
+ return svreinterpret_u8(static_cast<sizeless_t<T>>(arg));
558
+ }
559
+
560
+ template <class A, class T, class U>
561
+ XSIMD_INLINE batch<U, A> to_unsigned_batch_impl(batch<T, A> const& arg, index<2>) noexcept
562
+ {
563
+ return svreinterpret_u16(static_cast<sizeless_t<T>>(arg));
564
+ }
565
+
566
+ template <class A, class T, class U>
567
+ XSIMD_INLINE batch<U, A> to_unsigned_batch_impl(batch<T, A> const& arg, index<4>) noexcept
568
+ {
569
+ return svreinterpret_u32(static_cast<sizeless_t<T>>(arg));
570
+ }
571
+
572
+ template <class A, class T, class U>
573
+ XSIMD_INLINE batch<U, A> to_unsigned_batch_impl(batch<T, A> const& arg, index<8>) noexcept
574
+ {
575
+ return svreinterpret_u64(static_cast<sizeless_t<T>>(arg));
576
+ }
577
+
578
+ template <class A, class T, class U = as_unsigned_integer_t<T>>
579
+ XSIMD_INLINE batch<U, A> to_unsigned_batch(batch<T, A> const& arg) noexcept
580
+ {
581
+ return to_unsigned_batch_impl<A, T, U>(arg, index<sizeof(T)> {});
582
+ }
583
+ } // namespace XSIMD_SVE_NAMESPACE
584
+ } // namespace detail_sve
585
+
586
+ // bitwise_lshift
587
+ template <class A, class T, detail::enable_integral_t<T> = 0>
588
+ XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& arg, int n, requires_arch<sve>) noexcept
589
+ {
590
+ constexpr std::size_t size = sizeof(typename batch<T, A>::value_type) * 8;
591
+ assert(0 <= n && static_cast<std::size_t>(n) < size && "index in bounds");
592
+ return svlsl_x(detail_sve::ptrue<T>(), arg, n);
593
+ }
594
+
595
+ template <class A, class T, detail::enable_integral_t<T> = 0>
596
+ XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
597
+ {
598
+ return svlsl_x(detail_sve::ptrue<T>(), lhs, detail_sve::to_unsigned_batch<A, T>(rhs));
599
+ }
600
+
601
+ // bitwise_rshift
602
+ template <class A, class T, detail::enable_unsigned_integral_t<T> = 0>
603
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& arg, int n, requires_arch<sve>) noexcept
604
+ {
605
+ constexpr std::size_t size = sizeof(typename batch<T, A>::value_type) * 8;
606
+ assert(0 <= n && static_cast<std::size_t>(n) < size && "index in bounds");
607
+ return svlsr_x(detail_sve::ptrue<T>(), arg, static_cast<T>(n));
608
+ }
609
+
610
+ template <class A, class T, detail::enable_unsigned_integral_t<T> = 0>
611
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
612
+ {
613
+ return svlsr_x(detail_sve::ptrue<T>(), lhs, rhs);
614
+ }
615
+
616
+ template <class A, class T, detail::enable_signed_integral_t<T> = 0>
617
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& arg, int n, requires_arch<sve>) noexcept
618
+ {
619
+ constexpr std::size_t size = sizeof(typename batch<T, A>::value_type) * 8;
620
+ assert(0 <= n && static_cast<std::size_t>(n) < size && "index in bounds");
621
+ return svasr_x(detail_sve::ptrue<T>(), arg, static_cast<as_unsigned_integer_t<T>>(n));
622
+ }
623
+
624
+ template <class A, class T, detail::enable_signed_integral_t<T> = 0>
625
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
626
+ {
627
+ return svasr_x(detail_sve::ptrue<T>(), lhs, detail_sve::to_unsigned_batch<A, T>(rhs));
628
+ }
629
+
630
+ /**************
631
+ * Reductions *
632
+ **************/
633
+
634
+ // reduce_add
635
+ template <class A, class T, class V = typename batch<T, A>::value_type, detail::enable_arithmetic_t<T> = 0>
636
+ XSIMD_INLINE V reduce_add(batch<T, A> const& arg, requires_arch<sve>) noexcept
637
+ {
638
+ // sve integer reduction results are promoted to 64 bits
639
+ return static_cast<V>(svaddv(detail_sve::ptrue<T>(), arg));
640
+ }
641
+
642
+ // reduce_max
643
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
644
+ XSIMD_INLINE T reduce_max(batch<T, A> const& arg, requires_arch<sve>) noexcept
645
+ {
646
+ return svmaxv(detail_sve::ptrue<T>(), arg);
647
+ }
648
+
649
+ // reduce_min
650
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
651
+ XSIMD_INLINE T reduce_min(batch<T, A> const& arg, requires_arch<sve>) noexcept
652
+ {
653
+ return svminv(detail_sve::ptrue<T>(), arg);
654
+ }
655
+
656
+ // haddp
657
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
658
+ XSIMD_INLINE batch<T, A> haddp(const batch<T, A>* row, requires_arch<sve>) noexcept
659
+ {
660
+ constexpr std::size_t size = batch<T, A>::size;
661
+ T sums[size];
662
+ for (std::size_t i = 0; i < size; ++i)
663
+ {
664
+ sums[i] = reduce_add(row[i], sve {});
665
+ }
666
+ return svld1(detail_sve::ptrue<T>(), sums);
667
+ }
668
+
669
+ /***************
670
+ * Comparisons *
671
+ ***************/
672
+
673
+ // eq
674
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
675
+ XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
676
+ {
677
+ return svcmpeq(detail_sve::ptrue<T>(), lhs, rhs);
678
+ }
679
+
680
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
681
+ XSIMD_INLINE batch_bool<T, A> eq(batch_bool<T, A> const& lhs, batch_bool<T, A> const& rhs, requires_arch<sve>) noexcept
682
+ {
683
+ const auto neq_result = sveor_z(detail_sve::ptrue<T>(), lhs, rhs);
684
+ return svnot_z(detail_sve::ptrue<T>(), neq_result);
685
+ }
686
+
687
+ // neq
688
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
689
+ XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
690
+ {
691
+ return svcmpne(detail_sve::ptrue<T>(), lhs, rhs);
692
+ }
693
+
694
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
695
+ XSIMD_INLINE batch_bool<T, A> neq(batch_bool<T, A> const& lhs, batch_bool<T, A> const& rhs, requires_arch<sve>) noexcept
696
+ {
697
+ return sveor_z(detail_sve::ptrue<T>(), lhs, rhs);
698
+ }
699
+
700
+ // lt
701
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
702
+ XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
703
+ {
704
+ return svcmplt(detail_sve::ptrue<T>(), lhs, rhs);
705
+ }
706
+
707
+ // le
708
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
709
+ XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
710
+ {
711
+ return svcmple(detail_sve::ptrue<T>(), lhs, rhs);
712
+ }
713
+
714
+ // gt
715
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
716
+ XSIMD_INLINE batch_bool<T, A> gt(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
717
+ {
718
+ return svcmpgt(detail_sve::ptrue<T>(), lhs, rhs);
719
+ }
720
+
721
+ // ge
722
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
723
+ XSIMD_INLINE batch_bool<T, A> ge(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
724
+ {
725
+ return svcmpge(detail_sve::ptrue<T>(), lhs, rhs);
726
+ }
727
+
728
+ /***************
729
+ * Permutation *
730
+ ***************/
731
+
732
+ // rotate_left
733
+ template <size_t N, class A, class T, detail::enable_arithmetic_t<T> = 0>
734
+ XSIMD_INLINE batch<T, A> rotate_left(batch<T, A> const& a, requires_arch<sve>) noexcept
735
+ {
736
+ return svext(a, a, N);
737
+ }
738
+
739
+ // swizzle (dynamic)
740
+ template <class A, class T, class I>
741
+ XSIMD_INLINE batch<T, A> swizzle(batch<T, A> const& arg, batch<I, A> indices, requires_arch<sve>) noexcept
742
+ {
743
+ return svtbl(arg, indices);
744
+ }
745
+
746
+ template <class A, class T, class I>
747
+ XSIMD_INLINE batch<std::complex<T>, A> swizzle(batch<std::complex<T>, A> const& self,
748
+ batch<I, A> indices,
749
+ requires_arch<sve>) noexcept
750
+ {
751
+ const auto real = swizzle(self.real(), indices, sve {});
752
+ const auto imag = swizzle(self.imag(), indices, sve {});
753
+ return batch<std::complex<T>>(real, imag);
754
+ }
755
+
756
+ // swizzle (static)
757
+ template <class A, class T, class I, I... idx>
758
+ XSIMD_INLINE batch<T, A> swizzle(batch<T, A> const& arg, batch_constant<I, A, idx...> indices, requires_arch<sve>) noexcept
759
+ {
760
+ static_assert(batch<T, A>::size == sizeof...(idx), "invalid swizzle indices");
761
+ return swizzle(arg, indices.as_batch(), sve {});
762
+ }
763
+
764
+ template <class A, class T, class I, I... idx>
765
+ XSIMD_INLINE batch<std::complex<T>, A> swizzle(batch<std::complex<T>, A> const& arg,
766
+ batch_constant<I, A, idx...> indices,
767
+ requires_arch<sve>) noexcept
768
+ {
769
+ static_assert(batch<std::complex<T>, A>::size == sizeof...(idx), "invalid swizzle indices");
770
+ return swizzle(arg, indices.as_batch(), sve {});
771
+ }
772
+
773
+ /*************
774
+ * Selection *
775
+ *************/
776
+
777
+ // extract_pair
778
+ namespace detail_sve
779
+ {
780
+ inline namespace XSIMD_SVE_NAMESPACE
781
+ {
782
+ template <class A, class T>
783
+ XSIMD_INLINE batch<T, A> extract_pair(batch<T, A> const&, batch<T, A> const& /*rhs*/, std::size_t, std::index_sequence<>) noexcept
784
+ {
785
+ assert(false && "extract_pair out of bounds");
786
+ return batch<T, A> {};
787
+ }
788
+
789
+ template <class A, class T, size_t I, size_t... Is>
790
+ XSIMD_INLINE batch<T, A> extract_pair(batch<T, A> const& lhs, batch<T, A> const& rhs, std::size_t n, std::index_sequence<I, Is...>) noexcept
791
+ {
792
+ if (n == I)
793
+ {
794
+ return svext(rhs, lhs, I);
795
+ }
796
+ else
797
+ {
798
+ return extract_pair(lhs, rhs, n, std::index_sequence<Is...>());
799
+ }
800
+ }
801
+
802
+ template <class A, class T, size_t... Is>
803
+ XSIMD_INLINE batch<T, A> extract_pair_impl(batch<T, A> const& lhs, batch<T, A> const& rhs, std::size_t n, std::index_sequence<0, Is...>) noexcept
804
+ {
805
+ if (n == 0)
806
+ {
807
+ return rhs;
808
+ }
809
+ else
810
+ {
811
+ return extract_pair(lhs, rhs, n, std::index_sequence<Is...>());
812
+ }
813
+ }
814
+ } // namespace XSIMD_SVE_NAMESPACE
815
+ } // namespace detail_sve
816
+
817
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
818
+ XSIMD_INLINE batch<T, A> extract_pair(batch<T, A> const& lhs, batch<T, A> const& rhs, std::size_t n, requires_arch<sve>) noexcept
819
+ {
820
+ constexpr std::size_t size = batch<T, A>::size;
821
+ assert(n < size && "index in bounds");
822
+ return detail_sve::extract_pair_impl(lhs, rhs, n, std::make_index_sequence<size>());
823
+ }
824
+
825
+ // select
826
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
827
+ XSIMD_INLINE batch<T, A> select(batch_bool<T, A> const& cond, batch<T, A> const& a, batch<T, A> const& b, requires_arch<sve>) noexcept
828
+ {
829
+ return svsel(cond, static_cast<detail_sve::sizeless_t<T>>(a), static_cast<detail_sve::sizeless_t<T>>(b));
830
+ }
831
+
832
+ template <class A, class T, bool... b>
833
+ XSIMD_INLINE batch<T, A> select(batch_bool_constant<T, A, b...> const&, batch<T, A> const& true_br, batch<T, A> const& false_br, requires_arch<sve>) noexcept
834
+ {
835
+ return select(batch_bool<T, A> { b... }, true_br, false_br, sve {});
836
+ }
837
+
838
+ // zip_lo
839
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
840
+ XSIMD_INLINE batch<T, A> zip_lo(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
841
+ {
842
+ return svzip1(lhs, rhs);
843
+ }
844
+
845
+ // zip_hi
846
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
847
+ XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<sve>) noexcept
848
+ {
849
+ return svzip2(lhs, rhs);
850
+ }
851
+
852
+ /*****************************
853
+ * Floating-point arithmetic *
854
+ *****************************/
855
+
856
+ // rsqrt
857
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
858
+ XSIMD_INLINE batch<T, A> rsqrt(batch<T, A> const& arg, requires_arch<sve>) noexcept
859
+ {
860
+ return svrsqrte(arg);
861
+ }
862
+
863
+ // sqrt
864
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
865
+ XSIMD_INLINE batch<T, A> sqrt(batch<T, A> const& arg, requires_arch<sve>) noexcept
866
+ {
867
+ return svsqrt_x(detail_sve::ptrue<T>(), arg);
868
+ }
869
+
870
+ // reciprocal
871
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
872
+ XSIMD_INLINE batch<T, A> reciprocal(const batch<T, A>& arg, requires_arch<sve>) noexcept
873
+ {
874
+ return svrecpe(arg);
875
+ }
876
+
877
+ /******************************
878
+ * Floating-point conversions *
879
+ ******************************/
880
+
881
+ // fast_cast
882
+ namespace detail_sve
883
+ {
884
+ inline namespace XSIMD_SVE_NAMESPACE
885
+ {
886
+ template <class A, class T, detail::enable_sized_integral_t<T, 4> = 0>
887
+ XSIMD_INLINE batch<float, A> fast_cast(batch<T, A> const& arg, batch<float, A> const&, requires_arch<sve>) noexcept
888
+ {
889
+ return svcvt_f32_x(detail_sve::ptrue<T>(), arg);
890
+ }
891
+
892
+ template <class A, class T, detail::enable_sized_integral_t<T, 8> = 0>
893
+ XSIMD_INLINE batch<double, A> fast_cast(batch<T, A> const& arg, batch<double, A> const&, requires_arch<sve>) noexcept
894
+ {
895
+ return svcvt_f64_x(detail_sve::ptrue<T>(), arg);
896
+ }
897
+
898
+ template <class A>
899
+ XSIMD_INLINE batch<int32_t, A> fast_cast(batch<float, A> const& arg, batch<int32_t, A> const&, requires_arch<sve>) noexcept
900
+ {
901
+ return svcvt_s32_x(detail_sve::ptrue<float>(), arg);
902
+ }
903
+
904
+ template <class A>
905
+ XSIMD_INLINE batch<uint32_t, A> fast_cast(batch<float, A> const& arg, batch<uint32_t, A> const&, requires_arch<sve>) noexcept
906
+ {
907
+ return svcvt_u32_x(detail_sve::ptrue<float>(), arg);
908
+ }
909
+
910
+ template <class A>
911
+ XSIMD_INLINE batch<int64_t, A> fast_cast(batch<double, A> const& arg, batch<int64_t, A> const&, requires_arch<sve>) noexcept
912
+ {
913
+ return svcvt_s64_x(detail_sve::ptrue<double>(), arg);
914
+ }
915
+
916
+ template <class A>
917
+ XSIMD_INLINE batch<uint64_t, A> fast_cast(batch<double, A> const& arg, batch<uint64_t, A> const&, requires_arch<sve>) noexcept
918
+ {
919
+ return svcvt_u64_x(detail_sve::ptrue<double>(), arg);
920
+ }
921
+ } // namespace XSIMD_SVE_NAMESPACE
922
+ } // namespace detail_sve
923
+
924
+ /*********
925
+ * Miscs *
926
+ *********/
927
+
928
+ // set
929
+ template <class A, class T, class... Args>
930
+ XSIMD_INLINE batch<T, A> set(batch<T, A> const&, requires_arch<sve>, Args... args) noexcept
931
+ {
932
+ return detail_sve::sve_vector_type<T> { args... };
933
+ }
934
+
935
+ template <class A, class T, class... Args>
936
+ XSIMD_INLINE batch<std::complex<T>, A> set(batch<std::complex<T>, A> const&, requires_arch<sve>,
937
+ Args... args_complex) noexcept
938
+ {
939
+ return batch<std::complex<T>>(detail_sve::sve_vector_type<T> { args_complex.real()... },
940
+ detail_sve::sve_vector_type<T> { args_complex.imag()... });
941
+ }
942
+
943
+ template <class A, class T, class... Args>
944
+ XSIMD_INLINE batch_bool<T, A> set(batch_bool<T, A> const&, requires_arch<sve>, Args... args) noexcept
945
+ {
946
+ using U = as_unsigned_integer_t<T>;
947
+ const auto values = detail_sve::sve_vector_type<U> { static_cast<U>(args)... };
948
+ const auto zero = broadcast<A, U>(static_cast<U>(0), sve {});
949
+ return svcmpne(detail_sve::ptrue<T>(), values, zero);
950
+ }
951
+
952
+ // insert
953
+ namespace detail_sve
954
+ {
955
+ inline namespace XSIMD_SVE_NAMESPACE
956
+ {
957
+ // generate index sequence (iota)
958
+ XSIMD_INLINE svuint8_t iota_impl(index<1>) noexcept { return svindex_u8(0, 1); }
959
+ XSIMD_INLINE svuint16_t iota_impl(index<2>) noexcept { return svindex_u16(0, 1); }
960
+ XSIMD_INLINE svuint32_t iota_impl(index<4>) noexcept { return svindex_u32(0, 1); }
961
+ XSIMD_INLINE svuint64_t iota_impl(index<8>) noexcept { return svindex_u64(0, 1); }
962
+
963
+ template <class T, class V = sve_vector_type<as_unsigned_integer_t<T>>>
964
+ XSIMD_INLINE V iota() noexcept { return iota_impl(index<sizeof(T)> {}); }
965
+ } // namespace XSIMD_SVE_NAMESPACE
966
+ } // namespace detail_sve
967
+
968
+ template <class A, class T, size_t I, detail::enable_arithmetic_t<T> = 0>
969
+ XSIMD_INLINE batch<T, A> insert(batch<T, A> const& arg, T val, index<I>, requires_arch<sve>) noexcept
970
+ {
971
+ // create a predicate with only the I-th lane activated
972
+ const auto iota = detail_sve::iota<T>();
973
+ const auto index_predicate = svcmpeq(detail_sve::ptrue<T>(), iota, static_cast<as_unsigned_integer_t<T>>(I));
974
+ return svsel(index_predicate, static_cast<detail_sve::sizeless_t<T>>(broadcast<A, T>(val, sve {})), static_cast<detail_sve::sizeless_t<T>>(arg));
975
+ }
976
+
977
+ // first
978
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
979
+ XSIMD_INLINE T first(batch<T, A> const& self, requires_arch<sve>) noexcept
980
+ {
981
+ return self.data[0];
982
+ }
983
+
984
+ // all
985
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
986
+ XSIMD_INLINE bool all(batch_bool<T, A> const& arg, requires_arch<sve>) noexcept
987
+ {
988
+ return detail_sve::pcount<T>(arg) == batch_bool<T, A>::size;
989
+ }
990
+
991
+ // any
992
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
993
+ XSIMD_INLINE bool any(batch_bool<T, A> const& arg, requires_arch<sve>) noexcept
994
+ {
995
+ return svptest_any(arg, arg);
996
+ }
997
+
998
+ // bitwise_cast
999
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_unsigned_t<R, 1> = 0>
1000
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1001
+ {
1002
+ return svreinterpret_u8(static_cast<detail_sve::sizeless_t<T>>(arg));
1003
+ }
1004
+
1005
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_signed_t<R, 1> = 0>
1006
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1007
+ {
1008
+ return svreinterpret_s8(static_cast<detail_sve::sizeless_t<T>>(arg));
1009
+ }
1010
+
1011
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_unsigned_t<R, 2> = 0>
1012
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1013
+ {
1014
+ return svreinterpret_u16(static_cast<detail_sve::sizeless_t<T>>(arg));
1015
+ }
1016
+
1017
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_signed_t<R, 2> = 0>
1018
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1019
+ {
1020
+ return svreinterpret_s16(static_cast<detail_sve::sizeless_t<T>>(arg));
1021
+ }
1022
+
1023
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_unsigned_t<R, 4> = 0>
1024
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1025
+ {
1026
+ return svreinterpret_u32(static_cast<detail_sve::sizeless_t<T>>(arg));
1027
+ }
1028
+
1029
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_signed_t<R, 4> = 0>
1030
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1031
+ {
1032
+ return svreinterpret_s32(static_cast<detail_sve::sizeless_t<T>>(arg));
1033
+ }
1034
+
1035
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_unsigned_t<R, 8> = 0>
1036
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1037
+ {
1038
+ return svreinterpret_u64(static_cast<detail_sve::sizeless_t<T>>(arg));
1039
+ }
1040
+
1041
+ template <class A, class T, class R, detail::enable_arithmetic_t<T> = 0, detail::enable_sized_signed_t<R, 8> = 0>
1042
+ XSIMD_INLINE batch<R, A> bitwise_cast(batch<T, A> const& arg, batch<R, A> const&, requires_arch<sve>) noexcept
1043
+ {
1044
+ return svreinterpret_s64(static_cast<detail_sve::sizeless_t<T>>(arg));
1045
+ }
1046
+
1047
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
1048
+ XSIMD_INLINE batch<float, A> bitwise_cast(batch<T, A> const& arg, batch<float, A> const&, requires_arch<sve>) noexcept
1049
+ {
1050
+ return svreinterpret_f32(static_cast<detail_sve::sizeless_t<T>>(arg));
1051
+ }
1052
+
1053
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
1054
+ XSIMD_INLINE batch<double, A> bitwise_cast(batch<T, A> const& arg, batch<double, A> const&, requires_arch<sve>) noexcept
1055
+ {
1056
+ return svreinterpret_f64(static_cast<detail_sve::sizeless_t<T>>(arg));
1057
+ }
1058
+
1059
+ // batch_bool_cast
1060
+ template <class A, class T_out, class T_in, detail::enable_arithmetic_t<T_in> = 0>
1061
+ XSIMD_INLINE batch_bool<T_out, A> batch_bool_cast(batch_bool<T_in, A> const& arg, batch_bool<T_out, A> const&, requires_arch<sve>) noexcept
1062
+ {
1063
+ return arg.data;
1064
+ }
1065
+
1066
+ // from_bool
1067
+ template <class A, class T, detail::enable_arithmetic_t<T> = 0>
1068
+ XSIMD_INLINE batch<T, A> from_bool(batch_bool<T, A> const& arg, requires_arch<sve>) noexcept
1069
+ {
1070
+ return select(arg, batch<T, A>(1), batch<T, A>(0));
1071
+ }
1072
+
1073
+ // slide_left
1074
+ namespace detail_sve
1075
+ {
1076
+ inline namespace XSIMD_SVE_NAMESPACE
1077
+ {
1078
+ template <size_t N>
1079
+ struct slider_left
1080
+ {
1081
+ template <class A, class T>
1082
+ XSIMD_INLINE batch<T, A> operator()(batch<T, A> const& arg) noexcept
1083
+ {
1084
+ using u8_vector = batch<uint8_t, A>;
1085
+ const auto left = svdup_n_u8(0);
1086
+ const auto right = bitwise_cast(arg, u8_vector {}, sve {}).data;
1087
+ const u8_vector result(svext(left, right, u8_vector::size - N));
1088
+ return bitwise_cast(result, batch<T, A> {}, sve {});
1089
+ }
1090
+ };
1091
+
1092
+ template <>
1093
+ struct slider_left<0>
1094
+ {
1095
+ template <class A, class T>
1096
+ XSIMD_INLINE batch<T, A> operator()(batch<T, A> const& arg) noexcept
1097
+ {
1098
+ return arg;
1099
+ }
1100
+ };
1101
+ } // namespace XSIMD_SVE_NAMESPACE
1102
+ } // namespace detail_sve
1103
+
1104
+ template <size_t N, class A, class T, detail::enable_arithmetic_t<T> = 0>
1105
+ XSIMD_INLINE batch<T, A> slide_left(batch<T, A> const& arg, requires_arch<sve>) noexcept
1106
+ {
1107
+ return detail_sve::slider_left<N>()(arg);
1108
+ }
1109
+
1110
+ // slide_right
1111
+ namespace detail_sve
1112
+ {
1113
+ inline namespace XSIMD_SVE_NAMESPACE
1114
+ {
1115
+ template <size_t N>
1116
+ struct slider_right
1117
+ {
1118
+ template <class A, class T>
1119
+ XSIMD_INLINE batch<T, A> operator()(batch<T, A> const& arg) noexcept
1120
+ {
1121
+ using u8_vector = batch<uint8_t, A>;
1122
+ const auto left = bitwise_cast(arg, u8_vector {}, sve {}).data;
1123
+ const auto right = svdup_n_u8(0);
1124
+ const u8_vector result(svext(left, right, N));
1125
+ return bitwise_cast(result, batch<T, A> {}, sve {});
1126
+ }
1127
+ };
1128
+
1129
+ template <>
1130
+ struct slider_right<batch<uint8_t, sve>::size>
1131
+ {
1132
+ template <class A, class T>
1133
+ XSIMD_INLINE batch<T, A> operator()(batch<T, A> const&) noexcept
1134
+ {
1135
+ return batch<T, A> {};
1136
+ }
1137
+ };
1138
+ } // namespace XSIMD_SVE_NAMESPACE
1139
+ } // namespace detail_sve
1140
+
1141
+ template <size_t N, class A, class T, detail::enable_arithmetic_t<T> = 0>
1142
+ XSIMD_INLINE batch<T, A> slide_right(batch<T, A> const& arg, requires_arch<sve>) noexcept
1143
+ {
1144
+ return detail_sve::slider_right<N>()(arg);
1145
+ }
1146
+
1147
+ // isnan
1148
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
1149
+ XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const& arg, requires_arch<sve>) noexcept
1150
+ {
1151
+ return !(arg == arg);
1152
+ }
1153
+
1154
+ // nearbyint
1155
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
1156
+ XSIMD_INLINE batch<T, A> nearbyint(batch<T, A> const& arg, requires_arch<sve>) noexcept
1157
+ {
1158
+ return svrintx_x(detail_sve::ptrue<T>(), arg);
1159
+ }
1160
+
1161
+ // nearbyint_as_int
1162
+ template <class A>
1163
+ XSIMD_INLINE batch<int32_t, A> nearbyint_as_int(batch<float, A> const& arg, requires_arch<sve>) noexcept
1164
+ {
1165
+ const auto nearest = svrintx_x(detail_sve::ptrue<float>(), arg);
1166
+ return svcvt_s32_x(detail_sve::ptrue<float>(), nearest);
1167
+ }
1168
+
1169
+ template <class A>
1170
+ XSIMD_INLINE batch<int64_t, A> nearbyint_as_int(batch<double, A> const& arg, requires_arch<sve>) noexcept
1171
+ {
1172
+ const auto nearest = svrintx_x(detail_sve::ptrue<double>(), arg);
1173
+ return svcvt_s64_x(detail_sve::ptrue<double>(), nearest);
1174
+ }
1175
+
1176
+ // ldexp
1177
+ template <class A, class T, detail::enable_floating_point_t<T> = 0>
1178
+ XSIMD_INLINE batch<T, A> ldexp(const batch<T, A>& x, const batch<as_integer_t<T>, A>& exp, requires_arch<sve>) noexcept
1179
+ {
1180
+ return svscale_x(detail_sve::ptrue<T>(), x, exp);
1181
+ }
1182
+
1183
+ } // namespace kernel
1184
+ } // namespace xsimd
1185
+
1186
+ #endif