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.
- package/README.md +10 -1
- package/android/build.gradle.kts +4 -3
- package/ios/RnExecutorch.mm +15 -17
- package/lib/module/fetcher/fetcher.js +35 -122
- package/lib/module/fetcher/fetcher.js.map +1 -1
- package/lib/module/fetcher/telemetry.js +1 -1
- package/lib/module/index.js +12 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/models.js +4 -2
- package/lib/module/models.js.map +1 -1
- package/lib/typescript/src/fetcher/fetcher.d.ts +3 -7
- package/lib/typescript/src/fetcher/fetcher.d.ts.map +1 -1
- package/lib/typescript/src/models.d.ts.map +1 -1
- package/package.json +9 -7
- package/react-native-executorch.podspec +6 -2
- package/src/fetcher/fetcher.ts +38 -131
- package/src/fetcher/telemetry.ts +1 -1
- package/src/models.ts +6 -1
- package/third-party/common/phonemis/CMakeLists.txt +70 -14
- package/third-party/common/phonemis/README.md +183 -33
- package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
- package/third-party/common/phonemis/knowledge/code_style.md +642 -0
- package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
- package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
- package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
- package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
- package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
- package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
- package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
- package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
- package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
- package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
- package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
- package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
- package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
- package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
- package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
- package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
- package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
- package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
- package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
- package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
- package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
- package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
- package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
- package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
- package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
- package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
- package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
- package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
- package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
- package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
- package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
- package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
- package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
- package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
- package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
- package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
- package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
- package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
- package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
- package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
- package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
- package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
- package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
- package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
- package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
- package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
- package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
- package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
- package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
- package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
- package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
- package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
- package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
- package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
- package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
- package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
- package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
- package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
- package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
- package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
- package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
- package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
- package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
- package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
- package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
- package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
|
@@ -0,0 +1,66 @@
|
|
|
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_SSE3_HPP
|
|
13
|
+
#define XSIMD_SSE3_HPP
|
|
14
|
+
|
|
15
|
+
#include "../types/xsimd_sse3_register.hpp"
|
|
16
|
+
#include <type_traits>
|
|
17
|
+
|
|
18
|
+
namespace xsimd
|
|
19
|
+
{
|
|
20
|
+
|
|
21
|
+
namespace kernel
|
|
22
|
+
{
|
|
23
|
+
using namespace types;
|
|
24
|
+
|
|
25
|
+
// haddp
|
|
26
|
+
template <class A>
|
|
27
|
+
XSIMD_INLINE batch<float, A> haddp(batch<float, A> const* row, requires_arch<sse3>) noexcept
|
|
28
|
+
{
|
|
29
|
+
return _mm_hadd_ps(_mm_hadd_ps(row[0], row[1]),
|
|
30
|
+
_mm_hadd_ps(row[2], row[3]));
|
|
31
|
+
}
|
|
32
|
+
template <class A>
|
|
33
|
+
XSIMD_INLINE batch<double, A> haddp(batch<double, A> const* row, requires_arch<sse3>) noexcept
|
|
34
|
+
{
|
|
35
|
+
return _mm_hadd_pd(row[0], row[1]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// load_unaligned
|
|
39
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
40
|
+
XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<sse3>) noexcept
|
|
41
|
+
{
|
|
42
|
+
return _mm_lddqu_si128((__m128i const*)mem);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// reduce_add
|
|
46
|
+
template <class A>
|
|
47
|
+
XSIMD_INLINE float reduce_add(batch<float, A> const& self, requires_arch<sse3>) noexcept
|
|
48
|
+
{
|
|
49
|
+
__m128 tmp0 = _mm_hadd_ps(self, self);
|
|
50
|
+
__m128 tmp1 = _mm_hadd_ps(tmp0, tmp0);
|
|
51
|
+
return _mm_cvtss_f32(tmp1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// reduce_mul
|
|
55
|
+
template <class A>
|
|
56
|
+
XSIMD_INLINE float reduce_mul(batch<float, A> const& self, requires_arch<sse3>) noexcept
|
|
57
|
+
{
|
|
58
|
+
__m128 tmp1 = _mm_mul_ps(self, _mm_movehl_ps(self, self));
|
|
59
|
+
__m128 tmp2 = _mm_mul_ps(tmp1, _mm_movehdup_ps(tmp1));
|
|
60
|
+
return _mm_cvtss_f32(tmp2);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#endif
|
|
@@ -0,0 +1,510 @@
|
|
|
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_SSE4_1_HPP
|
|
13
|
+
#define XSIMD_SSE4_1_HPP
|
|
14
|
+
|
|
15
|
+
#include <type_traits>
|
|
16
|
+
|
|
17
|
+
#include "../types/xsimd_sse4_1_register.hpp"
|
|
18
|
+
#include "./common/xsimd_common_cast.hpp"
|
|
19
|
+
|
|
20
|
+
namespace xsimd
|
|
21
|
+
{
|
|
22
|
+
|
|
23
|
+
namespace kernel
|
|
24
|
+
{
|
|
25
|
+
using namespace types;
|
|
26
|
+
// any
|
|
27
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
28
|
+
XSIMD_INLINE bool any(batch<T, A> const& self, requires_arch<sse4_1>) noexcept
|
|
29
|
+
{
|
|
30
|
+
return !_mm_testz_si128(self, self);
|
|
31
|
+
}
|
|
32
|
+
// ceil
|
|
33
|
+
template <class A>
|
|
34
|
+
XSIMD_INLINE batch<float, A> ceil(batch<float, A> const& self, requires_arch<sse4_1>) noexcept
|
|
35
|
+
{
|
|
36
|
+
return _mm_ceil_ps(self);
|
|
37
|
+
}
|
|
38
|
+
template <class A>
|
|
39
|
+
XSIMD_INLINE batch<double, A> ceil(batch<double, A> const& self, requires_arch<sse4_1>) noexcept
|
|
40
|
+
{
|
|
41
|
+
return _mm_ceil_pd(self);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// bitwise_lshift multiple (constant)
|
|
45
|
+
template <class A, uint32_t... Vs>
|
|
46
|
+
XSIMD_INLINE batch<uint32_t, A> bitwise_lshift(
|
|
47
|
+
batch<uint32_t, A> const& self, batch_constant<uint32_t, A, Vs...>, requires_arch<sse4_1>) noexcept
|
|
48
|
+
{
|
|
49
|
+
constexpr auto mults = batch_constant<uint32_t, A, static_cast<uint32_t>(1u << Vs)...>();
|
|
50
|
+
return _mm_mullo_epi32(self, mults.as_batch());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// fast_cast
|
|
54
|
+
namespace detail
|
|
55
|
+
{
|
|
56
|
+
template <class A>
|
|
57
|
+
XSIMD_INLINE batch<double, A> fast_cast(batch<int64_t, A> const& x, batch<double, A> const&, requires_arch<sse4_1>) noexcept
|
|
58
|
+
{
|
|
59
|
+
// from https://stackoverflow.com/questions/41144668/how-to-efficiently-perform-double-int64-conversions-with-sse-avx
|
|
60
|
+
__m128i xH = _mm_srai_epi32(x, 16);
|
|
61
|
+
xH = _mm_blend_epi16(xH, _mm_setzero_si128(), 0x33);
|
|
62
|
+
xH = _mm_add_epi64(xH, _mm_castpd_si128(_mm_set1_pd(442721857769029238784.))); // 3*2^67
|
|
63
|
+
__m128i xL = _mm_blend_epi16(x, _mm_castpd_si128(_mm_set1_pd(0x0010000000000000)), 0x88); // 2^52
|
|
64
|
+
__m128d f = _mm_sub_pd(_mm_castsi128_pd(xH), _mm_set1_pd(442726361368656609280.)); // 3*2^67 + 2^52
|
|
65
|
+
detail::reassociation_barrier(f, "prevent (xH-C)+xL -> xH+(xL-C)");
|
|
66
|
+
return _mm_add_pd(f, _mm_castsi128_pd(xL));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
template <class A>
|
|
70
|
+
XSIMD_INLINE batch<double, A> fast_cast(batch<uint64_t, A> const& x, batch<double, A> const&, requires_arch<sse4_1>) noexcept
|
|
71
|
+
{
|
|
72
|
+
// from https://stackoverflow.com/questions/41144668/how-to-efficiently-perform-double-int64-conversions-with-sse-avx
|
|
73
|
+
__m128i xH = _mm_srli_epi64(x, 32);
|
|
74
|
+
xH = _mm_or_si128(xH, _mm_castpd_si128(_mm_set1_pd(19342813113834066795298816.))); // 2^84
|
|
75
|
+
__m128i xL = _mm_blend_epi16(x, _mm_castpd_si128(_mm_set1_pd(0x0010000000000000)), 0xcc); // 2^52
|
|
76
|
+
__m128d f = _mm_sub_pd(_mm_castsi128_pd(xH), _mm_set1_pd(19342813118337666422669312.)); // 2^84 + 2^52
|
|
77
|
+
detail::reassociation_barrier(f, "prevent (xH-C)+xL -> xH+(xL-C)");
|
|
78
|
+
return _mm_add_pd(f, _mm_castsi128_pd(xL));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// eq
|
|
83
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
84
|
+
XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<sse4_1>) noexcept
|
|
85
|
+
{
|
|
86
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
|
|
87
|
+
{
|
|
88
|
+
return _mm_cmpeq_epi64(self, other);
|
|
89
|
+
}
|
|
90
|
+
else
|
|
91
|
+
{
|
|
92
|
+
return eq(self, other, ssse3 {});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// floor
|
|
97
|
+
template <class A>
|
|
98
|
+
XSIMD_INLINE batch<float, A> floor(batch<float, A> const& self, requires_arch<sse4_1>) noexcept
|
|
99
|
+
{
|
|
100
|
+
return _mm_floor_ps(self);
|
|
101
|
+
}
|
|
102
|
+
template <class A>
|
|
103
|
+
XSIMD_INLINE batch<double, A> floor(batch<double, A> const& self, requires_arch<sse4_1>) noexcept
|
|
104
|
+
{
|
|
105
|
+
return _mm_floor_pd(self);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// get
|
|
109
|
+
template <class A, size_t I, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
110
|
+
XSIMD_INLINE T get(batch<T, A> const& self, ::xsimd::index<I>, requires_arch<sse4_1>) noexcept
|
|
111
|
+
{
|
|
112
|
+
XSIMD_IF_CONSTEXPR(I == 0)
|
|
113
|
+
{
|
|
114
|
+
return first(self, sse2 {});
|
|
115
|
+
}
|
|
116
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
117
|
+
{
|
|
118
|
+
return static_cast<T>(_mm_extract_epi8(self, I));
|
|
119
|
+
}
|
|
120
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
121
|
+
{
|
|
122
|
+
return static_cast<T>(_mm_extract_epi16(self, I));
|
|
123
|
+
}
|
|
124
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
125
|
+
{
|
|
126
|
+
return static_cast<T>(_mm_extract_epi32(self, I));
|
|
127
|
+
}
|
|
128
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
|
|
129
|
+
{
|
|
130
|
+
#if defined(__x86_64__)
|
|
131
|
+
return static_cast<T>(_mm_extract_epi64(self, I));
|
|
132
|
+
#else
|
|
133
|
+
return get(self, ::xsimd::index<I> {}, sse2 {});
|
|
134
|
+
#endif
|
|
135
|
+
}
|
|
136
|
+
else
|
|
137
|
+
{
|
|
138
|
+
assert(false && "unsupported arch/op combination");
|
|
139
|
+
return {};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// insert
|
|
144
|
+
template <class A, class T, size_t I, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
145
|
+
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I> pos, requires_arch<sse4_1>) noexcept
|
|
146
|
+
{
|
|
147
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
148
|
+
{
|
|
149
|
+
return _mm_insert_epi8(self, val, I);
|
|
150
|
+
}
|
|
151
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
152
|
+
{
|
|
153
|
+
return _mm_insert_epi32(self, val, I);
|
|
154
|
+
}
|
|
155
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
|
|
156
|
+
{
|
|
157
|
+
#if (!defined(_MSC_VER) && __x86_64__) || (_MSC_VER > 1900 && defined(_M_X64))
|
|
158
|
+
return _mm_insert_epi64(self, val, I);
|
|
159
|
+
#else
|
|
160
|
+
uint32_t lo, hi;
|
|
161
|
+
memcpy(&lo, (reinterpret_cast<uint32_t*>(&val)), sizeof(lo));
|
|
162
|
+
memcpy(&hi, (reinterpret_cast<uint32_t*>(&val)) + 1, sizeof(hi));
|
|
163
|
+
return _mm_insert_epi32(_mm_insert_epi32(self, lo, 2 * I), hi, 2 * I + 1);
|
|
164
|
+
#endif
|
|
165
|
+
}
|
|
166
|
+
else
|
|
167
|
+
{
|
|
168
|
+
return insert(self, val, pos, ssse3 {});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// load_unaligned<batch_bool>
|
|
173
|
+
|
|
174
|
+
template <class A, class T, class = std::enable_if_t<(std::is_integral<T>::value && sizeof(T) > 1)>>
|
|
175
|
+
XSIMD_INLINE batch_bool<T, A> load_unaligned(bool const* mem, batch_bool<T, A>, requires_arch<sse4_1>) noexcept
|
|
176
|
+
{
|
|
177
|
+
// GCC <12 have missing or buggy unaligned load intrinsics; use memcpy to work around this.
|
|
178
|
+
// GCC/Clang/MSVC will turn it into the correct load.
|
|
179
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
180
|
+
{
|
|
181
|
+
#if defined(__x86_64__)
|
|
182
|
+
uint64_t tmp;
|
|
183
|
+
memcpy(&tmp, mem, sizeof(tmp));
|
|
184
|
+
auto val = _mm_cvtsi64_si128(tmp);
|
|
185
|
+
#else
|
|
186
|
+
__m128i val;
|
|
187
|
+
memcpy(&val, mem, sizeof(uint64_t));
|
|
188
|
+
#endif
|
|
189
|
+
return { _mm_sub_epi16(_mm_set1_epi8(0), _mm_cvtepu8_epi16(val)) };
|
|
190
|
+
}
|
|
191
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
192
|
+
{
|
|
193
|
+
uint32_t tmp;
|
|
194
|
+
memcpy(&tmp, mem, sizeof(tmp));
|
|
195
|
+
return { _mm_sub_epi32(_mm_set1_epi8(0), _mm_cvtepu8_epi32(_mm_cvtsi32_si128(tmp))) };
|
|
196
|
+
}
|
|
197
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
|
|
198
|
+
{
|
|
199
|
+
uint16_t tmp;
|
|
200
|
+
memcpy(&tmp, mem, sizeof(tmp));
|
|
201
|
+
return { _mm_sub_epi64(_mm_set1_epi8(0), _mm_cvtepu8_epi64(_mm_cvtsi32_si128((uint32_t)tmp))) };
|
|
202
|
+
}
|
|
203
|
+
else
|
|
204
|
+
{
|
|
205
|
+
assert(false && "unsupported arch/op combination");
|
|
206
|
+
return __m128i {};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
template <class A>
|
|
211
|
+
XSIMD_INLINE batch_bool<float, A> load_unaligned(bool const* mem, batch_bool<float, A>, requires_arch<sse4_1> r) noexcept
|
|
212
|
+
{
|
|
213
|
+
return { _mm_castsi128_ps(load_unaligned(mem, batch_bool<uint32_t, A> {}, r)) };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
template <class A>
|
|
217
|
+
XSIMD_INLINE batch_bool<double, A> load_unaligned(bool const* mem, batch_bool<double, A>, requires_arch<sse4_1> r) noexcept
|
|
218
|
+
{
|
|
219
|
+
return { _mm_castsi128_pd(load_unaligned(mem, batch_bool<uint64_t, A> {}, r)) };
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// max
|
|
223
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
224
|
+
XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<sse4_1>) noexcept
|
|
225
|
+
{
|
|
226
|
+
if (std::is_signed<T>::value)
|
|
227
|
+
{
|
|
228
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
229
|
+
{
|
|
230
|
+
return _mm_max_epi8(self, other);
|
|
231
|
+
}
|
|
232
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
233
|
+
{
|
|
234
|
+
return _mm_max_epi16(self, other);
|
|
235
|
+
}
|
|
236
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
237
|
+
{
|
|
238
|
+
return _mm_max_epi32(self, other);
|
|
239
|
+
}
|
|
240
|
+
else
|
|
241
|
+
{
|
|
242
|
+
return max(self, other, ssse3 {});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else
|
|
246
|
+
{
|
|
247
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
248
|
+
{
|
|
249
|
+
return _mm_max_epu8(self, other);
|
|
250
|
+
}
|
|
251
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
252
|
+
{
|
|
253
|
+
return _mm_max_epu16(self, other);
|
|
254
|
+
}
|
|
255
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
256
|
+
{
|
|
257
|
+
return _mm_max_epu32(self, other);
|
|
258
|
+
}
|
|
259
|
+
else
|
|
260
|
+
{
|
|
261
|
+
return max(self, other, ssse3 {});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// load_stream
|
|
267
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value, void>>
|
|
268
|
+
XSIMD_INLINE batch<T, A> load_stream(T const* mem, convert<T>, requires_arch<sse4_1>) noexcept
|
|
269
|
+
{
|
|
270
|
+
return _mm_stream_load_si128((__m128i*)mem);
|
|
271
|
+
}
|
|
272
|
+
template <class A>
|
|
273
|
+
XSIMD_INLINE batch<float, A> load_stream(float const* mem, convert<float>, requires_arch<sse4_1>) noexcept
|
|
274
|
+
{
|
|
275
|
+
return _mm_castsi128_ps(_mm_stream_load_si128((__m128i*)mem));
|
|
276
|
+
}
|
|
277
|
+
template <class A>
|
|
278
|
+
XSIMD_INLINE batch<double, A> load_stream(double const* mem, convert<double>, requires_arch<sse4_1>) noexcept
|
|
279
|
+
{
|
|
280
|
+
return _mm_castsi128_pd(_mm_stream_load_si128((__m128i*)mem));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// min
|
|
284
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
285
|
+
XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<sse4_1>) noexcept
|
|
286
|
+
{
|
|
287
|
+
if (std::is_signed<T>::value)
|
|
288
|
+
{
|
|
289
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
290
|
+
{
|
|
291
|
+
return _mm_min_epi8(self, other);
|
|
292
|
+
}
|
|
293
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
294
|
+
{
|
|
295
|
+
return _mm_min_epi16(self, other);
|
|
296
|
+
}
|
|
297
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
298
|
+
{
|
|
299
|
+
return _mm_min_epi32(self, other);
|
|
300
|
+
}
|
|
301
|
+
else
|
|
302
|
+
{
|
|
303
|
+
return min(self, other, ssse3 {});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else
|
|
307
|
+
{
|
|
308
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
309
|
+
{
|
|
310
|
+
return _mm_min_epu8(self, other);
|
|
311
|
+
}
|
|
312
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
313
|
+
{
|
|
314
|
+
return _mm_min_epu16(self, other);
|
|
315
|
+
}
|
|
316
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
317
|
+
{
|
|
318
|
+
return _mm_min_epu32(self, other);
|
|
319
|
+
}
|
|
320
|
+
else
|
|
321
|
+
{
|
|
322
|
+
return min(self, other, ssse3 {});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// mul
|
|
328
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
329
|
+
XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<sse4_1>) noexcept
|
|
330
|
+
{
|
|
331
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
332
|
+
{
|
|
333
|
+
return _mm_or_si128(
|
|
334
|
+
_mm_and_si128(_mm_mullo_epi16(self, other), _mm_srli_epi16(_mm_cmpeq_epi8(self, self), 8)),
|
|
335
|
+
_mm_slli_epi16(_mm_mullo_epi16(_mm_srli_epi16(self, 8), _mm_srli_epi16(other, 8)), 8));
|
|
336
|
+
}
|
|
337
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
338
|
+
{
|
|
339
|
+
return _mm_mullo_epi16(self, other);
|
|
340
|
+
}
|
|
341
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
342
|
+
{
|
|
343
|
+
return _mm_mullo_epi32(self, other);
|
|
344
|
+
}
|
|
345
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
|
|
346
|
+
{
|
|
347
|
+
return _mm_add_epi64(
|
|
348
|
+
_mm_mul_epu32(self, other),
|
|
349
|
+
_mm_slli_epi64(
|
|
350
|
+
_mm_add_epi64(
|
|
351
|
+
_mm_mul_epu32(other, _mm_shuffle_epi32(self, _MM_SHUFFLE(2, 3, 0, 1))),
|
|
352
|
+
_mm_mul_epu32(self, _mm_shuffle_epi32(other, _MM_SHUFFLE(2, 3, 0, 1)))),
|
|
353
|
+
32));
|
|
354
|
+
}
|
|
355
|
+
else
|
|
356
|
+
{
|
|
357
|
+
assert(false && "unsupported arch/op combination");
|
|
358
|
+
return {};
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// nearbyint
|
|
363
|
+
template <class A>
|
|
364
|
+
XSIMD_INLINE batch<float, A> nearbyint(batch<float, A> const& self, requires_arch<sse4_1>) noexcept
|
|
365
|
+
{
|
|
366
|
+
return _mm_round_ps(self, _MM_FROUND_TO_NEAREST_INT);
|
|
367
|
+
}
|
|
368
|
+
template <class A>
|
|
369
|
+
XSIMD_INLINE batch<double, A> nearbyint(batch<double, A> const& self, requires_arch<sse4_1>) noexcept
|
|
370
|
+
{
|
|
371
|
+
return _mm_round_pd(self, _MM_FROUND_TO_NEAREST_INT);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// select
|
|
375
|
+
namespace detail
|
|
376
|
+
{
|
|
377
|
+
template <class T>
|
|
378
|
+
XSIMD_INLINE constexpr T interleave(T const& cond) noexcept
|
|
379
|
+
{
|
|
380
|
+
return (((cond * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL >> 49) & 0x5555) | (((cond * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL >> 48) & 0xAAAA);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
385
|
+
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<sse4_1>) noexcept
|
|
386
|
+
{
|
|
387
|
+
return _mm_blendv_epi8(false_br, true_br, cond);
|
|
388
|
+
}
|
|
389
|
+
template <class A>
|
|
390
|
+
XSIMD_INLINE batch<float, A> select(batch_bool<float, A> const& cond, batch<float, A> const& true_br, batch<float, A> const& false_br, requires_arch<sse4_1>) noexcept
|
|
391
|
+
{
|
|
392
|
+
return _mm_blendv_ps(false_br, true_br, cond);
|
|
393
|
+
}
|
|
394
|
+
template <class A>
|
|
395
|
+
XSIMD_INLINE batch<double, A> select(batch_bool<double, A> const& cond, batch<double, A> const& true_br, batch<double, A> const& false_br, requires_arch<sse4_1>) noexcept
|
|
396
|
+
{
|
|
397
|
+
return _mm_blendv_pd(false_br, true_br, cond);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
template <class A, class T, bool... Values, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
401
|
+
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<sse4_1>) noexcept
|
|
402
|
+
{
|
|
403
|
+
constexpr int mask = batch_bool_constant<T, A, Values...>::mask();
|
|
404
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
405
|
+
{
|
|
406
|
+
return _mm_blend_epi16(false_br, true_br, mask);
|
|
407
|
+
}
|
|
408
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
409
|
+
{
|
|
410
|
+
constexpr int imask = detail::interleave(mask);
|
|
411
|
+
return _mm_blend_epi16(false_br, true_br, imask);
|
|
412
|
+
}
|
|
413
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
|
|
414
|
+
{
|
|
415
|
+
constexpr int imask = detail::interleave(mask);
|
|
416
|
+
constexpr int imask2 = detail::interleave(imask);
|
|
417
|
+
return _mm_blend_epi16(false_br, true_br, imask2);
|
|
418
|
+
}
|
|
419
|
+
else
|
|
420
|
+
{
|
|
421
|
+
return select(batch_bool_constant<T, A, Values...>(), true_br, false_br, ssse3 {});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
template <class A, bool... Values>
|
|
425
|
+
XSIMD_INLINE batch<float, A> select(batch_bool_constant<float, A, Values...> const&, batch<float, A> const& true_br, batch<float, A> const& false_br, requires_arch<sse4_1>) noexcept
|
|
426
|
+
{
|
|
427
|
+
constexpr int mask = batch_bool_constant<float, A, Values...>::mask();
|
|
428
|
+
return _mm_blend_ps(false_br, true_br, mask);
|
|
429
|
+
}
|
|
430
|
+
template <class A, bool... Values>
|
|
431
|
+
XSIMD_INLINE batch<double, A> select(batch_bool_constant<double, A, Values...> const&, batch<double, A> const& true_br, batch<double, A> const& false_br, requires_arch<sse4_1>) noexcept
|
|
432
|
+
{
|
|
433
|
+
constexpr int mask = batch_bool_constant<double, A, Values...>::mask();
|
|
434
|
+
return _mm_blend_pd(false_br, true_br, mask);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// trunc
|
|
438
|
+
template <class A>
|
|
439
|
+
XSIMD_INLINE batch<float, A> trunc(batch<float, A> const& self, requires_arch<sse4_1>) noexcept
|
|
440
|
+
{
|
|
441
|
+
return _mm_round_ps(self, _MM_FROUND_TO_ZERO);
|
|
442
|
+
}
|
|
443
|
+
template <class A>
|
|
444
|
+
XSIMD_INLINE batch<double, A> trunc(batch<double, A> const& self, requires_arch<sse4_1>) noexcept
|
|
445
|
+
{
|
|
446
|
+
return _mm_round_pd(self, _MM_FROUND_TO_ZERO);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// widen
|
|
450
|
+
template <class A, class T>
|
|
451
|
+
XSIMD_INLINE std::array<batch<widen_t<T>, A>, 2> widen(batch<T, A> const& x, requires_arch<sse4_1>) noexcept
|
|
452
|
+
{
|
|
453
|
+
__m128i x_lo = x;
|
|
454
|
+
__m128i x_hi = _mm_unpackhi_epi64(x, x);
|
|
455
|
+
__m128i lo, hi;
|
|
456
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
457
|
+
{
|
|
458
|
+
XSIMD_IF_CONSTEXPR(std::is_signed<T>::value)
|
|
459
|
+
{
|
|
460
|
+
lo = _mm_cvtepi32_epi64(x_lo);
|
|
461
|
+
hi = _mm_cvtepi32_epi64(x_hi);
|
|
462
|
+
}
|
|
463
|
+
else
|
|
464
|
+
{
|
|
465
|
+
lo = _mm_cvtepu32_epi64(x_lo);
|
|
466
|
+
hi = _mm_cvtepu32_epi64(x_hi);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
470
|
+
{
|
|
471
|
+
XSIMD_IF_CONSTEXPR(std::is_signed<T>::value)
|
|
472
|
+
{
|
|
473
|
+
lo = _mm_cvtepi16_epi32(x_lo);
|
|
474
|
+
hi = _mm_cvtepi16_epi32(x_hi);
|
|
475
|
+
}
|
|
476
|
+
else
|
|
477
|
+
{
|
|
478
|
+
lo = _mm_cvtepu16_epi32(x_lo);
|
|
479
|
+
hi = _mm_cvtepu16_epi32(x_hi);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
|
|
483
|
+
{
|
|
484
|
+
XSIMD_IF_CONSTEXPR(std::is_signed<T>::value)
|
|
485
|
+
{
|
|
486
|
+
lo = _mm_cvtepi8_epi16(x_lo);
|
|
487
|
+
hi = _mm_cvtepi8_epi16(x_hi);
|
|
488
|
+
}
|
|
489
|
+
else
|
|
490
|
+
{
|
|
491
|
+
lo = _mm_cvtepu8_epi16(x_lo);
|
|
492
|
+
hi = _mm_cvtepu8_epi16(x_hi);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return { lo, hi };
|
|
496
|
+
}
|
|
497
|
+
template <class A>
|
|
498
|
+
XSIMD_INLINE std::array<batch<double, A>, 2> widen(batch<float, A> const& x, requires_arch<sse4_1>) noexcept
|
|
499
|
+
{
|
|
500
|
+
__m128 x_shuf = _mm_unpackhi_ps(x, x);
|
|
501
|
+
__m128d lo = _mm_cvtps_pd(x);
|
|
502
|
+
__m128d hi = _mm_cvtps_pd(x_shuf);
|
|
503
|
+
return { lo, hi };
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
#endif
|
|
@@ -0,0 +1,44 @@
|
|
|
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_SSE4_2_HPP
|
|
13
|
+
#define XSIMD_SSE4_2_HPP
|
|
14
|
+
|
|
15
|
+
#include <limits>
|
|
16
|
+
|
|
17
|
+
#include "../types/xsimd_sse4_2_register.hpp"
|
|
18
|
+
|
|
19
|
+
namespace xsimd
|
|
20
|
+
{
|
|
21
|
+
|
|
22
|
+
namespace kernel
|
|
23
|
+
{
|
|
24
|
+
using namespace types;
|
|
25
|
+
|
|
26
|
+
// lt
|
|
27
|
+
template <class A>
|
|
28
|
+
XSIMD_INLINE batch_bool<int64_t, A> lt(batch<int64_t, A> const& self, batch<int64_t, A> const& other, requires_arch<sse4_2>) noexcept
|
|
29
|
+
{
|
|
30
|
+
return _mm_cmpgt_epi64(other, self);
|
|
31
|
+
}
|
|
32
|
+
template <class A>
|
|
33
|
+
XSIMD_INLINE batch_bool<uint64_t, A> lt(batch<uint64_t, A> const& self, batch<uint64_t, A> const& other, requires_arch<sse4_2>) noexcept
|
|
34
|
+
{
|
|
35
|
+
auto xself = _mm_xor_si128(self, _mm_set1_epi64x(std::numeric_limits<int64_t>::lowest()));
|
|
36
|
+
auto xother = _mm_xor_si128(other, _mm_set1_epi64x(std::numeric_limits<int64_t>::lowest()));
|
|
37
|
+
return _mm_cmpgt_epi64(xother, xself);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#endif
|