react-native-executorch 0.10.5 → 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 (251) hide show
  1. package/README.md +10 -1
  2. package/android/build.gradle.kts +4 -3
  3. package/ios/RnExecutorch.mm +15 -17
  4. package/lib/module/fetcher/fetcher.js +35 -122
  5. package/lib/module/fetcher/fetcher.js.map +1 -1
  6. package/lib/module/fetcher/telemetry.js +1 -1
  7. package/lib/module/index.js +12 -13
  8. package/lib/module/index.js.map +1 -1
  9. package/lib/module/models.js +4 -2
  10. package/lib/module/models.js.map +1 -1
  11. package/lib/typescript/src/fetcher/fetcher.d.ts +3 -7
  12. package/lib/typescript/src/fetcher/fetcher.d.ts.map +1 -1
  13. package/lib/typescript/src/models.d.ts.map +1 -1
  14. package/package.json +9 -7
  15. package/react-native-executorch.podspec +6 -2
  16. package/src/fetcher/fetcher.ts +38 -131
  17. package/src/fetcher/telemetry.ts +1 -1
  18. package/src/models.ts +6 -1
  19. package/third-party/common/phonemis/CMakeLists.txt +70 -14
  20. package/third-party/common/phonemis/README.md +183 -33
  21. package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
  22. package/third-party/common/phonemis/knowledge/code_style.md +642 -0
  23. package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
  24. package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
  25. package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
  26. package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
  27. package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
  28. package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
  29. package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
  30. package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
  31. package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
  32. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
  33. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
  34. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
  35. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
  36. package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
  37. package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
  38. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
  39. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
  40. package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
  41. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
  42. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
  43. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
  44. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
  45. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
  46. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
  47. package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
  48. package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
  49. package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
  50. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
  51. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
  52. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
  53. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
  54. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
  55. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
  56. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
  57. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
  58. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
  59. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
  60. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
  61. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
  62. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
  63. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
  64. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
  65. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
  66. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
  67. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
  68. package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
  69. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
  70. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
  71. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
  72. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
  73. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
  74. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
  75. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
  76. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
  77. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
  78. package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
  79. package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
  80. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
  81. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
  82. package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
  83. package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
  84. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
  85. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
  86. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
  87. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
  88. package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
  89. package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
  90. package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
  91. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
  92. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
  93. package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
  94. package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
  95. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
  96. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
  97. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
  98. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
  99. package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
  100. package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
  101. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
  102. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
  103. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
  104. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
  105. package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
  106. package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
  107. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
  108. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
  109. package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
  110. package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
  111. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
  112. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
  113. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
  114. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
  115. package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
  116. package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
  117. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
  118. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
  119. package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
  120. package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
  121. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
  122. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
  123. package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
  124. package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
  125. package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
  126. package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
  127. package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
  128. package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
  129. package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
  130. package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
  131. package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
  132. package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
  133. package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
  134. package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
  135. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
  136. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
  137. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
  138. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
  139. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
  140. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
  141. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
  142. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
  143. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
  144. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
  145. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
  146. package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
  147. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
  148. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
  149. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
  150. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
  151. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
  152. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
  153. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
  154. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
  155. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
  156. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
  157. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
  158. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
  159. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
  160. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
  161. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
  162. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
  163. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
  164. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
  165. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
  166. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
  167. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
  168. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
  169. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
  170. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
  171. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
  172. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
  173. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
  174. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
  175. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
  176. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
  177. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
  178. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
  179. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
  180. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
  181. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
  182. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
  183. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
  184. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
  185. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
  186. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
  187. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
  188. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
  189. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
  190. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
  191. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
  192. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
  193. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
  194. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
  195. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
  196. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
  197. package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
  198. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
  199. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
  200. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
  201. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
  202. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
  203. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
  204. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
  205. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
  206. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
  207. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
  208. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
  209. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
  210. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
  211. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
  212. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
  213. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
  214. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
  215. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
  216. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
  217. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
  218. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
  219. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
  220. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
  221. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
  222. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
  223. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
  224. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
  225. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
  226. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
  227. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
  228. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
  229. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
  230. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
  231. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
  232. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
  233. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
  234. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
  235. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
  236. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
  237. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
  238. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
  239. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
  240. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
  241. package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
  242. package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
  243. package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
  244. package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
  245. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
  246. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
  247. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
  248. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
  249. package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
  250. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
  251. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
