Thanks again Thomas for your precious feedback! Please also keep in mind that using emulated SIMD is slower than not using > SIMD at all. >
Yes, I know, but the Nudge physic library I use ( https://github.com/rasmusbarr/nudge <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Frasmusbarr%2Fnudge&sa=D&sntz=1&usg=AFQjCNEd2D0iUgvKXFE8KaZJ_OVgIDkpUA>) requires SIMD. I remember that last year, using an old version of emscripten, I managed it compile (with SIMD+asm.js+polyfill), but it was extremely slow when running inside the browser. Now using emscriptem +simde (https://github.com/nemequ/simde <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fnemequ%2Fsimde&sa=D&sntz=1&usg=AFQjCNEgOr3cze5687vGLOcNeEvX7khovA>) it's much faster. And, as far as the (non-emulated) SIMD version is concerned: Hi, unfortunately those headers you are using have nothing to do with > WebAssembly and will not enable you to compile code using x86 intrinsics > and targeting WebAssembly. I've filed an issue for this here: > https://github.com/emscripten-core/emsdk/issues/309. Clang is giving you > a warning about `-msse2` because that flag only works for x86 targets; SSE2 > is an x86 feature, not a WebAssembly feature. Notice that you are also > getting a large number of warnings about unrecognized builtin functions > like `__builtin_ia32_emms`. These builtin functions are used by the > mmintrin.h header you included but only exist when targeting x86, not > WebAssembly. > > You can read more about using WebAssembly SIMD intrinsics here: > https://emscripten.org/docs/porting/simd.html#porting-simd-code-targeting-webassembly > . > Thank you. I really needed this! However it seems that https://github.com/emscripten-core/emscripten/blob/incoming/system/include/wasm_simd128.h can't be used to convert existing SIMD code to WebAssembly SIMD. So, for example, if I replace: *-msse2* with *-msimd128* and *#include <immintrin.h>* with *#include <wasm_simd128.h>* I get: ../nudge.cpp:141:9: error: unknown type name '__m128' typedef __m128 simd4_float; ^ ../nudge.cpp:142:9: error: unknown type name '__m128i' typedef __m128i simd4_int32; ^ ../nudge.cpp:145:20: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 unpacklo32(__m128 x, __m128 y) { ^ ../nudge.cpp:145:38: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 unpacklo32(__m128 x, __m128 y) { ^ ../nudge.cpp:145:48: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 unpacklo32(__m128 x, __m128 y) { ^ ../nudge.cpp:149:20: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 unpackhi32(__m128 x, __m128 y) { ^ ../nudge.cpp:149:38: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 unpackhi32(__m128 x, __m128 y) { ^ ../nudge.cpp:149:48: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 unpackhi32(__m128 x, __m128 y) { ^ ../nudge.cpp:153:20: error: unknown type name '__m128i' NUDGE_FORCEINLINE __m128i unpacklo32(__m128i x, __m128i y) { ^ ../nudge.cpp:153:39: error: unknown type name '__m128i' NUDGE_FORCEINLINE __m128i unpacklo32(__m128i x, __m128i y) { ^ ../nudge.cpp:153:50: error: unknown type name '__m128i' NUDGE_FORCEINLINE __m128i unpacklo32(__m128i x, __m128i y) { ^ ../nudge.cpp:157:20: error: unknown type name '__m128i' NUDGE_FORCEINLINE __m128i unpackhi32(__m128i x, __m128i y) { ^ ../nudge.cpp:157:39: error: unknown type name '__m128i' NUDGE_FORCEINLINE __m128i unpackhi32(__m128i x, __m128i y) { ^ ../nudge.cpp:157:50: error: unknown type name '__m128i' NUDGE_FORCEINLINE __m128i unpackhi32(__m128i x, __m128i y) { ^ ../nudge.cpp:162:20: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 concat2x32(__m128 x, __m128 y) { ^ ../nudge.cpp:162:38: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 concat2x32(__m128 x, __m128 y) { ^ ../nudge.cpp:162:48: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 concat2x32(__m128 x, __m128 y) { ^ ../nudge.cpp:163:31: error: use of undeclared identifier '_MM_SHUFFLE' return _mm_shuffle_ps(x, y, _MM_SHUFFLE(y1, y0, x1, x0)); ^ ../nudge.cpp:167:20: error: unknown type name '__m128' NUDGE_FORCEINLINE __m128 shuffle32(__m128 x) { ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. because the type *__m128* is not detected. It would be too much work for me to make a full WebAssembly-SIMD conversion for now, so I'm glad with the emulated version. Thank you again! -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/3b8b9ca4-287f-4251-9620-aa934d54d337%40googlegroups.com.
