react-native-executorch 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/lib/module/fetcher/telemetry.js +1 -1
  2. package/package.json +1 -1
  3. package/react-native-executorch.podspec +2 -0
  4. package/src/fetcher/telemetry.ts +1 -1
  5. package/third-party/common/phonemis/CMakeLists.txt +70 -14
  6. package/third-party/common/phonemis/README.md +183 -33
  7. package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
  8. package/third-party/common/phonemis/knowledge/code_style.md +642 -0
  9. package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
  10. package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
  11. package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
  12. package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
  13. package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
  14. package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
  15. package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
  16. package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
  17. package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
  18. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
  19. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
  20. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
  21. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
  22. package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
  23. package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
  24. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
  25. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
  26. package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
  27. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
  28. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
  29. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
  30. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
  31. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
  32. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
  33. package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
  34. package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
  35. package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
  36. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
  37. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
  38. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
  39. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
  40. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
  41. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
  42. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
  43. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
  44. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
  45. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
  46. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
  47. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
  48. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
  49. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
  50. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
  51. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
  52. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
  53. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
  54. package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
  55. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
  56. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
  57. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
  58. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
  59. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
  60. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
  61. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
  62. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
  63. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
  64. package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
  65. package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
  66. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
  67. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
  68. package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
  69. package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
  70. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
  71. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
  72. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
  73. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
  74. package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
  75. package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
  76. package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
  77. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
  78. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
  79. package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
  80. package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
  81. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
  82. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
  83. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
  84. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
  85. package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
  86. package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
  87. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
  88. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
  89. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
  90. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
  91. package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
  92. package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
  93. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
  94. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
  95. package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
  96. package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
  97. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
  98. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
  99. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
  100. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
  101. package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
  102. package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
  103. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
  104. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
  105. package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
  106. package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
  107. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
  108. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
  109. package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
  110. package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
  111. package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
  112. package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
  113. package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
  114. package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
  115. package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
  116. package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
  117. package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
  118. package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
  119. package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
  120. package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
  121. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
  122. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
  123. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
  124. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
  125. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
  126. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
  127. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
  128. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
  129. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
  130. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
  131. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
  132. package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
  133. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
  134. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
  135. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
  136. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
  137. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
  138. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
  139. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
  140. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
  141. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
  142. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
  143. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
  144. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
  145. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
  146. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
  147. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
  148. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
  149. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
  150. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
  151. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
  152. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
  153. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
  154. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
  155. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
  156. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
  157. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
  158. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
  159. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
  160. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
  161. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
  162. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
  163. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
  164. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
  165. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
  166. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
  167. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
  168. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
  169. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
  170. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
  171. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
  172. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
  173. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
  174. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
  175. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
  176. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
  177. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
  178. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
  179. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
  180. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
  181. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
  182. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
  183. package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
  184. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
  185. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
  186. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
  187. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
  188. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
  189. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
  190. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
  191. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
  192. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
  193. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
  194. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
  195. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
  196. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
  197. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
  198. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
  199. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
  200. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
  201. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
  202. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
  203. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
  204. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
  205. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
  206. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
  207. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
  208. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
  209. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
  210. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
  211. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
  212. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
  213. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
  214. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
  215. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
  216. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
  217. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
  218. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
  219. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
  220. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
  221. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
  222. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
  223. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
  224. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
  225. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
  226. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
  227. package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
  228. package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
  229. package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
  230. package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
  231. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
  232. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
  233. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
  234. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
  235. package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
  236. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
  237. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
