I am trying to compile CLBG benchmarks with emscripten (C to WASM). However, most of them has included intrinsic headers (like <immintrin.h>) and that gave me a lot of errors (let`s use nbody.c as an example) like this:
nbody.c:137:20: error: use of undeclared identifier '__m128d' static alignas(__m128d) double
I already tried to compile with these flags
emcc nbody.c -o nbody.js -O2 -s WASM=1 -msse2 -msimd128
and it compiles. However, when I tried to run nbody.js with nodejs, it doesn`t work. I have also tried to run nodejs with
--experimental-wasm-simd
like this git tells, but it also doesn't work. It says:
failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Compiling function #4:"main" failed: invalid value type 'Simd128', enable with --experimental-wasm-simd @+422
CompileError: WebAssembly.instantiate(): Compiling function #4:"main" failed: invalid value type 'Simd128', enable with --experimental-wasm-simd @+422
RuntimeError: abort(CompileError: WebAssembly.instantiate(): Compiling function #4:"main" failed: invalid value type 'Simd128', enable with --experimental-wasm-simd @+422).
Build with -s ASSERTIONS=1 for more info.
Can anyone give me a hand? I am not understanding if this is already possible to do.
Add these compile flags to C and CXX Flags
-fPIC -Wno-implicit-function-declaration -msse2 -msimd128 -experimental-wasm-simd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With