gutter_runner/bazel/hello-world/hello-world-simd.cc
sergeypdev e80c619c04 Squashed 'libs/emsdk/' content from commit 3bcf1dcd0
git-subtree-dir: libs/emsdk
git-subtree-split: 3bcf1dcd01f040f370e10fe673a092d9ed79ebb5
2025-05-23 14:52:11 +04:00

11 lines
294 B
C++

#include <wasm_simd128.h>
void multiply_arrays(int* out, int* in_a, int* in_b, int size) {
for (int i = 0; i < size; i += 4) {
v128_t a = wasm_v128_load(&in_a[i]);
v128_t b = wasm_v128_load(&in_b[i]);
v128_t prod = wasm_i32x4_mul(a, b);
wasm_v128_store(&out[i], prod);
}
}