@@ -0,0 +1,947 @@
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_VSX_HPP
13
+ #define XSIMD_VSX_HPP
14
+
15
+ #include <complex>
16
+ #include <type_traits>
17
+
18
+ #include "../types/xsimd_vsx_register.hpp"
19
+ #include "./common/xsimd_common_cast.hpp"
20
+
21
+ #include <endian.h>
22
+
23
+ namespace xsimd
24
+ {
25
+ template <typename T, class A, bool... Values>
26
+ struct batch_bool_constant;
27
+
28
+ template <class T_out, class T_in, class A>
29
+ XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& x) noexcept;
30
+
31
+ template <typename T, class A, T... Values>
32
+ struct batch_constant;
33
+
34
+ namespace kernel
35
+ {
36
+ // builtin_t<T> - the scalar type as it would be used for a vector intrinsic
37
+ // VSX vector intrinsics do not support long, unsigned long, and char
38
+ // The builtin<T> definition can be used to map the incoming
39
+ // type to the right one to be used with the intrinsics.
40
+ template <typename T>
41
+ struct builtin_scalar
42
+ {
43
+ using type = T;
44
+ };
45
+
46
+ template <>
47
+ struct builtin_scalar<unsigned long>
48
+ {
49
+ using type = unsigned long long;
50
+ };
51
+
52
+ template <>
53
+ struct builtin_scalar<long>
54
+ {
55
+ using type = long long;
56
+ };
57
+
58
+ template <>
59
+ struct builtin_scalar<char>
60
+ {
61
+ using type = typename std::conditional<std::is_signed<char>::value, signed char, unsigned char>::type;
62
+ };
63
+
64
+ template <typename T>
65
+ using builtin_t = typename builtin_scalar<T>::type;
66
+
67
+ template <class A, class T>
68
+ XSIMD_INLINE batch<T, A> avg(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
69
+ template <class A, class T>
70
+ XSIMD_INLINE batch<T, A> avgr(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
71
+
72
+ // abs
73
+ template <class A>
74
+ XSIMD_INLINE batch<float, A> abs(batch<float, A> const& self, requires_arch<vsx>) noexcept
75
+ {
76
+ return vec_abs(self.data);
77
+ }
78
+
79
+ template <class A>
80
+ XSIMD_INLINE batch<double, A> abs(batch<double, A> const& self, requires_arch<vsx>) noexcept
81
+ {
82
+ return vec_abs(self.data);
83
+ }
84
+
85
+ // add
86
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
87
+ XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
88
+ {
89
+ return vec_add(self.data, other.data);
90
+ }
91
+
92
+ // all
93
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
94
+ XSIMD_INLINE bool all(batch_bool<T, A> const& self, requires_arch<vsx>) noexcept
95
+ {
96
+ return vec_all_ne(self.data, vec_xor(self.data, self.data));
97
+ }
98
+
99
+ // any
100
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
101
+ XSIMD_INLINE bool any(batch_bool<T, A> const& self, requires_arch<vsx>) noexcept
102
+ {
103
+ return vec_any_ne(self.data, vec_xor(self.data, self.data));
104
+ }
105
+
106
+ // avgr
107
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value && sizeof(T) < 8>>
108
+ XSIMD_INLINE batch<T, A> avgr(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
109
+ {
110
+ return vec_avg(self.data, other.data);
111
+ }
112
+ template <class A>
113
+ XSIMD_INLINE batch<float, A> avgr(batch<float, A> const& self, batch<float, A> const& other, requires_arch<vsx>) noexcept
114
+ {
115
+ return avgr(self, other, common {});
116
+ }
117
+ template <class A>
118
+ XSIMD_INLINE batch<double, A> avgr(batch<double, A> const& self, batch<double, A> const& other, requires_arch<vsx>) noexcept
119
+ {
120
+ return avgr(self, other, common {});
121
+ }
122
+
123
+ // avg
124
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
125
+ XSIMD_INLINE batch<T, A> avg(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
126
+ {
127
+ XSIMD_IF_CONSTEXPR(sizeof(T) < 8)
128
+ {
129
+ constexpr auto nbit = 8 * sizeof(T) - 1;
130
+ auto adj = bitwise_cast<T>(bitwise_cast<as_unsigned_integer_t<T>>((self ^ other) << nbit) >> nbit);
131
+ return avgr(self, other, A {}) - adj;
132
+ }
133
+ else
134
+ {
135
+ return avg(self, other, common {});
136
+ }
137
+ }
138
+ template <class A>
139
+ XSIMD_INLINE batch<float, A> avg(batch<float, A> const& self, batch<float, A> const& other, requires_arch<vsx>) noexcept
140
+ {
141
+ return avg(self, other, common {});
142
+ }
143
+ template <class A>
144
+ XSIMD_INLINE batch<double, A> avg(batch<double, A> const& self, batch<double, A> const& other, requires_arch<vsx>) noexcept
145
+ {
146
+ return avg(self, other, common {});
147
+ }
148
+
149
+ // batch_bool_cast
150
+ template <class A, class T_out, class T_in>
151
+ 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<vsx>) noexcept
152
+ {
153
+ return (typename batch_bool<T_out, A>::register_type)self.data;
154
+ }
155
+
156
+ // bitwise_and
157
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
158
+ XSIMD_INLINE batch<T, A> bitwise_and(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
159
+ {
160
+ return vec_and(self.data, other.data);
161
+ }
162
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
163
+ XSIMD_INLINE batch_bool<T, A> bitwise_and(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
164
+ {
165
+ return vec_and(self.data, other.data);
166
+ }
167
+
168
+ // bitwise_andnot
169
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
170
+ XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
171
+ {
172
+ return vec_and(self.data, vec_nor(other.data, other.data));
173
+ }
174
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
175
+ XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
176
+ {
177
+ return self.data & ~other.data;
178
+ }
179
+
180
+ // bitwise_lshift
181
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
182
+ XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, int32_t other, requires_arch<vsx>) noexcept
183
+ {
184
+ using shift_type = as_unsigned_integer_t<T>;
185
+ batch<shift_type, A> shift(static_cast<shift_type>(other));
186
+ return vec_sl(self.data, shift.data);
187
+ }
188
+
189
+ // bitwise_not
190
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
191
+ XSIMD_INLINE batch<T, A> bitwise_not(batch<T, A> const& self, requires_arch<vsx>) noexcept
192
+ {
193
+ return vec_nor(self.data, self.data);
194
+ }
195
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
196
+ XSIMD_INLINE batch_bool<T, A> bitwise_not(batch_bool<T, A> const& self, requires_arch<vsx>) noexcept
197
+ {
198
+ return vec_nor(self.data, self.data);
199
+ }
200
+
201
+ // bitwise_or
202
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
203
+ XSIMD_INLINE batch<T, A> bitwise_or(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
204
+ {
205
+ return vec_or(self.data, other.data);
206
+ }
207
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
208
+ XSIMD_INLINE batch_bool<T, A> bitwise_or(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
209
+ {
210
+ return vec_or(self.data, other.data);
211
+ }
212
+
213
+ // bitwise_rshift
214
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
215
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, int32_t other, requires_arch<vsx>) noexcept
216
+ {
217
+ using shift_type = as_unsigned_integer_t<T>;
218
+ batch<shift_type, A> shift(static_cast<shift_type>(other));
219
+ XSIMD_IF_CONSTEXPR(std::is_signed<T>::value)
220
+ {
221
+ return vec_sra(self.data, shift.data);
222
+ }
223
+ else
224
+ {
225
+ return vec_sr(self.data, shift.data);
226
+ }
227
+ }
228
+
229
+ // bitwise_xor
230
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
231
+ XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
232
+ {
233
+ return vec_xor(self.data, other.data);
234
+ }
235
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
236
+ XSIMD_INLINE batch_bool<T, A> bitwise_xor(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
237
+ {
238
+ return vec_xor(self.data, other.data);
239
+ }
240
+
241
+ // bitwise_cast
242
+ template <class A, class T_in, class T_out>
243
+ XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<vsx>) noexcept
244
+ {
245
+ return (typename batch<T_out, A>::register_type)(self.data);
246
+ }
247
+
248
+ // broadcast
249
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
250
+ XSIMD_INLINE batch<T, A> broadcast(T val, requires_arch<vsx>) noexcept
251
+ {
252
+ return vec_splats(static_cast<builtin_t<T>>(val));
253
+ }
254
+
255
+ // ceil
256
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
257
+ XSIMD_INLINE batch<T, A> ceil(batch<T, A> const& self, requires_arch<vsx>) noexcept
258
+ {
259
+ return vec_ceil(self.data);
260
+ }
261
+
262
+ // store_complex
263
+ namespace detail
264
+ {
265
+ // complex_low
266
+ template <class A>
267
+ XSIMD_INLINE batch<float, A> complex_low(batch<std::complex<float>, A> const& self, requires_arch<vsx>) noexcept
268
+ {
269
+ return vec_mergeh(self.real().data, self.imag().data);
270
+ }
271
+ template <class A>
272
+ XSIMD_INLINE batch<double, A> complex_low(batch<std::complex<double>, A> const& self, requires_arch<vsx>) noexcept
273
+ {
274
+ return vec_mergeh(self.real().data, self.imag().data);
275
+ }
276
+ // complex_high
277
+ template <class A>
278
+ XSIMD_INLINE batch<float, A> complex_high(batch<std::complex<float>, A> const& self, requires_arch<vsx>) noexcept
279
+ {
280
+ return vec_mergel(self.real().data, self.imag().data);
281
+ }
282
+ template <class A>
283
+ XSIMD_INLINE batch<double, A> complex_high(batch<std::complex<double>, A> const& self, requires_arch<vsx>) noexcept
284
+ {
285
+ return vec_mergel(self.real().data, self.imag().data);
286
+ }
287
+ }
288
+
289
+ // decr_if
290
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
291
+ XSIMD_INLINE batch<T, A> decr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<vsx>) noexcept
292
+ {
293
+ return self + batch<T, A>((typename batch<T, A>::register_type)mask.data);
294
+ }
295
+
296
+ // div
297
+ template <class A>
298
+ XSIMD_INLINE batch<float, A> div(batch<float, A> const& self, batch<float, A> const& other, requires_arch<vsx>) noexcept
299
+ {
300
+ return vec_div(self.data, other.data);
301
+ }
302
+ template <class A>
303
+ XSIMD_INLINE batch<double, A> div(batch<double, A> const& self, batch<double, A> const& other, requires_arch<vsx>) noexcept
304
+ {
305
+ return vec_div(self.data, other.data);
306
+ }
307
+
308
+ // fast_cast
309
+ namespace detail
310
+ {
311
+ template <class A>
312
+ XSIMD_INLINE batch<float, A> fast_cast(batch<int32_t, A> const& self, batch<float, A> const&, requires_arch<vsx>) noexcept
313
+ {
314
+ return vec_ctf(self.data, 0);
315
+ }
316
+ template <class A>
317
+ XSIMD_INLINE batch<float, A> fast_cast(batch<uint32_t, A> const& self, batch<float, A> const&, requires_arch<vsx>) noexcept
318
+ {
319
+ return vec_ctf(self.data, 0);
320
+ }
321
+
322
+ template <class A>
323
+ XSIMD_INLINE batch<int32_t, A> fast_cast(batch<float, A> const& self, batch<int32_t, A> const&, requires_arch<vsx>) noexcept
324
+ {
325
+ return vec_cts(self.data, 0);
326
+ }
327
+
328
+ template <class A>
329
+ XSIMD_INLINE batch<uint32_t, A> fast_cast(batch<float, A> const& self, batch<uint32_t, A> const&, requires_arch<vsx>) noexcept
330
+ {
331
+ return vec_ctu(self.data, 0);
332
+ }
333
+ }
334
+
335
+ // fma
336
+ template <class A>
337
+ XSIMD_INLINE batch<float, A> fma(batch<float, A> const& x, batch<float, A> const& y, batch<float, A> const& z, requires_arch<vsx>) noexcept
338
+ {
339
+ return vec_madd(x.data, y.data, z.data);
340
+ }
341
+
342
+ template <class A>
343
+ XSIMD_INLINE batch<double, A> fma(batch<double, A> const& x, batch<double, A> const& y, batch<double, A> const& z, requires_arch<vsx>) noexcept
344
+ {
345
+ return vec_madd(x.data, y.data, z.data);
346
+ }
347
+
348
+ // fms
349
+ template <class A>
350
+ XSIMD_INLINE batch<float, A> fms(batch<float, A> const& x, batch<float, A> const& y, batch<float, A> const& z, requires_arch<vsx>) noexcept
351
+ {
352
+ return vec_msub(x.data, y.data, z.data);
353
+ }
354
+
355
+ template <class A>
356
+ XSIMD_INLINE batch<double, A> fms(batch<double, A> const& x, batch<double, A> const& y, batch<double, A> const& z, requires_arch<vsx>) noexcept
357
+ {
358
+ return vec_msub(x.data, y.data, z.data);
359
+ }
360
+
361
+ // eq
362
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
363
+ XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
364
+ {
365
+ auto res = vec_cmpeq(self.data, other.data);
366
+ return *reinterpret_cast<typename batch_bool<T, A>::register_type*>(&res);
367
+ }
368
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
369
+ XSIMD_INLINE batch_bool<T, A> eq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
370
+ {
371
+ auto res = vec_cmpeq(self.data, other.data);
372
+ return *reinterpret_cast<typename batch_bool<T, A>::register_type*>(&res);
373
+ }
374
+
375
+ // first
376
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
377
+ XSIMD_INLINE T first(batch<T, A> const& self, requires_arch<vsx>) noexcept
378
+ {
379
+ return vec_extract(self.data, 0);
380
+ }
381
+
382
+ // floor
383
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
384
+ XSIMD_INLINE batch<T, A> floor(batch<T, A> const& self, requires_arch<vsx>) noexcept
385
+ {
386
+ return vec_floor(self.data);
387
+ }
388
+
389
+ // ge
390
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
391
+ XSIMD_INLINE batch_bool<T, A> ge(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
392
+ {
393
+ return vec_cmpge(self.data, other.data);
394
+ }
395
+
396
+ // gt
397
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
398
+ XSIMD_INLINE batch_bool<T, A> gt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
399
+ {
400
+ return vec_cmpgt(self.data, other.data);
401
+ }
402
+
403
+ // haddp
404
+ template <class A>
405
+ XSIMD_INLINE batch<float, A> haddp(batch<float, A> const* row, requires_arch<vsx>) noexcept
406
+ {
407
+ auto tmp0 = vec_mergee(row[0].data, row[1].data); // v00 v10 v02 v12
408
+ auto tmp1 = vec_mergeo(row[0].data, row[1].data); // v01 v11 v03 v13
409
+ auto tmp4 = vec_add(tmp0, tmp1); // (v00 + v01, v10 + v11, v02 + v03, v12 + v13)
410
+
411
+ auto tmp2 = vec_mergee(row[2].data, row[3].data); // v20 v30 v22 v32
412
+ auto tmp3 = vec_mergeo(row[2].data, row[3].data); // v21 v31 v23 v33
413
+ auto tmp5 = vec_add(tmp0, tmp1); // (v20 + v21, v30 + v31, v22 + v23, v32 + v33)
414
+
415
+ auto tmp6 = vec_perm(tmp4, tmp5, (__vector unsigned char) { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 }); // (v00 + v01, v10 + v11, v20 + v21, v30 + v31
416
+ auto tmp7 = vec_perm(tmp4, tmp5, (__vector unsigned char) { 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31 }); // (v02 + v03, v12 + v13, v12 + v13, v32 + v33)
417
+
418
+ return vec_add(tmp6, tmp7);
419
+ }
420
+
421
+ template <class A>
422
+ XSIMD_INLINE batch<double, A> haddp(batch<double, A> const* row, requires_arch<vsx>) noexcept
423
+ {
424
+ auto tmp0 = vec_mergee(row[0].data, row[1].data); // v00 v10 v02 v12
425
+ auto tmp1 = vec_mergeo(row[0].data, row[1].data); // v01 v11 v03 v13
426
+ return vec_add(tmp0, tmp1);
427
+ }
428
+
429
+ // incr_if
430
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
431
+ XSIMD_INLINE batch<T, A> incr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<vsx>) noexcept
432
+ {
433
+ return self - batch<T, A>((typename batch<T, A>::register_type)mask.data);
434
+ }
435
+
436
+ // insert
437
+ template <class A, class T, size_t I, class = std::enable_if_t<std::is_scalar<T>::value>>
438
+ XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<vsx>) noexcept
439
+ {
440
+ return vec_insert(val, self.data, I);
441
+ }
442
+
443
+ // isnan
444
+ template <class A>
445
+ XSIMD_INLINE batch_bool<float, A> isnan(batch<float, A> const& self, requires_arch<vsx>) noexcept
446
+ {
447
+ return ~vec_cmpeq(self.data, self.data);
448
+ }
449
+ template <class A>
450
+ XSIMD_INLINE batch_bool<double, A> isnan(batch<double, A> const& self, requires_arch<vsx>) noexcept
451
+ {
452
+ return ~vec_cmpeq(self.data, self.data);
453
+ }
454
+
455
+ // load_unaligned
456
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
457
+ XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<vsx>) noexcept
458
+ {
459
+ return (typename batch<T, A>::register_type)vec_xl(0, (builtin_t<T>*)mem);
460
+ }
461
+
462
+ // load_aligned
463
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
464
+ XSIMD_INLINE batch<T, A> load_aligned(T const* mem, convert<T>, requires_arch<vsx>) noexcept
465
+ {
466
+ return load_unaligned<A>(mem, kernel::convert<T> {}, vsx {});
467
+ }
468
+
469
+ // load_complex
470
+ namespace detail
471
+ {
472
+ template <class A>
473
+ XSIMD_INLINE batch<std::complex<float>, A> load_complex(batch<float, A> const& hi, batch<float, A> const& lo, requires_arch<vsx>) noexcept
474
+ {
475
+ __vector unsigned char perme = { 0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27 };
476
+ __vector unsigned char permo = { 4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31 };
477
+ return { vec_perm(hi.data, lo.data, perme), vec_perm(hi.data, lo.data, permo) };
478
+ }
479
+ template <class A>
480
+ XSIMD_INLINE batch<std::complex<double>, A> load_complex(batch<double, A> const& hi, batch<double, A> const& lo, requires_arch<vsx>) noexcept
481
+ {
482
+ return { vec_mergee(hi.data, lo.data), vec_mergeo(hi.data, lo.data) };
483
+ }
484
+ }
485
+
486
+ // le
487
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
488
+ XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
489
+ {
490
+ return vec_cmple(self.data, other.data);
491
+ }
492
+
493
+ // lt
494
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
495
+ XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
496
+ {
497
+ return vec_cmplt(self.data, other.data);
498
+ }
499
+
500
+ // max
501
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
502
+ XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
503
+ {
504
+ return vec_max(self.data, other.data);
505
+ }
506
+
507
+ // min
508
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
509
+ XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
510
+ {
511
+ return vec_min(self.data, other.data);
512
+ }
513
+
514
+ // mul
515
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
516
+ XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
517
+ {
518
+ return self.data * other.data;
519
+ }
520
+
521
+ // neg
522
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
523
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& self, requires_arch<vsx>) noexcept
524
+ {
525
+ return -(self.data);
526
+ }
527
+
528
+ // neq
529
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
530
+ XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
531
+ {
532
+ return ~vec_cmpeq(self.data, other.data);
533
+ }
534
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
535
+ XSIMD_INLINE batch_bool<T, A> neq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
536
+ {
537
+ return ~vec_cmpeq(self.data, other.data);
538
+ }
539
+
540
+ // reciprocal
541
+ template <class A>
542
+ XSIMD_INLINE batch<float, A> reciprocal(batch<float, A> const& self,
543
+ kernel::requires_arch<vsx>)
544
+ {
545
+ return vec_re(self.data);
546
+ }
547
+ template <class A>
548
+ XSIMD_INLINE batch<double, A> reciprocal(batch<double, A> const& self,
549
+ kernel::requires_arch<vsx>)
550
+ {
551
+ return vec_re(self.data);
552
+ }
553
+
554
+ // reduce_add
555
+ template <class A>
556
+ XSIMD_INLINE signed reduce_add(batch<signed, A> const& self, requires_arch<vsx>) noexcept
557
+ {
558
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
559
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v3, v1 + v2, v2 + v1, v3 + v0
560
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 + v1, v2 + v1, v3 + v0, v3 + v0
561
+ auto tmp3 = vec_add(tmp1, tmp2);
562
+ return vec_extract(tmp3, 0);
563
+ }
564
+ template <class A>
565
+ XSIMD_INLINE unsigned reduce_add(batch<unsigned, A> const& self, requires_arch<vsx>) noexcept
566
+ {
567
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
568
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v3, v1 + v2, v2 + v1, v3 + v0
569
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 + v1, v2 + v1, v3 + v0, v3 + v0
570
+ auto tmp3 = vec_add(tmp1, tmp2);
571
+ return vec_extract(tmp3, 0);
572
+ }
573
+ template <class A>
574
+ XSIMD_INLINE float reduce_add(batch<float, A> const& self, requires_arch<vsx>) noexcept
575
+ {
576
+ // FIXME: find an in-order approach
577
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
578
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v3, v1 + v2, v2 + v1, v3 + v0
579
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 + v1, v2 + v1, v3 + v0, v3 + v0
580
+ auto tmp3 = vec_add(tmp1, tmp2);
581
+ return vec_extract(tmp3, 0);
582
+ }
583
+ template <class A>
584
+ XSIMD_INLINE double reduce_add(batch<double, A> const& self, requires_arch<vsx>) noexcept
585
+ {
586
+ auto tmp0 = vec_reve(self.data); // v1, v0
587
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v1, v1 + v0
588
+ return vec_extract(tmp1, 0);
589
+ }
590
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
591
+ XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<vsx>) noexcept
592
+ {
593
+ return reduce_add(self, common {});
594
+ }
595
+
596
+ // reduce_mul
597
+ template <class A>
598
+ XSIMD_INLINE signed reduce_mul(batch<signed, A> const& self, requires_arch<vsx>) noexcept
599
+ {
600
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
601
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v3, v1 * v2, v2 * v1, v3 * v0
602
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 * v1, v2 * v1, v3 * v0, v3 * v0
603
+ auto tmp3 = vec_mul(tmp1, tmp2);
604
+ return vec_extract(tmp3, 0);
605
+ }
606
+ template <class A>
607
+ XSIMD_INLINE unsigned reduce_mul(batch<unsigned, A> const& self, requires_arch<vsx>) noexcept
608
+ {
609
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
610
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v3, v1 * v2, v2 * v1, v3 * v0
611
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 * v1, v2 * v1, v3 * v0, v3 * v0
612
+ auto tmp3 = vec_mul(tmp1, tmp2);
613
+ return vec_extract(tmp3, 0);
614
+ }
615
+ template <class A>
616
+ XSIMD_INLINE float reduce_mul(batch<float, A> const& self, requires_arch<vsx>) noexcept
617
+ {
618
+ // FIXME: find an in-order approach
619
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
620
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v3, v1 * v2, v2 * v1, v3 * v0
621
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 * v1, v2 * v1, v3 * v0, v3 * v0
622
+ auto tmp3 = vec_mul(tmp1, tmp2);
623
+ return vec_extract(tmp3, 0);
624
+ }
625
+ template <class A>
626
+ XSIMD_INLINE double reduce_mul(batch<double, A> const& self, requires_arch<vsx>) noexcept
627
+ {
628
+ auto tmp0 = vec_reve(self.data); // v1, v0
629
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v1, v1 * v0
630
+ return vec_extract(tmp1, 0);
631
+ }
632
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
633
+ XSIMD_INLINE T reduce_mul(batch<T, A> const& self, requires_arch<vsx>) noexcept
634
+ {
635
+ return reduce_mul(self, common {});
636
+ }
637
+
638
+ // round
639
+
640
+ // vec_round exists also for float vectors but is mapped to vrfin instruction which uses the wrong rounding mode
641
+ #if defined __has_builtin && __has_builtin(__builtin_vsx_xvrspi)
642
+ template <class A>
643
+ XSIMD_INLINE batch<float, A> round(batch<float, A> const& self, requires_arch<vsx>) noexcept
644
+ {
645
+ return __builtin_vsx_xvrspi(self.data);
646
+ }
647
+ #endif
648
+ // For double vectors vec_round uses xvrdpi which does the right thing
649
+ template <class A>
650
+ XSIMD_INLINE batch<double, A> round(batch<double, A> const& self, requires_arch<vsx>) noexcept
651
+ {
652
+ return vec_round(self.data);
653
+ }
654
+
655
+ // rsqrt
656
+ template <class A>
657
+ XSIMD_INLINE batch<float, A> rsqrt(batch<float, A> const& val, requires_arch<vsx>) noexcept
658
+ {
659
+ return vec_rsqrt(val.data);
660
+ }
661
+ template <class A>
662
+ XSIMD_INLINE batch<double, A> rsqrt(batch<double, A> const& val, requires_arch<vsx>) noexcept
663
+ {
664
+ return vec_rsqrt(val.data);
665
+ }
666
+
667
+ // select
668
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
669
+ 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<vsx>) noexcept
670
+ {
671
+ return vec_sel(false_br.data, true_br.data, cond.data);
672
+ }
673
+ template <class A, class T, bool... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
674
+ 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<vsx>) noexcept
675
+ {
676
+ return select(batch_bool<T, A> { Values... }, true_br, false_br, vsx {});
677
+ }
678
+
679
+ // shuffle
680
+ template <class A, class ITy, ITy I0, ITy I1, ITy I2, ITy I3>
681
+ 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<vsx>) noexcept
682
+ {
683
+ return vec_perm(x.data, y.data,
684
+ (__vector unsigned char) {
685
+ 4 * I0 + 0, 4 * I0 + 1, 4 * I0 + 2, 4 * I0 + 3,
686
+ 4 * I1 + 0, 4 * I1 + 1, 4 * I1 + 2, 4 * I1 + 3,
687
+ 4 * I2 + 0, 4 * I2 + 1, 4 * I2 + 2, 4 * I2 + 3,
688
+ 4 * I3 + 0, 4 * I3 + 1, 4 * I3 + 2, 4 * I3 + 3 });
689
+ }
690
+
691
+ template <class A, class ITy, ITy I0, ITy I1>
692
+ XSIMD_INLINE batch<double, A> shuffle(batch<double, A> const& x, batch<double, A> const& y, batch_constant<ITy, A, I0, I1>, requires_arch<vsx>) noexcept
693
+ {
694
+ return vec_perm(x.data, y.data,
695
+ (__vector unsigned char) {
696
+ 8 * I0 + 0,
697
+ 8 * I0 + 1,
698
+ 8 * I0 + 2,
699
+ 8 * I0 + 3,
700
+ 8 * I0 + 4,
701
+ 8 * I0 + 5,
702
+ 8 * I0 + 6,
703
+ 8 * I0 + 7,
704
+ 8 * I1 + 0,
705
+ 8 * I1 + 1,
706
+ 8 * I1 + 2,
707
+ 8 * I1 + 3,
708
+ 8 * I1 + 4,
709
+ 8 * I1 + 5,
710
+ 8 * I1 + 6,
711
+ 8 * I1 + 7,
712
+ });
713
+ }
714
+
715
+ // sqrt
716
+ template <class A>
717
+ XSIMD_INLINE batch<float, A> sqrt(batch<float, A> const& val, requires_arch<vsx>) noexcept
718
+ {
719
+ return vec_sqrt(val.data);
720
+ }
721
+
722
+ template <class A>
723
+ XSIMD_INLINE batch<double, A> sqrt(batch<double, A> const& val, requires_arch<vsx>) noexcept
724
+ {
725
+ return vec_sqrt(val.data);
726
+ }
727
+
728
+ // slide_left
729
+ template <size_t N, class A, class T>
730
+ XSIMD_INLINE batch<T, A> slide_left(batch<T, A> const& x, requires_arch<vsx>) noexcept
731
+ {
732
+ XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
733
+ {
734
+ return batch<T, A>(0);
735
+ }
736
+ else
737
+ {
738
+ auto slider = vec_splats((uint8_t)(8 * N));
739
+ return (typename batch<T, A>::register_type)vec_slo(x.data, slider);
740
+ }
741
+ }
742
+
743
+ // slide_right
744
+ template <size_t N, class A, class T>
745
+ XSIMD_INLINE batch<T, A> slide_right(batch<T, A> const& x, requires_arch<vsx>) noexcept
746
+ {
747
+ XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
748
+ {
749
+ return batch<T, A>(0);
750
+ }
751
+ else
752
+ {
753
+ auto slider = vec_splats((uint8_t)(8 * N));
754
+ return (typename batch<T, A>::register_type)vec_sro((__vector unsigned char)x.data, slider);
755
+ }
756
+ }
757
+
758
+ // sadd
759
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value && sizeof(T) != 8>>
760
+ XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
761
+ {
762
+ return vec_adds(self.data, other.data);
763
+ }
764
+
765
+ // set
766
+ template <class A, class T, class... Values>
767
+ XSIMD_INLINE batch<T, A> set(batch<T, A> const&, requires_arch<vsx>, Values... values) noexcept
768
+ {
769
+ static_assert(sizeof...(Values) == batch<T, A>::size, "consistent init");
770
+ return typename batch<T, A>::register_type { values... };
771
+ }
772
+
773
+ template <class A, class T, class... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
774
+ XSIMD_INLINE batch_bool<T, A> set(batch_bool<T, A> const&, requires_arch<vsx>, Values... values) noexcept
775
+ {
776
+ static_assert(sizeof...(Values) == batch_bool<T, A>::size, "consistent init");
777
+ return typename batch_bool<T, A>::register_type { static_cast<decltype(std::declval<typename batch_bool<T, A>::register_type>()[0])>(values ? -1LL : 0LL)... };
778
+ }
779
+
780
+ // ssub
781
+
782
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value && sizeof(T) == 1>>
783
+ XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
784
+ {
785
+ return vec_subs(self.data, other.data);
786
+ }
787
+
788
+ // store_aligned
789
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
790
+ XSIMD_INLINE void store_aligned(T* mem, batch<T, A> const& self, requires_arch<vsx>) noexcept
791
+ {
792
+ vec_xst((typename batch<T, A>::register_type)self.data, 0, (builtin_t<T>*)mem);
793
+ }
794
+
795
+ // store_unaligned
796
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
797
+ XSIMD_INLINE void store_unaligned(T* mem, batch<T, A> const& self, requires_arch<vsx>) noexcept
798
+ {
799
+ store_aligned<A>(mem, self, vsx {});
800
+ }
801
+
802
+ // sub
803
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
804
+ XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
805
+ {
806
+ return vec_sub(self.data, other.data);
807
+ }
808
+
809
+ // swizzle
810
+
811
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
812
+ XSIMD_INLINE batch<float, A> swizzle(batch<float, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vsx>) noexcept
813
+ {
814
+ return vec_perm(self.data, self.data,
815
+ (__vector unsigned char) {
816
+ 4 * V0 + 0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
817
+ 4 * V1 + 0, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
818
+ 4 * V2 + 0, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
819
+ 4 * V3 + 0, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3 });
820
+ }
821
+
822
+ template <class A, uint64_t V0, uint64_t V1>
823
+ XSIMD_INLINE batch<double, A> swizzle(batch<double, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vsx>) noexcept
824
+ {
825
+ return vec_perm(self.data, self.data,
826
+ (__vector unsigned char) {
827
+ 8 * V0 + 0,
828
+ 8 * V0 + 1,
829
+ 8 * V0 + 2,
830
+ 8 * V0 + 3,
831
+ 8 * V0 + 4,
832
+ 8 * V0 + 5,
833
+ 8 * V0 + 6,
834
+ 8 * V0 + 7,
835
+ 8 * V1 + 0,
836
+ 8 * V1 + 1,
837
+ 8 * V1 + 2,
838
+ 8 * V1 + 3,
839
+ 8 * V1 + 4,
840
+ 8 * V1 + 5,
841
+ 8 * V1 + 6,
842
+ 8 * V1 + 7,
843
+ });
844
+ }
845
+
846
+ template <class A, uint64_t V0, uint64_t V1>
847
+ XSIMD_INLINE batch<uint64_t, A> swizzle(batch<uint64_t, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vsx>) noexcept
848
+ {
849
+ return vec_perm(self.data, self.data,
850
+ (__vector unsigned char) {
851
+ 8 * V0 + 0,
852
+ 8 * V0 + 1,
853
+ 8 * V0 + 2,
854
+ 8 * V0 + 3,
855
+ 8 * V0 + 4,
856
+ 8 * V0 + 5,
857
+ 8 * V0 + 6,
858
+ 8 * V0 + 7,
859
+ 8 * V1 + 0,
860
+ 8 * V1 + 1,
861
+ 8 * V1 + 2,
862
+ 8 * V1 + 3,
863
+ 8 * V1 + 4,
864
+ 8 * V1 + 5,
865
+ 8 * V1 + 6,
866
+ 8 * V1 + 7,
867
+ });
868
+ }
869
+
870
+ template <class A, uint64_t V0, uint64_t V1>
871
+ XSIMD_INLINE batch<int64_t, A> swizzle(batch<int64_t, A> const& self, batch_constant<uint64_t, A, V0, V1> mask, requires_arch<vsx>) noexcept
872
+ {
873
+ return bitwise_cast<int64_t>(swizzle(bitwise_cast<uint64_t>(self), mask, vsx {}));
874
+ }
875
+
876
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
877
+ XSIMD_INLINE batch<uint32_t, A> swizzle(batch<uint32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vsx>) noexcept
878
+ {
879
+ return vec_perm(self.data, self.data,
880
+ (__vector unsigned char) {
881
+ 4 * V0 + 0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
882
+ 4 * V1 + 0, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
883
+ 4 * V2 + 0, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
884
+ 4 * V3 + 0, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3 });
885
+ }
886
+
887
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
888
+ XSIMD_INLINE batch<int32_t, A> swizzle(batch<int32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3> mask, requires_arch<vsx>) noexcept
889
+ {
890
+ return bitwise_cast<int32_t>(swizzle(bitwise_cast<uint32_t>(self), mask, vsx {}));
891
+ }
892
+
893
+ 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>
894
+ 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<vsx>) noexcept
895
+ {
896
+ return vec_perm(self.data, self.data,
897
+ (__vector unsigned char) {
898
+ 2 * V0 + 0, 2 * V0 + 1, 2 * V1 + 0, 2 * V1 + 1,
899
+ 2 * V2 + 0, 2 * V2 + 1, 2 * V3 + 0, 2 * V3 + 1,
900
+ 2 * V4 + 0, 2 * V4 + 1, 2 * V5 + 0, 2 * V5 + 1,
901
+ 2 * V6 + 0, 2 * V6 + 1, 2 * V7 + 0, 2 * V7 + 1 });
902
+ }
903
+
904
+ 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>
905
+ 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> mask, requires_arch<vsx>) noexcept
906
+ {
907
+ return bitwise_cast<int16_t>(swizzle(bitwise_cast<uint16_t>(self), mask, vsx {}));
908
+ }
909
+
910
+ // trunc
911
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
912
+ XSIMD_INLINE batch<T, A> trunc(batch<T, A> const& self, requires_arch<vsx>) noexcept
913
+ {
914
+ return vec_trunc(self.data);
915
+ }
916
+
917
+ // widen
918
+ template <class A>
919
+ XSIMD_INLINE std::array<batch<double, A>, 2> widen(batch<float, A> const& x, requires_arch<vsx>) noexcept
920
+ {
921
+ return { batch<double, A>(vec_doublel(x.data)), batch<double, A>(vec_doubleh(x.data)) };
922
+ }
923
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
924
+ XSIMD_INLINE std::array<batch<widen_t<T>, A>, 2> widen(batch<T, A> const& x, requires_arch<vsx>) noexcept
925
+ {
926
+ auto even = vec_mule(x.data, vec_splats(T(1))); // x0, x2, x4, x6
927
+ auto odd = vec_mulo(x.data, vec_splats(T(1))); // x1, x3, x5, x7
928
+ return { batch<widen_t<T>, A>(vec_mergel(even, odd)), batch<widen_t<T>, A>(vec_mergeh(even, odd)) };
929
+ }
930
+
931
+ // zip_hi
932
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
933
+ XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
934
+ {
935
+ return vec_mergel(self.data, other.data);
936
+ }
937
+
938
+ // zip_lo
939
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
940
+ XSIMD_INLINE batch<T, A> zip_lo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
941
+ {
942
+ return vec_mergeh(self.data, other.data);
943
+ }
944
+ }
945
+ }
946
+
947
+ #endif