Hi Charles,

Thanks for the reply.

Anything that uses processor specific intrinsics won't work with Emscripten.
> There is support for SSE 3 and below, but see details here:
> https://kripken.github.io/emscripten-site/docs/porting/simd.html


Are these two statements not contradictory?

I realise in the mainline version there is only support up to SSE3. This
github issue[0] suggested that one of the developers had provided partial
support for SSE4.1 and this file ssimmintrin.h[1] provides coverage for the
intrinsics we're using. However when I include the header the compiler
breaks on the wrapper code.

Maybe I'm trying to use something that is too new?

Cheers,
Joe

[0] https://github.com/kripken/emscripten/issues/4030
[1]
https://github.com/kripken/emscripten/blob/af684d5600492a5d69f0ae986492762f0fc87981/system/include/emscripten/smmintrin.h

On Tue, Nov 1, 2016 at 10:33 PM, Charles Vaughn <[email protected]> wrote:

> Anything that uses processor specific intrinsics won't work with
> Emscripten.
>
> There is support for SSE 3 and below, but see details here:
> https://kripken.github.io/emscripten-site/docs/porting/simd.html
>
> Especially if you're not using it in a browser with built in SIMD support,
> don't expect it to be fast.
>
>
> On Tuesday, November 1, 2016 at 7:50:31 AM UTC-7, [email protected]
> wrote:
>>
>> Hi,
>>
>> I'm trying to compile our C++ code that makes use of SSE 4.1 intrinsics.
>>
>> I'm on OSX 10.11.6 using emscripten-incoming-64bit on commit
>> a28973d1b60a22723768e4e2bbe77b6795f964d1
>>
>> The emscripten command I'm running is:
>>
>> path/to/emscripten/incoming/em++ --pre-js 
>> /Users/joe/Desktop/test2/js/hv_wrapper.js
>> /Users/joe/Desktop/test2/c/Heavy_heavy.cpp 
>> /Users/joe/Desktop/test2/c/HeavyContext.cpp
>> /Users/joe/Desktop/test2/c/HvHeavy.cpp 
>> /Users/joe/Desktop/test2/c/HvLightPipe.c
>> /Users/joe/Desktop/test2/c/HvMessage.c 
>> /Users/joe/Desktop/test2/c/HvMessagePool.c
>> /Users/joe/Desktop/test2/c/HvMessageQueue.c
>> /Users/joe/Desktop/test2/c/HvSignalPhasor.c
>> /Users/joe/Desktop/test2/c/HvSignalVar.c /Users/joe/Desktop/test2/c/HvTable.c
>> -msse4.1 -ffast-math -DNDEBUG -std=c++11 -Wall -s WASM=1 -s
>> RESERVED_FUNCTION_POINTERS=2 -s EXPORTED_FUNCTIONS=["_hv_heavy_new",
>> "_hv_delete", "_hv_processInline", "_hv_getNumInputChannels",
>> "_hv_getNumOutputChannels", "_hv_setPrintHook", "_hv_sendFloatToReceiver",
>> "_hv_sendBangToReceiver", "_hv_sendSymbolToReceiver", "_hv_stringToHash",
>> "_hv_msg_getByteSize", "_hv_msg_init", "_hv_msg_setFloat",
>> "_hv_msg_getFloat", "_hv_table_getLength", "_hv_table_resize",
>> "_hv_table_getBuffer"] -O3 --memory-init-file 0 -o
>> /Users/joe/Desktop/test2/js/heavyLib.min.js
>>
>>
>> And the errors I get are these:
>>
>> path/to/c/HvMath.h:335:11: error: use of undeclared identifier
>> '__builtin_ia32_roundps'
>>   *bOut = _mm_ceil_ps(bIn);
>>           ^
>> path/to/emscripten/incoming/system/include/SSE/smmintrin.h:53:30: note:
>> expanded from macro '_mm_ceil_ps'
>> #define _mm_ceil_ps(X)       _mm_round_ps((X), _MM_FROUND_CEIL)
>>                              ^
>> path/to/emscripten/incoming/system/include/SSE/smmintrin.h:64:11: note:
>> expanded from macro '_mm_round_ps'
>>   (__m128)__builtin_ia32_roundps((__v4sf)(__m128)(X), (M)); })
>>           ^
>> path/to/c/HvMath.h:335:9: error: assigning to '__m128' (aka 'float32x4')
>> from incompatible type 'void'
>>   *bOut = _mm_ceil_ps(bIn);
>>         ^ ~~~~~~~~~~~~~~~~
>> path/to/c/HvMath.h:353:11: error: use of undeclared identifier
>> '__builtin_ia32_roundps'
>>   *bOut = _mm_floor_ps(bIn);
>>           ^
>> path/to/emscripten/incoming/system/include/SSE/smmintrin.h:58:30: note:
>> expanded from macro '_mm_floor_ps'
>> #define _mm_floor_ps(X)      _mm_round_ps((X), _MM_FROUND_FLOOR)
>>                              ^
>> path/to/emscripten/incoming/system/include/SSE/smmintrin.h:64:11: note:
>> expanded from macro '_mm_round_ps'
>>   (__m128)__builtin_ia32_roundps((__v4sf)(__m128)(X), (M)); })
>>           ^
>> path/to/c/HvMath.h:353:9: error: assigning to '__m128' (aka 'float32x4')
>> from incompatible type 'void'
>>   *bOut = _mm_floor_ps(bIn);
>>         ^ ~~~~~~~~~~~~~~~~~
>> 4 errors generated.
>> ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
>>
>>
>> It looks like it can't find the builtin x86 functions, I'm not that
>> familiar with the emscripten build system so I'm wondering if there's
>> something I'm misssing?
>>
>> Note: i had to change the #include <immintrin.h> declaration we usually
>> have to #include <smmintrin.h> for emscripten to find the SSE4.1
>> intrinsics.
>>
>> Any pointers would be much appreciated!
>>
>> Thanks,
>> Joe
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "emscripten-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/emscripten-discuss/h4xM0ds5lJE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to