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,724 @@
1
+ /***************************************************************************
2
+ * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3
+ * Martin Renou *
4
+ * Copyright (c) QuantStack *
5
+ * Copyright (c) Serge Guelton *
6
+ * *
7
+ * Distributed under the terms of the BSD 3-Clause License. *
8
+ * *
9
+ * The full license is in the file LICENSE, distributed with this software. *
10
+ ****************************************************************************/
11
+
12
+ #ifndef XSIMD_AVX512BW_HPP
13
+ #define XSIMD_AVX512BW_HPP
14
+
15
+ #include <array>
16
+ #include <type_traits>
17
+
18
+ #include "../types/xsimd_avx512bw_register.hpp"
19
+
20
+ namespace xsimd
21
+ {
22
+
23
+ namespace kernel
24
+ {
25
+ using namespace types;
26
+
27
+ namespace detail
28
+ {
29
+ template <class A, class T, int Cmp>
30
+ XSIMD_INLINE batch_bool<T, A> compare_int_avx512bw(batch<T, A> const& self, batch<T, A> const& other) noexcept
31
+ {
32
+ using register_type = typename batch_bool<T, A>::register_type;
33
+ if (std::is_signed<T>::value)
34
+ {
35
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
36
+ {
37
+ return (register_type)_mm512_cmp_epi8_mask(self, other, Cmp);
38
+ }
39
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
40
+ {
41
+ return (register_type)_mm512_cmp_epi16_mask(self, other, Cmp);
42
+ }
43
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
44
+ {
45
+ return (register_type)_mm512_cmp_epi32_mask(self, other, Cmp);
46
+ }
47
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
48
+ {
49
+ return (register_type)_mm512_cmp_epi64_mask(self, other, Cmp);
50
+ }
51
+ }
52
+ else
53
+ {
54
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
55
+ {
56
+ return (register_type)_mm512_cmp_epu8_mask(self, other, Cmp);
57
+ }
58
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
59
+ {
60
+ return (register_type)_mm512_cmp_epu16_mask(self, other, Cmp);
61
+ }
62
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
63
+ {
64
+ return (register_type)_mm512_cmp_epu32_mask(self, other, Cmp);
65
+ }
66
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
67
+ {
68
+ return (register_type)_mm512_cmp_epu64_mask(self, other, Cmp);
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ // abs
75
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
76
+ XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<avx512bw>) noexcept
77
+ {
78
+ if (std::is_unsigned<T>::value)
79
+ {
80
+ return self;
81
+ }
82
+
83
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
84
+ {
85
+ return _mm512_abs_epi8(self);
86
+ }
87
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
88
+ {
89
+ return _mm512_abs_epi16(self);
90
+ }
91
+ else
92
+ {
93
+ return abs(self, avx512dq {});
94
+ }
95
+ }
96
+
97
+ // add
98
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
99
+ XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
100
+ {
101
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
102
+ {
103
+ return _mm512_add_epi8(self, other);
104
+ }
105
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
106
+ {
107
+ return _mm512_add_epi16(self, other);
108
+ }
109
+ else
110
+ {
111
+ return add(self, other, avx512dq {});
112
+ }
113
+ }
114
+
115
+ // avgr
116
+ template <class A, class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
117
+ XSIMD_INLINE batch<T, A> avgr(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
118
+ {
119
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
120
+ {
121
+ return _mm512_avg_epu8(self, other);
122
+ }
123
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
124
+ {
125
+ return _mm512_avg_epu16(self, other);
126
+ }
127
+ else
128
+ {
129
+ return avgr(self, other, common {});
130
+ }
131
+ }
132
+
133
+ // avg
134
+ template <class A, class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
135
+ XSIMD_INLINE batch<T, A> avg(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
136
+ {
137
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
138
+ {
139
+ auto adj = ((self ^ other) << 7) >> 7;
140
+ return avgr(self, other, A {}) - adj;
141
+ }
142
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
143
+ {
144
+ auto adj = ((self ^ other) << 15) >> 15;
145
+ return avgr(self, other, A {}) - adj;
146
+ }
147
+ else
148
+ {
149
+ return avg(self, other, common {});
150
+ }
151
+ }
152
+
153
+ // bitwise_lshift
154
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
155
+ XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, int32_t other, requires_arch<avx512bw>) noexcept
156
+ {
157
+ #if defined(XSIMD_AVX512_SHIFT_INTRINSICS_IMM_ONLY)
158
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
159
+ {
160
+ return _mm512_sllv_epi16(self, _mm512_set1_epi16(other));
161
+ #else
162
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
163
+ {
164
+ return _mm512_slli_epi16(self, other);
165
+ #endif
166
+ }
167
+ else
168
+ {
169
+ return bitwise_lshift(self, other, avx512dq {});
170
+ }
171
+ }
172
+
173
+ // bitwise_rshift
174
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
175
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, int32_t other, requires_arch<avx512bw>) noexcept
176
+ {
177
+ if (std::is_signed<T>::value)
178
+ {
179
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
180
+ {
181
+ __m512i sign_mask = _mm512_set1_epi16((0xFF00 >> other) & 0x00FF);
182
+ __m512i zeros = _mm512_setzero_si512();
183
+ __mmask64 cmp_is_negative_mask = _mm512_cmpgt_epi8_mask(zeros, self);
184
+ __m512i cmp_sign_mask = _mm512_mask_blend_epi8(cmp_is_negative_mask, zeros, sign_mask);
185
+ #if defined(XSIMD_AVX512_SHIFT_INTRINSICS_IMM_ONLY)
186
+ __m512i res = _mm512_srav_epi16(self, _mm512_set1_epi16(other));
187
+ #else
188
+ __m512i res = _mm512_srai_epi16(self, other);
189
+ #endif
190
+ return _mm512_or_si512(cmp_sign_mask, _mm512_andnot_si512(sign_mask, res));
191
+ #if defined(XSIMD_AVX512_SHIFT_INTRINSICS_IMM_ONLY)
192
+ }
193
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
194
+ {
195
+ return _mm512_srav_epi16(self, _mm512_set1_epi16(other));
196
+ #else
197
+ }
198
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
199
+ {
200
+ return _mm512_srai_epi16(self, other);
201
+ #endif
202
+ }
203
+ else
204
+ {
205
+ return bitwise_rshift(self, other, avx512dq {});
206
+ }
207
+ }
208
+ else
209
+ {
210
+ #if defined(XSIMD_AVX512_SHIFT_INTRINSICS_IMM_ONLY)
211
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
212
+ {
213
+ return _mm512_srlv_epi16(self, _mm512_set1_epi16(other));
214
+ #else
215
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
216
+ {
217
+ return _mm512_srli_epi16(self, other);
218
+ #endif
219
+ }
220
+ else
221
+ {
222
+ return bitwise_rshift(self, other, avx512dq {});
223
+ }
224
+ }
225
+ }
226
+
227
+ // decr_if
228
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
229
+ XSIMD_INLINE batch<T, A> decr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<avx512bw>) noexcept
230
+ {
231
+
232
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
233
+ {
234
+ return _mm512_mask_sub_epi8(self, mask.data, self, _mm512_set1_epi8(1));
235
+ }
236
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
237
+ {
238
+ return _mm512_mask_sub_epi16(self, mask.data, self, _mm512_set1_epi16(1));
239
+ }
240
+ else
241
+ {
242
+ return decr_if(self, mask, avx512dq {});
243
+ }
244
+ }
245
+
246
+ // eq
247
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
248
+ XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
249
+ {
250
+ return detail::compare_int_avx512bw<A, T, _MM_CMPINT_EQ>(self, other);
251
+ }
252
+
253
+ // ge
254
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
255
+ XSIMD_INLINE batch_bool<T, A> ge(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
256
+ {
257
+ return detail::compare_int_avx512bw<A, T, _MM_CMPINT_GE>(self, other);
258
+ }
259
+
260
+ // gt
261
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
262
+ XSIMD_INLINE batch_bool<T, A> gt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
263
+ {
264
+ return detail::compare_int_avx512bw<A, T, _MM_CMPINT_GT>(self, other);
265
+ }
266
+
267
+ // incr_if
268
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
269
+ XSIMD_INLINE batch<T, A> incr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<avx512bw>) noexcept
270
+ {
271
+
272
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
273
+ {
274
+ return _mm512_mask_add_epi8(self, mask.data, self, _mm512_set1_epi8(1));
275
+ }
276
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
277
+ {
278
+ return _mm512_mask_add_epi16(self, mask.data, self, _mm512_set1_epi16(1));
279
+ }
280
+ else
281
+ {
282
+ return incr_if(self, mask, avx512dq {});
283
+ }
284
+ }
285
+
286
+ // insert
287
+ template <class A, class T, size_t I, class = std::enable_if_t<std::is_integral<T>::value>>
288
+ XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I> pos, requires_arch<avx512bw>) noexcept
289
+ {
290
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
291
+ {
292
+ return _mm512_mask_set1_epi8(self, __mmask64(1ULL << (I & 63)), val);
293
+ }
294
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
295
+ {
296
+ return _mm512_mask_set1_epi16(self, __mmask32(1 << (I & 31)), val);
297
+ }
298
+ else
299
+ {
300
+ return insert(self, val, pos, avx512dq {});
301
+ }
302
+ }
303
+
304
+ // le
305
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
306
+ XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
307
+ {
308
+ return detail::compare_int_avx512bw<A, T, _MM_CMPINT_LE>(self, other);
309
+ }
310
+
311
+ // lt
312
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
313
+ XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
314
+ {
315
+ return detail::compare_int_avx512bw<A, T, _MM_CMPINT_LT>(self, other);
316
+ }
317
+
318
+ // load
319
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
320
+ XSIMD_INLINE batch_bool<T, A> load_unaligned(bool const* mem, batch_bool<T, A>, requires_arch<avx512bw>) noexcept
321
+ {
322
+ using mask_type = typename batch_bool<T, A>::register_type;
323
+ XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 64)
324
+ {
325
+ __m512i bool_val = _mm512_loadu_si512((__m512i const*)mem);
326
+ return (mask_type)_mm512_cmpgt_epu8_mask(bool_val, _mm512_setzero_si512());
327
+ }
328
+ else XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 32)
329
+ {
330
+ __m256i bpack = _mm256_loadu_si256((__m256i const*)mem);
331
+ return (mask_type)_mm512_cmpgt_epu16_mask(_mm512_cvtepu8_epi16(bpack), _mm512_setzero_si512());
332
+ }
333
+ else XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 16)
334
+ {
335
+ __m128i bpack = _mm_loadu_si128((__m128i const*)mem);
336
+ return (mask_type)_mm512_cmpgt_epu32_mask(_mm512_cvtepu8_epi32(bpack), _mm512_setzero_si512());
337
+ }
338
+ else XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 8)
339
+ {
340
+ __m128i bpack = _mm_loadl_epi64((__m128i const*)mem);
341
+ return (mask_type)_mm512_cmpgt_epu64_mask(_mm512_cvtepu8_epi64(bpack), _mm512_setzero_si512());
342
+ }
343
+ else
344
+ {
345
+ assert(false && "unexpected batch size");
346
+ return {};
347
+ }
348
+ }
349
+
350
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
351
+ XSIMD_INLINE batch_bool<T, A> load_aligned(bool const* mem, batch_bool<T, A>, requires_arch<avx512bw>) noexcept
352
+ {
353
+ using mask_type = typename batch_bool<T, A>::register_type;
354
+ XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 64)
355
+ {
356
+ __m512i bool_val = _mm512_load_si512((__m512i const*)mem);
357
+ return (mask_type)_mm512_cmpgt_epu8_mask(bool_val, _mm512_setzero_si512());
358
+ }
359
+ else XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 32)
360
+ {
361
+ __m256i bpack = _mm256_load_si256((__m256i const*)mem);
362
+ return (mask_type)_mm512_cmpgt_epu16_mask(_mm512_cvtepu8_epi16(bpack), _mm512_setzero_si512());
363
+ }
364
+ else XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 16)
365
+ {
366
+ __m128i bpack = _mm_load_si128((__m128i const*)mem);
367
+ return (mask_type)_mm512_cmpgt_epu32_mask(_mm512_cvtepu8_epi32(bpack), _mm512_setzero_si512());
368
+ }
369
+ else XSIMD_IF_CONSTEXPR(batch_bool<T, A>::size == 8)
370
+ {
371
+ __m128i bpack = _mm_loadl_epi64((__m128i const*)mem);
372
+ return (mask_type)_mm512_cmpgt_epu64_mask(_mm512_cvtepu8_epi64(bpack), _mm512_setzero_si512());
373
+ }
374
+ else
375
+ {
376
+ assert(false && "unexpected batch size");
377
+ return {};
378
+ }
379
+ }
380
+
381
+ // max
382
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
383
+ XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
384
+ {
385
+ if (std::is_signed<T>::value)
386
+ {
387
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
388
+ {
389
+ return _mm512_max_epi8(self, other);
390
+ }
391
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
392
+ {
393
+ return _mm512_max_epi16(self, other);
394
+ }
395
+ else
396
+ {
397
+ return max(self, other, avx512dq {});
398
+ }
399
+ }
400
+ else
401
+ {
402
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
403
+ {
404
+ return _mm512_max_epu8(self, other);
405
+ }
406
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
407
+ {
408
+ return _mm512_max_epu16(self, other);
409
+ }
410
+ else
411
+ {
412
+ return max(self, other, avx512dq {});
413
+ }
414
+ }
415
+ }
416
+
417
+ // min
418
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
419
+ XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
420
+ {
421
+ if (std::is_signed<T>::value)
422
+ {
423
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
424
+ {
425
+ return _mm512_min_epi8(self, other);
426
+ }
427
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
428
+ {
429
+ return _mm512_min_epi16(self, other);
430
+ }
431
+ else
432
+ {
433
+ return min(self, other, avx512dq {});
434
+ }
435
+ }
436
+ else
437
+ {
438
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
439
+ {
440
+ return _mm512_min_epu8(self, other);
441
+ }
442
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
443
+ {
444
+ return _mm512_min_epu16(self, other);
445
+ }
446
+ else
447
+ {
448
+ return min(self, other, avx512dq {});
449
+ }
450
+ }
451
+ }
452
+
453
+ // mul
454
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
455
+ XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
456
+ {
457
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
458
+ {
459
+ __m512i upper = _mm512_and_si512(_mm512_mullo_epi16(self, other), _mm512_srli_epi16(_mm512_set1_epi16(-1), 8));
460
+ __m512i lower = _mm512_slli_epi16(_mm512_mullo_epi16(_mm512_srli_epi16(self, 8), _mm512_srli_epi16(other, 8)), 8);
461
+ return _mm512_or_si512(upper, lower);
462
+ }
463
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
464
+ {
465
+ return _mm512_mullo_epi16(self, other);
466
+ }
467
+ else
468
+ {
469
+ return mul(self, other, avx512dq {});
470
+ }
471
+ }
472
+
473
+ // neq
474
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
475
+ XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
476
+ {
477
+ return detail::compare_int_avx512bw<A, T, _MM_CMPINT_NE>(self, other);
478
+ }
479
+
480
+ // sadd
481
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
482
+ XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
483
+ {
484
+ if (std::is_signed<T>::value)
485
+ {
486
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
487
+ {
488
+ return _mm512_adds_epi8(self, other);
489
+ }
490
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
491
+ {
492
+ return _mm512_adds_epi16(self, other);
493
+ }
494
+ else
495
+ {
496
+ return sadd(self, other, avx512dq {});
497
+ }
498
+ }
499
+ else
500
+ {
501
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
502
+ {
503
+ return _mm512_adds_epu8(self, other);
504
+ }
505
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
506
+ {
507
+ return _mm512_adds_epu16(self, other);
508
+ }
509
+ else
510
+ {
511
+ return sadd(self, other, avx512dq {});
512
+ }
513
+ }
514
+ }
515
+
516
+ // select
517
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
518
+ 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<avx512bw>) noexcept
519
+ {
520
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
521
+ {
522
+ return _mm512_mask_blend_epi8(cond, false_br.data, true_br.data);
523
+ }
524
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
525
+ {
526
+ return _mm512_mask_blend_epi16(cond, false_br.data, true_br.data);
527
+ }
528
+ else
529
+ {
530
+ return select(cond, true_br, false_br, avx512dq {});
531
+ }
532
+ }
533
+
534
+ // slide_left
535
+ template <size_t N, class A, class T, class = std::enable_if_t<(N & 3) == 2 && (N < 64)>>
536
+ XSIMD_INLINE batch<T, A> slide_left(batch<T, A> const& x, requires_arch<avx512bw>) noexcept
537
+ {
538
+ static_assert((N & 3) == 2 && N < 64, "The AVX512F implementation may have a lower latency.");
539
+
540
+ __mmask32 mask = 0xFFFFFFFFu << ((N / 2) & 31);
541
+ auto slide_pattern = make_batch_constant<uint16_t, detail::make_slide_left_pattern<N / 2>, A>();
542
+ return _mm512_maskz_permutexvar_epi16(mask, slide_pattern.as_batch(), x);
543
+ }
544
+
545
+ // slide_right
546
+ template <size_t N, class A, class T, class = std::enable_if_t<(N & 3) == 2 && (N < 64)>>
547
+ XSIMD_INLINE batch<T, A> slide_right(batch<T, A> const& x, requires_arch<avx512bw>) noexcept
548
+ {
549
+ static_assert((N & 3) == 2 && N < 64, "The AVX512F implementation may have a lower latency.");
550
+
551
+ __mmask32 mask = 0xFFFFFFFFu >> ((N / 2) & 31);
552
+ auto slide_pattern = make_batch_constant<uint16_t, detail::make_slide_right_pattern<N / 2>, A>();
553
+ return _mm512_maskz_permutexvar_epi16(mask, slide_pattern.as_batch(), x);
554
+ }
555
+
556
+ // ssub
557
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
558
+ XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
559
+ {
560
+ if (std::is_signed<T>::value)
561
+ {
562
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
563
+ {
564
+ return _mm512_subs_epi8(self, other);
565
+ }
566
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
567
+ {
568
+ return _mm512_subs_epi16(self, other);
569
+ }
570
+ else
571
+ {
572
+ return ssub(self, other, avx512dq {});
573
+ }
574
+ }
575
+ else
576
+ {
577
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
578
+ {
579
+ return _mm512_subs_epu8(self, other);
580
+ }
581
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
582
+ {
583
+ return _mm512_subs_epu16(self, other);
584
+ }
585
+ else
586
+ {
587
+ return ssub(self, other, avx512dq {});
588
+ }
589
+ }
590
+ }
591
+
592
+ // store
593
+ template <class T, class A>
594
+ XSIMD_INLINE void store(batch_bool<T, A> const& self, bool* mem, requires_arch<avx512bw>) noexcept
595
+ {
596
+ constexpr auto size = batch_bool<T, A>::size;
597
+ __m512i bool_val = _mm512_maskz_set1_epi8(self.data, 0x01);
598
+ __mmask64 mask = size >= 64 ? ~(__mmask64)0 : (1ULL << size) - 1;
599
+ _mm512_mask_storeu_epi8((void*)mem, mask, bool_val);
600
+ }
601
+
602
+ // sub
603
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
604
+ XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
605
+ {
606
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
607
+ {
608
+ return _mm512_sub_epi8(self, other);
609
+ }
610
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
611
+ {
612
+ return _mm512_sub_epi16(self, other);
613
+ }
614
+ else
615
+ {
616
+ return sub(self, other, avx512dq {});
617
+ }
618
+ }
619
+
620
+ // swizzle (dynamic version)
621
+ template <class A>
622
+ XSIMD_INLINE batch<uint16_t, A> swizzle(batch<uint16_t, A> const& self, batch<uint16_t, A> mask, requires_arch<avx512bw>) noexcept
623
+ {
624
+ return _mm512_permutexvar_epi16(mask, self);
625
+ }
626
+
627
+ template <class A>
628
+ XSIMD_INLINE batch<int16_t, A> swizzle(batch<int16_t, A> const& self, batch<uint16_t, A> mask, requires_arch<avx512bw>) noexcept
629
+ {
630
+ return bitwise_cast<int16_t>(swizzle(bitwise_cast<uint16_t>(self), mask, avx512bw {}));
631
+ }
632
+
633
+ // swizzle (static version)
634
+ template <class A, uint16_t... Vs>
635
+ XSIMD_INLINE batch<uint16_t, A> swizzle(batch<uint16_t, A> const& self, batch_constant<uint16_t, A, Vs...> mask, requires_arch<avx512bw>) noexcept
636
+ {
637
+ return swizzle(self, mask.as_batch(), avx512bw {});
638
+ }
639
+
640
+ template <class A, uint16_t... Vs>
641
+ XSIMD_INLINE batch<int16_t, A> swizzle(batch<int16_t, A> const& self, batch_constant<uint16_t, A, Vs...> mask, requires_arch<avx512bw>) noexcept
642
+ {
643
+ return swizzle(self, mask.as_batch(), avx512bw {});
644
+ }
645
+
646
+ // widen
647
+ template <class A>
648
+ XSIMD_INLINE std::array<batch<widen_t<uint8_t>, A>, 2> widen(batch<uint8_t, A> const& x, requires_arch<avx512bw>) noexcept
649
+ {
650
+ __m256i x_lo = _mm512_extracti64x4_epi64(x, 0);
651
+ __m256i x_hi = _mm512_extracti64x4_epi64(x, 1);
652
+ __m512i lo = _mm512_cvtepu8_epi16(x_lo);
653
+ __m512i hi = _mm512_cvtepu8_epi16(x_hi);
654
+ return { lo, hi };
655
+ }
656
+ template <class A>
657
+ XSIMD_INLINE std::array<batch<widen_t<int8_t>, A>, 2> widen(batch<int8_t, A> const& x, requires_arch<avx512bw>) noexcept
658
+ {
659
+ __m256i x_lo = _mm512_extracti64x4_epi64(x, 0);
660
+ __m256i x_hi = _mm512_extracti64x4_epi64(x, 1);
661
+ __m512i lo = _mm512_cvtepi8_epi16(x_lo);
662
+ __m512i hi = _mm512_cvtepi8_epi16(x_hi);
663
+ return { lo, hi };
664
+ }
665
+
666
+ // zip_hi
667
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
668
+ XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
669
+ {
670
+ __m512i lo, hi;
671
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
672
+ {
673
+ lo = _mm512_unpacklo_epi8(self, other);
674
+ hi = _mm512_unpackhi_epi8(self, other);
675
+ }
676
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
677
+ {
678
+ lo = _mm512_unpacklo_epi16(self, other);
679
+ hi = _mm512_unpackhi_epi16(self, other);
680
+ }
681
+ else
682
+ {
683
+ return zip_hi(self, other, avx512f {});
684
+ }
685
+ return _mm512_inserti32x4(
686
+ _mm512_inserti32x4(
687
+ _mm512_inserti32x4(hi, _mm512_extracti32x4_epi32(lo, 2), 0),
688
+ _mm512_extracti32x4_epi32(lo, 3),
689
+ 2),
690
+ _mm512_extracti32x4_epi32(hi, 2),
691
+ 1);
692
+ }
693
+
694
+ // zip_lo
695
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
696
+ XSIMD_INLINE batch<T, A> zip_lo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<avx512bw>) noexcept
697
+ {
698
+ __m512i lo, hi;
699
+ XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
700
+ {
701
+ lo = _mm512_unpacklo_epi8(self, other);
702
+ hi = _mm512_unpackhi_epi8(self, other);
703
+ }
704
+ else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
705
+ {
706
+ lo = _mm512_unpacklo_epi16(self, other);
707
+ hi = _mm512_unpackhi_epi16(self, other);
708
+ }
709
+ else
710
+ {
711
+ return zip_lo(self, other, avx512f {});
712
+ }
713
+ return _mm512_inserti32x4(
714
+ _mm512_inserti32x4(
715
+ _mm512_inserti32x4(lo, _mm512_extracti32x4_epi32(hi, 0), 1),
716
+ _mm512_extracti32x4_epi32(hi, 1),
717
+ 3),
718
+ _mm512_extracti32x4_epi32(lo, 1),
719
+ 2);
720
+ }
721
+ }
722
+ }
723
+
724
+ #endif