@@ -0,0 +1,787 @@
1
+ /***************************************************************************
2
+ * Copyright (c) Andreas Krebbel *
3
+ * Based on xsimd_vsx.hpp *
4
+ * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
5
+ * Martin Renou *
6
+ * Copyright (c) QuantStack *
7
+ * Copyright (c) Serge Guelton *
8
+ * *
9
+ * Distributed under the terms of the BSD 3-Clause License. *
10
+ * *
11
+ * The full license is in the file LICENSE, distributed with this software. *
12
+ ****************************************************************************/
13
+
14
+ #ifndef XSIMD_VXE_HPP
15
+ #define XSIMD_VXE_HPP
16
+
17
+ #include <type_traits>
18
+
19
+ #include "../types/xsimd_vxe_register.hpp"
20
+
21
+ namespace xsimd
22
+ {
23
+ namespace kernel
24
+ {
25
+ using namespace types;
26
+ using v1ti = __int128 __attribute__((vector_size(16)));
27
+ using v4sf = float __attribute__((vector_size(16)));
28
+ using v2df = double __attribute__((vector_size(16)));
29
+ using uv2di = unsigned long long int __attribute__((vector_size(16)));
30
+ using v2di = long long int __attribute__((vector_size(16)));
31
+ using uv4si = unsigned int __attribute__((vector_size(16)));
32
+ using v4si = int __attribute__((vector_size(16)));
33
+ using uv8hi = unsigned short int __attribute__((vector_size(16)));
34
+ using v8hi = short int __attribute__((vector_size(16)));
35
+ using uv16qi = unsigned char __attribute__((vector_size(16)));
36
+ using v16qi = signed char __attribute__((vector_size(16)));
37
+
38
+ // builtin_t<T> - the scalar type as it would be used for a vector intrinsic
39
+ // VXE vector intrinsics do not support long, unsigned long, and char
40
+ // The builtin<T> definition can be used to map the incoming
41
+ // type to the right one to be used with the intrinsics.
42
+ template <typename T>
43
+ struct builtin_scalar
44
+ {
45
+ using type = T;
46
+ };
47
+
48
+ template <>
49
+ struct builtin_scalar<unsigned long>
50
+ {
51
+ using type = unsigned long long;
52
+ };
53
+
54
+ template <>
55
+ struct builtin_scalar<long>
56
+ {
57
+ using type = long long;
58
+ };
59
+
60
+ template <>
61
+ struct builtin_scalar<char>
62
+ {
63
+ using type = typename std::conditional<std::is_signed<char>::value, signed char, unsigned char>::type;
64
+ };
65
+
66
+ template <typename T>
67
+ using builtin_t = typename builtin_scalar<T>::type;
68
+
69
+ // bitwise_cast
70
+ template <class A, class T_in, class T_out>
71
+ XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<vxe>) noexcept
72
+ {
73
+ return (typename batch<T_out, A>::register_type)(self.data);
74
+ }
75
+
76
+ // batch_bool_cast
77
+ template <class A, class T_out, class T_in>
78
+ XSIMD_INLINE batch_bool<T_out, A> batch_bool_cast(batch_bool<T_in, A> const& self, batch_bool<T_out, A> const&, requires_arch<vxe>) noexcept
79
+ {
80
+ return (typename batch_bool<T_out, A>::register_type)self.data;
81
+ }
82
+
83
+ // load
84
+
85
+ // load_unaligned
86
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
87
+ XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<vxe>) noexcept
88
+ {
89
+ return (typename batch<T, A>::register_type)vec_xl(0, (builtin_t<T>*)mem);
90
+ }
91
+
92
+ // load_aligned
93
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
94
+ XSIMD_INLINE batch<T, A> load_aligned(T const* mem, convert<T>, requires_arch<vxe>) noexcept
95
+ {
96
+ return load_unaligned<A>(mem, kernel::convert<T> {}, vxe {});
97
+ }
98
+
99
+ // load_complex
100
+ namespace detail
101
+ {
102
+ template <class A>
103
+ XSIMD_INLINE batch<std::complex<float>, A> load_complex(batch<float, A> const& hi, batch<float, A> const& lo, requires_arch<vxe>) noexcept
104
+ {
105
+ // Interleave real and imaginary parts
106
+ // hi = [r0, i0, r1, i1], lo = [r2, i2, r3, i3]
107
+ // We need: real = [r0, r1, r2, r3], imag = [i0, i1, i2, i3]
108
+ using v4sf = float __attribute__((vector_size(16)));
109
+ uv16qi perm_real = (uv16qi) { 0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27 };
110
+ uv16qi perm_imag = (uv16qi) { 4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31 };
111
+ v4sf real = vec_perm((v4sf)hi.data, (v4sf)lo.data, perm_real);
112
+ v4sf imag = vec_perm((v4sf)hi.data, (v4sf)lo.data, perm_imag);
113
+ return { batch<float, A>(real), batch<float, A>(imag) };
114
+ }
115
+
116
+ template <class A>
117
+ XSIMD_INLINE batch<std::complex<double>, A> load_complex(batch<double, A> const& hi, batch<double, A> const& lo, requires_arch<vxe>) noexcept
118
+ {
119
+ // hi = [r0, i0], lo = [r1, i1]
120
+ // We need: real = [r0, r1], imag = [i0, i1]
121
+ using v2df = double __attribute__((vector_size(16)));
122
+ uv16qi perm_real = (uv16qi) { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 };
123
+ uv16qi perm_imag = (uv16qi) { 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31 };
124
+ v2df real = vec_perm((v2df)hi.data, (v2df)lo.data, perm_real);
125
+ v2df imag = vec_perm((v2df)hi.data, (v2df)lo.data, perm_imag);
126
+ return { batch<double, A>(real), batch<double, A>(imag) };
127
+ }
128
+
129
+ template <class A>
130
+ XSIMD_INLINE batch<float, A> complex_low(batch<std::complex<float>, A> const& self, requires_arch<vxe>) noexcept
131
+ {
132
+ uv16qi perm = (uv16qi) { 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 };
133
+ return batch<float, A>(vec_perm((v4sf)self.real().data, (v4sf)self.imag().data, perm));
134
+ }
135
+
136
+ template <class A>
137
+ XSIMD_INLINE batch<float, A> complex_high(batch<std::complex<float>, A> const& self, requires_arch<vxe>) noexcept
138
+ {
139
+ uv16qi perm = (uv16qi) { 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 };
140
+ return batch<float, A>(vec_perm((v4sf)self.real().data, (v4sf)self.imag().data, perm));
141
+ }
142
+
143
+ template <class A>
144
+ XSIMD_INLINE batch<double, A> complex_low(batch<std::complex<double>, A> const& self, requires_arch<vxe>) noexcept
145
+ {
146
+ uv16qi perm = (uv16qi) { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 };
147
+ return batch<double, A>(vec_perm((v2df)self.real().data, (v2df)self.imag().data, perm));
148
+ }
149
+
150
+ template <class A>
151
+ XSIMD_INLINE batch<double, A> complex_high(batch<std::complex<double>, A> const& self, requires_arch<vxe>) noexcept
152
+ {
153
+ uv16qi perm = (uv16qi) { 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31 };
154
+ return batch<double, A>(vec_perm((v2df)self.real().data, (v2df)self.imag().data, perm));
155
+ }
156
+ }
157
+
158
+ // store
159
+ template <class A, class T>
160
+ XSIMD_INLINE void store_aligned(T* dst, batch<T, A> const& src, requires_arch<vxe>) noexcept
161
+ {
162
+ vec_xst(src.data, 0, (builtin_t<T>*)dst);
163
+ }
164
+
165
+ template <class A, class T>
166
+ XSIMD_INLINE void store_unaligned(T* dst, batch<T, A> const& src, requires_arch<vxe>) noexcept
167
+ {
168
+ store_aligned<A>(dst, src, vxe {});
169
+ }
170
+
171
+ // set
172
+ template <class A, class T, class... Values>
173
+ XSIMD_INLINE batch<T, A> set(batch<T, A> const&, requires_arch<vxe>, Values... values) noexcept
174
+ {
175
+ static_assert(sizeof...(Values) == batch<T, A>::size, "consistent init");
176
+ return typename batch<T, A>::register_type { values... };
177
+ }
178
+
179
+ template <class A, class T, class... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
180
+ XSIMD_INLINE batch_bool<T, A> set(batch_bool<T, A> const&, requires_arch<vxe>, Values... values) noexcept
181
+ {
182
+ static_assert(sizeof...(Values) == batch_bool<T, A>::size, "consistent init");
183
+ return typename batch_bool<T, A>::register_type { static_cast<decltype(std::declval<typename batch_bool<T, A>::register_type>()[0])>(values ? -1LL : 0LL)... };
184
+ }
185
+ // first
186
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
187
+ XSIMD_INLINE T first(batch<T, A> const& self, requires_arch<vxe>) noexcept
188
+ {
189
+ return self.data[0];
190
+ }
191
+ // insert
192
+ template <class A, class T, size_t I, class = std::enable_if_t<std::is_scalar<T>::value>>
193
+ XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<vxe>) noexcept
194
+ {
195
+ // vec_insert on float is broken with clang
196
+ batch<T, A> out(self);
197
+ out.data[I] = val;
198
+ return out;
199
+ }
200
+
201
+ // eq
202
+ template <class A, class T>
203
+ XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
204
+ {
205
+ return self.data == other.data;
206
+ }
207
+ template <class A, class T>
208
+ XSIMD_INLINE batch_bool<T, A> eq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
209
+ {
210
+ return self.data == other.data;
211
+ }
212
+
213
+ template <class A, class T>
214
+ XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
215
+ {
216
+ return self.data < other.data;
217
+ }
218
+ template <class A, class T>
219
+ XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
220
+ {
221
+ return self.data <= other.data;
222
+ }
223
+
224
+ // neq
225
+ template <class A, class T>
226
+ XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
227
+ {
228
+ return ~(self.data == other.data);
229
+ }
230
+
231
+ template <class A, class T>
232
+ XSIMD_INLINE batch_bool<T, A> neq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
233
+ {
234
+ return bitwise_xor(self, other);
235
+ }
236
+
237
+ // sub
238
+ template <class A, class T>
239
+ XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
240
+ {
241
+ return self.data - other.data;
242
+ }
243
+
244
+ // broadcast
245
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
246
+ XSIMD_INLINE batch<T, A> broadcast(T val, requires_arch<vxe>) noexcept
247
+ {
248
+ return vec_splats(static_cast<builtin_t<T>>(val));
249
+ }
250
+
251
+ // abs
252
+ template <class A, class T, class = typename std::enable_if<std::is_signed<T>::value, void>::type>
253
+ XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<vxe>) noexcept
254
+ {
255
+ return vec_abs(self.data);
256
+ }
257
+ // bitwise_and
258
+ template <class A, class T>
259
+ XSIMD_INLINE batch<T, A> bitwise_and(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
260
+ {
261
+ return (typename batch<T, A>::register_type)((v4si)self.data & (v4si)other.data);
262
+ }
263
+ template <class A, class T>
264
+ XSIMD_INLINE batch_bool<T, A> bitwise_and(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
265
+ {
266
+ return self.data & other.data;
267
+ }
268
+
269
+ // bitwise_or
270
+ template <class A, class T>
271
+ XSIMD_INLINE batch<T, A> bitwise_or(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
272
+ {
273
+ return (typename batch<T, A>::register_type)((v4si)self.data | (v4si)other.data);
274
+ }
275
+ template <class A, class T>
276
+ XSIMD_INLINE batch_bool<T, A> bitwise_or(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
277
+ {
278
+ return self.data | other.data;
279
+ }
280
+
281
+ // bitwise_xor
282
+ template <class A, class T>
283
+ XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
284
+ {
285
+ return (typename batch<T, A>::register_type)((v4si)self.data ^ (v4si)other.data);
286
+ }
287
+ template <class A, class T>
288
+ XSIMD_INLINE batch_bool<T, A> bitwise_xor(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
289
+ {
290
+ return self.data ^ other.data;
291
+ }
292
+
293
+ // bitwise_not
294
+ template <class A, class T>
295
+ XSIMD_INLINE batch<T, A> bitwise_not(batch<T, A> const& self, requires_arch<vxe>) noexcept
296
+ {
297
+ // ~ operator does not work on floating point vectors
298
+ return (typename batch<T, A>::register_type)(~(v4si)self.data);
299
+ }
300
+ template <class A, class T>
301
+ XSIMD_INLINE batch_bool<T, A> bitwise_not(batch_bool<T, A> const& self, requires_arch<vxe>) noexcept
302
+ {
303
+ return ~self.data;
304
+ }
305
+
306
+ // bitwise_andnot
307
+ template <class A, class T>
308
+ XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
309
+ {
310
+ return (typename batch<T, A>::register_type)((v4si)self.data & ~(v4si)other.data);
311
+ }
312
+ template <class A, class T>
313
+ XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
314
+ {
315
+ return self.data & ~other.data;
316
+ }
317
+
318
+ // div
319
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
320
+ XSIMD_INLINE batch<T, A> div(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
321
+ {
322
+ return self.data / other.data;
323
+ }
324
+
325
+ // neg
326
+ template <class A, class T>
327
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& self, requires_arch<vxe>) noexcept
328
+ {
329
+ return (typename batch<T, A>::register_type) { 0 } - self.data;
330
+ }
331
+
332
+ // add
333
+ template <class A, class T>
334
+ XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
335
+ {
336
+ return self.data + other.data;
337
+ }
338
+
339
+ // all
340
+ template <class A, class T>
341
+ XSIMD_INLINE bool all(batch_bool<T, A> const& self, requires_arch<vxe>) noexcept
342
+ {
343
+ return ((v1ti)self.data)[0] == -1;
344
+ }
345
+
346
+ // any
347
+ template <class A, class T>
348
+ XSIMD_INLINE bool any(batch_bool<T, A> const& self, requires_arch<vxe>) noexcept
349
+ {
350
+ return ((v1ti)self.data)[0] != 0;
351
+ }
352
+ // avgr
353
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
354
+ XSIMD_INLINE batch<T, A> avgr(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
355
+ {
356
+ return vec_avg(self.data, other.data);
357
+ }
358
+
359
+ // max
360
+ template <class A, class T>
361
+ XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
362
+ {
363
+ return vec_max(self.data, other.data);
364
+ }
365
+ // min
366
+ template <class A, class T>
367
+ XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
368
+ {
369
+ return vec_min(self.data, other.data);
370
+ }
371
+ // fma
372
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
373
+ XSIMD_INLINE batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<vxe>) noexcept
374
+ {
375
+ return vec_madd(x.data, y.data, z.data);
376
+ }
377
+ // fms
378
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
379
+ XSIMD_INLINE batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<vxe>) noexcept
380
+ {
381
+ return vec_msub(x.data, y.data, z.data);
382
+ }
383
+
384
+ // mul
385
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
386
+ XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
387
+ {
388
+ return self.data * other.data;
389
+ }
390
+ // haddp
391
+ template <class A>
392
+ XSIMD_INLINE batch<float, A> haddp(batch<float, A> const* r, requires_arch<vxe>) noexcept
393
+ {
394
+ v4sf lo01, hi01, lo23, hi23, sum01, sum23, sumeven, sumodd;
395
+ lo01 = vec_mergel(r[0].data, r[1].data); // { r[0][2], r[1][2], r[0][3], r[1][3] }
396
+ hi01 = vec_mergeh(r[0].data, r[1].data); // { r[0][0], r[1][0], r[0][1], r[1][1] }
397
+ lo23 = vec_mergel(r[2].data, r[3].data); // { r[2][2], r[2][2], r[3][3], r[3][3] }
398
+ hi23 = vec_mergeh(r[2].data, r[3].data); // { r[2][0], r[2][0], r[3][1], r[3][1] }
399
+ sum01 = lo01 + hi01; // { r[0][0] + r[0][2], r[1][0] + r[1][2], r[0][1] + r[0][3], r[1][1] + r[1][3] }
400
+ sum23 = lo23 + hi23; // { r[2][0] + r[2][2], r[3][0] + r[3][2], r[2][1] + r[2][3], r[3][1] + r[3][3] }
401
+ sumeven = (v4sf)vec_mergeh((v2di)sum01, (v2di)sum23); // { r[0][0] + r[0][2], r[1][0] + r[1][2], r[2][0] + r[2][2], r[3][0] + r[3][2] }
402
+ sumodd = (v4sf)vec_mergel((v2di)sum01, (v2di)sum23); // { r[0][1] + r[0][3], r[1][1] + r[1][3], r[2][1] + r[2][3], r[3][1] + r[3][3] }
403
+ return sumeven + sumodd;
404
+ }
405
+ template <class A>
406
+ XSIMD_INLINE batch<double, A> haddp(batch<double, A> const* row, requires_arch<vxe>) noexcept
407
+ {
408
+ return vec_mergeh(row[0].data, row[1].data) + vec_mergel(row[0].data, row[1].data);
409
+ }
410
+
411
+ // reduce_add
412
+ template <class A>
413
+ XSIMD_INLINE float reduce_add(batch<float, A> const& self, requires_arch<vxe>) noexcept
414
+ {
415
+ v4sf shifted_64 = vec_sld(self.data, self.data, 8);
416
+ v4sf added_1 = self.data + shifted_64;
417
+ v4sf shifted_32 = vec_sld(added_1, added_1, 4);
418
+ return (added_1 + shifted_32)[0];
419
+ }
420
+
421
+ template <class A>
422
+ XSIMD_INLINE double reduce_add(batch<double, A> const& self, requires_arch<vxe>) noexcept
423
+ {
424
+ return (self.data + vec_sld(self.data, self.data, 8))[0];
425
+ }
426
+
427
+ template <class A>
428
+ XSIMD_INLINE uint64_t reduce_add(batch<uint64_t, A> const& self, requires_arch<vxe>) noexcept
429
+ {
430
+ uv2di shifted = vec_sld((uv2di)self.data, (uv2di)self.data, 8);
431
+ uv2di sum = (uv2di)self.data + shifted;
432
+ return (uint64_t)sum[0];
433
+ }
434
+ template <class A>
435
+ XSIMD_INLINE int64_t reduce_add(batch<int64_t, A> const& self, requires_arch<vxe>) noexcept
436
+ {
437
+ v2di shifted = vec_sld((v2di)self.data, (v2di)self.data, 8);
438
+ v2di sum = (v2di)self.data + shifted;
439
+ return (int64_t)sum[0];
440
+ }
441
+ template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
442
+ XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<vxe>) noexcept
443
+ {
444
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
445
+ {
446
+ using t = typename batch<T, A>::register_type;
447
+ t shifted_64 = vec_sld(self.data, self.data, 8);
448
+ t added_1 = self.data + shifted_64;
449
+ t shifted_32 = vec_sld(added_1, added_1, 4);
450
+ return (added_1 + shifted_32)[0];
451
+ }
452
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
453
+ {
454
+ using t = typename batch<T, A>::register_type;
455
+ t shifted_64 = vec_sld(self.data, self.data, 8);
456
+ t added_1 = self.data + shifted_64;
457
+ t shifted_32 = vec_sld(added_1, added_1, 4);
458
+ t added_2 = added_1 + shifted_32;
459
+ t shifted_16 = vec_sld(added_2, added_2, 2);
460
+ return (added_2 + shifted_16)[0];
461
+ }
462
+ else
463
+ {
464
+ using t = typename batch<T, A>::register_type;
465
+ t shifted_64 = vec_sld(self.data, self.data, 8);
466
+ t added_1 = self.data + shifted_64;
467
+ t shifted_32 = vec_sld(added_1, added_1, 4);
468
+ t added_2 = added_1 + shifted_32;
469
+ t shifted_16 = vec_sld(added_2, added_2, 2);
470
+ t added_3 = added_2 + shifted_16;
471
+ t shifted_8 = vec_sld(added_3, added_3, 1);
472
+ return (added_3 + shifted_8)[0];
473
+ }
474
+ }
475
+
476
+ // select
477
+ template <class A, class T>
478
+ XSIMD_INLINE batch<T, A> select(batch_bool<T, A> const& cond, batch<T, A> const& true_br, batch<T, A> const& false_br, requires_arch<vxe>) noexcept
479
+ {
480
+ return vec_sel(false_br.data, true_br.data, cond.data);
481
+ }
482
+ template <class A, class T, bool... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
483
+ XSIMD_INLINE batch<T, A> select(batch_bool_constant<T, A, Values...> const&, batch<T, A> const& true_br, batch<T, A> const& false_br, requires_arch<vxe>) noexcept
484
+ {
485
+ return select(batch_bool<T, A> { Values... }, true_br, false_br, vxe {});
486
+ }
487
+
488
+ // slide_left
489
+ template <size_t N, class A, class T>
490
+ XSIMD_INLINE batch<T, A> slide_left(batch<T, A> const& x, requires_arch<vxe>) noexcept
491
+ {
492
+ XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
493
+ {
494
+ return batch<T, A>(0);
495
+ }
496
+ else
497
+ {
498
+ auto shift_count = vec_splats((uint8_t)(8 * N));
499
+ return vec_sll(x.data, shift_count);
500
+ }
501
+ }
502
+
503
+ // slide_right
504
+ template <size_t N, class A, class T>
505
+ XSIMD_INLINE batch<T, A> slide_right(batch<T, A> const& x, requires_arch<vxe>) noexcept
506
+ {
507
+ XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
508
+ {
509
+ return batch<T, A>(0);
510
+ }
511
+ else
512
+ {
513
+ auto shift_count = vec_splats((uint8_t)(8 * N));
514
+ return vec_srl(x.data, shift_count);
515
+ }
516
+ }
517
+
518
+ // sqrt
519
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
520
+ XSIMD_INLINE batch<T, A> sqrt(batch<T, A> const& val, requires_arch<vxe>) noexcept
521
+ {
522
+ return vec_sqrt(val.data);
523
+ }
524
+
525
+ // rsqrt
526
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
527
+ XSIMD_INLINE batch<T, A> rsqrt(batch<T, A> const& val, requires_arch<vxe>) noexcept
528
+ {
529
+ return batch<T, A>(T(1)) / sqrt(val, vxe {});
530
+ }
531
+
532
+ // shuffle
533
+ template <class A, class ITy, ITy I0, ITy I1, ITy I2, ITy I3>
534
+ XSIMD_INLINE batch<float, A> shuffle(batch<float, A> const& x, batch<float, A> const& y, batch_constant<ITy, A, I0, I1, I2, I3>, requires_arch<vxe>) noexcept
535
+ {
536
+ return vec_perm(x.data, y.data,
537
+ (__vector unsigned char) {
538
+ 4 * I0 + 0, 4 * I0 + 1, 4 * I0 + 2, 4 * I0 + 3,
539
+ 4 * I1 + 0, 4 * I1 + 1, 4 * I1 + 2, 4 * I1 + 3,
540
+ 4 * I2 + 0, 4 * I2 + 1, 4 * I2 + 2, 4 * I2 + 3,
541
+ 4 * I3 + 0, 4 * I3 + 1, 4 * I3 + 2, 4 * I3 + 3 });
542
+ }
543
+
544
+ template <class A, class ITy, ITy I0, ITy I1>
545
+ XSIMD_INLINE batch<double, A> shuffle(batch<double, A> const& x, batch<double, A> const& y, batch_constant<ITy, A, I0, I1>, requires_arch<vxe>) noexcept
546
+ {
547
+ return vec_perm(x.data, y.data,
548
+ (__vector unsigned char) {
549
+ 8 * I0 + 0,
550
+ 8 * I0 + 1,
551
+ 8 * I0 + 2,
552
+ 8 * I0 + 3,
553
+ 8 * I0 + 4,
554
+ 8 * I0 + 5,
555
+ 8 * I0 + 6,
556
+ 8 * I0 + 7,
557
+ 8 * I1 + 0,
558
+ 8 * I1 + 1,
559
+ 8 * I1 + 2,
560
+ 8 * I1 + 3,
561
+ 8 * I1 + 4,
562
+ 8 * I1 + 5,
563
+ 8 * I1 + 6,
564
+ 8 * I1 + 7,
565
+ });
566
+ }
567
+
568
+ // swizzle
569
+ // 16 x 8bit
570
+ template <class A, uint8_t... Values>
571
+ XSIMD_INLINE batch<uint8_t, A> swizzle(batch<uint8_t, A> const& self, batch_constant<uint8_t, A, Values...>, requires_arch<vxe>) noexcept
572
+ {
573
+ static_assert(sizeof...(Values) == batch<uint8_t, A>::size, "consistent init");
574
+ uv16qi perm = (uv16qi) { Values... };
575
+ return vec_perm(self.data, self.data, perm);
576
+ }
577
+ template <class A, uint8_t... Values>
578
+ XSIMD_INLINE batch<int8_t, A> swizzle(batch<int8_t, A> const& self, batch_constant<uint8_t, A, Values...>, requires_arch<vxe>) noexcept
579
+ {
580
+ static_assert(sizeof...(Values) == batch<int8_t, A>::size, "consistent init");
581
+ uv16qi perm = (uv16qi) { Values... };
582
+ return vec_perm(self.data, self.data, perm);
583
+ }
584
+
585
+ // 8 x 16 bit
586
+ template <class A, uint16_t V0, uint16_t V1, uint16_t V2, uint16_t V3, uint16_t V4, uint16_t V5, uint16_t V6, uint16_t V7>
587
+ XSIMD_INLINE batch<uint16_t, A> swizzle(batch<uint16_t, A> const& self, batch_constant<uint16_t, A, V0, V1, V2, V3, V4, V5, V6, V7>, requires_arch<vxe>) noexcept
588
+ {
589
+ uv16qi perm = (uv16qi) {
590
+ 2 * V0, 2 * V0 + 1,
591
+ 2 * V1, 2 * V1 + 1,
592
+ 2 * V2, 2 * V2 + 1,
593
+ 2 * V3, 2 * V3 + 1,
594
+ 2 * V4, 2 * V4 + 1,
595
+ 2 * V5, 2 * V5 + 1,
596
+ 2 * V6, 2 * V6 + 1,
597
+ 2 * V7, 2 * V7 + 1
598
+ };
599
+ return vec_perm(self.data, self.data, perm);
600
+ }
601
+ template <class A, uint16_t V0, uint16_t V1, uint16_t V2, uint16_t V3, uint16_t V4, uint16_t V5, uint16_t V6, uint16_t V7>
602
+ XSIMD_INLINE batch<int16_t, A> swizzle(batch<int16_t, A> const& self, batch_constant<uint16_t, A, V0, V1, V2, V3, V4, V5, V6, V7>, requires_arch<vxe>) noexcept
603
+ {
604
+ uv16qi perm = (uv16qi) {
605
+ 2 * V0, 2 * V0 + 1,
606
+ 2 * V1, 2 * V1 + 1,
607
+ 2 * V2, 2 * V2 + 1,
608
+ 2 * V3, 2 * V3 + 1,
609
+ 2 * V4, 2 * V4 + 1,
610
+ 2 * V5, 2 * V5 + 1,
611
+ 2 * V6, 2 * V6 + 1,
612
+ 2 * V7, 2 * V7 + 1
613
+ };
614
+ return vec_perm(self.data, self.data, perm);
615
+ }
616
+
617
+ // 4 x 32 bit
618
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
619
+ XSIMD_INLINE batch<uint32_t, A> swizzle(batch<uint32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vxe>) noexcept
620
+ {
621
+ uv16qi perm = (uv16qi) {
622
+ 4 * V0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
623
+ 4 * V1, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
624
+ 4 * V2, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
625
+ 4 * V3, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3
626
+ };
627
+ return vec_perm(self.data, self.data, perm);
628
+ }
629
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
630
+ XSIMD_INLINE batch<int32_t, A> swizzle(batch<int32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vxe>) noexcept
631
+ {
632
+ uv16qi perm = (uv16qi) {
633
+ 4 * V0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
634
+ 4 * V1, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
635
+ 4 * V2, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
636
+ 4 * V3, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3
637
+ };
638
+ return vec_perm(self.data, self.data, perm);
639
+ }
640
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
641
+ XSIMD_INLINE batch<float, A> swizzle(batch<float, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vxe>) noexcept
642
+ {
643
+ uv16qi perm = (uv16qi) {
644
+ 4 * V0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
645
+ 4 * V1, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
646
+ 4 * V2, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
647
+ 4 * V3, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3
648
+ };
649
+ return vec_perm(self.data, self.data, perm);
650
+ }
651
+
652
+ // 2 x 64 bit
653
+ template <class A, uint64_t V0, uint64_t V1>
654
+ XSIMD_INLINE batch<uint64_t, A> swizzle(batch<uint64_t, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vxe>) noexcept
655
+ {
656
+ using out = typename batch<uint64_t, A>::register_type;
657
+ uv16qi perm = (uv16qi) {
658
+ 8 * V0 + 0,
659
+ 8 * V0 + 1,
660
+ 8 * V0 + 2,
661
+ 8 * V0 + 3,
662
+ 8 * V0 + 4,
663
+ 8 * V0 + 5,
664
+ 8 * V0 + 6,
665
+ 8 * V0 + 7,
666
+ 8 * V1 + 0,
667
+ 8 * V1 + 1,
668
+ 8 * V1 + 2,
669
+ 8 * V1 + 3,
670
+ 8 * V1 + 4,
671
+ 8 * V1 + 5,
672
+ 8 * V1 + 6,
673
+ 8 * V1 + 7,
674
+ };
675
+ return (out)vec_perm((uv2di)self.data, (uv2di)self.data, perm);
676
+ }
677
+ template <class A, uint64_t V0, uint64_t V1>
678
+ XSIMD_INLINE batch<int64_t, A> swizzle(batch<int64_t, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vxe>) noexcept
679
+ {
680
+ using out = typename batch<int64_t, A>::register_type;
681
+ uv16qi perm = (uv16qi) {
682
+ 8 * V0 + 0,
683
+ 8 * V0 + 1,
684
+ 8 * V0 + 2,
685
+ 8 * V0 + 3,
686
+ 8 * V0 + 4,
687
+ 8 * V0 + 5,
688
+ 8 * V0 + 6,
689
+ 8 * V0 + 7,
690
+ 8 * V1 + 0,
691
+ 8 * V1 + 1,
692
+ 8 * V1 + 2,
693
+ 8 * V1 + 3,
694
+ 8 * V1 + 4,
695
+ 8 * V1 + 5,
696
+ 8 * V1 + 6,
697
+ 8 * V1 + 7,
698
+ };
699
+ return (out)vec_perm((v2di)self.data, (v2di)self.data, perm);
700
+ }
701
+ template <class A, uint64_t V0, uint64_t V1>
702
+ XSIMD_INLINE batch<double, A> swizzle(batch<double, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vxe>) noexcept
703
+ {
704
+ uv16qi perm = (uv16qi) {
705
+ 8 * V0 + 0,
706
+ 8 * V0 + 1,
707
+ 8 * V0 + 2,
708
+ 8 * V0 + 3,
709
+ 8 * V0 + 4,
710
+ 8 * V0 + 5,
711
+ 8 * V0 + 6,
712
+ 8 * V0 + 7,
713
+ 8 * V1 + 0,
714
+ 8 * V1 + 1,
715
+ 8 * V1 + 2,
716
+ 8 * V1 + 3,
717
+ 8 * V1 + 4,
718
+ 8 * V1 + 5,
719
+ 8 * V1 + 6,
720
+ 8 * V1 + 7,
721
+ };
722
+ return vec_perm(self.data, self.data, perm);
723
+ }
724
+ // zip_hi
725
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
726
+ XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
727
+ {
728
+ return vec_mergel(self.data, other.data);
729
+ }
730
+
731
+ // zip_lo
732
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
733
+ XSIMD_INLINE batch<T, A> zip_lo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
734
+ {
735
+ return vec_mergeh(self.data, other.data);
736
+ }
737
+ // bitwise_rshift
738
+ template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
739
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, int32_t other, requires_arch<vxe>) noexcept
740
+ {
741
+ return self.data >> other;
742
+ }
743
+ // bitwise_lshift
744
+ template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
745
+ XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, int32_t other, requires_arch<vxe>) noexcept
746
+ {
747
+ return self.data << other;
748
+ }
749
+
750
+ // isnan
751
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
752
+ XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const& self, requires_arch<vxe>) noexcept
753
+ {
754
+ return ~vec_cmpeq(self.data, self.data);
755
+ }
756
+
757
+ // ceil
758
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
759
+ XSIMD_INLINE batch<T, A> ceil(batch<T, A> const& self, requires_arch<vxe>) noexcept
760
+ {
761
+ return vec_ceil(self.data);
762
+ }
763
+
764
+ // floor
765
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
766
+ XSIMD_INLINE batch<T, A> floor(batch<T, A> const& self, requires_arch<vxe>) noexcept
767
+ {
768
+ return vec_floor(self.data);
769
+ }
770
+ // round
771
+ // vec_round rounds ties to even instead of zero
772
+ #if defined __has_builtin && __has_builtin(__builtin_s390_vfi)
773
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
774
+ XSIMD_INLINE batch<T, A> round(batch<T, A> const& self, requires_arch<vxe>) noexcept
775
+ {
776
+ return __builtin_s390_vfi(self.data, 4, 1);
777
+ }
778
+ #endif
779
+ // trunc
780
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
781
+ XSIMD_INLINE batch<T, A> trunc(batch<T, A> const& self, requires_arch<vxe>) noexcept
782
+ {
783
+ return vec_trunc(self.data);
784
+ }
785
+ }
786
+ }
787
+ #endif