Compiling Issues when using Xmmintrin.h

33 views
Skip to first unread message

Jonathan Esteban

unread,
Aug 7, 2019, 12:24:58 PM8/7/19
to emscripten-discuss
Hi all,

I'm trying to compile a file using this command:

$em++ -g -I src/lib/ -I boost src/lib/pke/multiparty.cpp -v


However, I am getting this error:

In file included from src/lib/pke/multiparty.cpp:7:                                                              
In file included from src/lib/pke/multiparty.h:10:                                                               
In file included from src/lib/Common/Defines.h:9:                                                                
In file included from /home/user/emsdk/fastcomp/fastcomp/lib/clang/6.0.1/include/emmintrin.h:27:      
In file included from /home/user/emsdk/fastcomp/fastcomp/lib/clang/6.0.1/include/xmmintrin.h:27:      
/home/user/emsdk/fastcomp/fastcomp/lib/clang/6.0.1/include/mmintrin.h:47:5: error: use of undeclared  
      identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?                                         
    __builtin_ia32_emms();


When I compile using g++ I get no error. I think g++ is using another source for its emmintrin.h. I need to use emmintrin.h as it is used in Defines.h through:

#include <emmintrin.h>

Any thoughts? I'm at a loss of ideas and I'm very new to Emscripten and building projects in general. Let me know if you need more debugging info.

Thanks!

Thomas Lively

unread,
Aug 7, 2019, 1:29:08 PM8/7/19
to emscripte...@googlegroups.com
Hi, using native SIMD intrinsics is not supported with WebAssembly because emulating native SIMD via WebAssembly SIMD will lead to unexpected slowdowns. See this recent thread for more details: https://groups.google.com/forum/#!msg/emscripten-discuss/bp_iubXU3BE/vI4opCduCQAJ and see https://emscripten.org/docs/porting/simd.html#porting-simd-code-targeting-webassembly for more information on using WebAssembly's SIMD.

--
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 emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/77bcb151-7497-4fe9-87a8-43137473538a%40googlegroups.com.
Message has been deleted

Jonathan Esteban

unread,
Aug 7, 2019, 2:19:03 PM8/7/19
to emscripten-discuss
Thanks for the prompt reply! I've read through the links you provided. What I'm getting at is that there's no way to compile code that uses SIMD intrinsics? (i.e. emmintrin.h)  

Thomas Lively

unread,
Aug 7, 2019, 4:03:12 PM8/7/19
to emscripte...@googlegroups.com
That's right. Those particular intrinsics are specific to x86 platforms. You can use the WebAssembly SIMD intrinsics from https://github.com/emscripten-core/emscripten/blob/incoming/system/include/wasm_simd128.h instead, though.

--
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 emscripten-disc...@googlegroups.com.

Jonathan Esteban

unread,
Aug 7, 2019, 4:34:40 PM8/7/19
to emscripten-discuss
Okay, so I'll try replacing the intrinsics we are using with the ones WebAssembly supports. I swapped #include <emmintrin.h> with #include <wasm_simd128.h>

and added the flag -msimd128

so now I'm running:

em++ -msimd128 -g -I src/lib/ -I boost src/lib/pke/multiparty.cpp -v



But I'm getting the following errors:
In file included from src/lib/pke/multiparty.cpp:7:                                                              
In file included from src/lib/pke/multiparty.h:10:                                                               
In file included from src/lib/Common/Defines.h:9:                                                                
/home/jonathanesteban/emsdk/fastcomp/emscripten/system/include/wasm_simd128.h:482:18: error: use of undeclared   
      identifier '__builtin_wasm_bitselect'                                                                      
  return (v128_t)__builtin_wasm_bitselect((__i32x4)a, (__i32x4)b, (__i32x4)mask);                                
                 ^                                                                                               
/home/jonathanesteban/emsdk/fastcomp/emscripten/system/include/wasm_simd128.h:492:10: error: use of undeclared   
      identifier '__builtin_wasm_any_true_i8x16'                                                                 
  return __builtin_wasm_any_true_i8x16((__i8x16)a);  
Any idea of why this is happening?

Thanks

Thomas Lively

unread,
Aug 7, 2019, 4:43:55 PM8/7/19
to emscripte...@googlegroups.com
Yes, it looks like you're using the old fastcomp backend, but SIMD and other post-MVP WebAssembly features are only supported with the new LLVM backend. If you're using the emsdk, you can try installing and activating the `latest-upstream` tag instead of just `latest`.

--
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 emscripten-disc...@googlegroups.com.

Jonathan Esteban

unread,
Aug 7, 2019, 4:57:46 PM8/7/19
to emscripten-discuss
Awesome, thank you so much!
Reply all
Reply to author
Forward
0 new messages