DATE: 2021.6.6
1、Wasm simd优化方法
参考:
https://emscripten.org/docs/porting/simd.html
https://github.com/WebAssembly/simd/blob/main/proposals/simd/SIMD.md
https://v8.dev/features/simd#building-with-simd-support
1.1、编译器优化选项
使用 –msimd128 选项,可以使能SIMD。它会打开LLVM的自动矢量化过程。
LLVM’s autovectorizers are enabled by default at optimization levels -O2 and -O3 when the -msimd128 flag is supplied.
-s SIMD=1
1.2、缺陷和行为差异
注意:
1、 Emscripten不支持x86和inline汇编,只支持intrinsic汇编。
2、 WebAssembly SIMD无法控制浮点舍入模式的管理或非规格化处理。
3、 WebAssembly SIMD不支持cache line prefetch。