libsimdpp icon indicating copy to clipboard operation
libsimdpp copied to clipboard

How can we combine with Intel® SSE2 (Streaming SIMD Extensions 2)?

Open ardianumam opened this issue 3 years ago • 4 comments

Hi,

I have existing code in Intel SIMD SSE2, how can I use API of libsimdpp if the variable I have is in SSE2, for example _mm_set_epi32? Is there any way so that, for example, I can use script such as: int32<4> = add(A, B); where A and B are SSE data type of _mm_set_epi32? Many thanks.

ardianumam avatar Apr 25 '21 11:04 ardianumam

Facing the same issue, any recommendation on this @p12tic @mtklein? Thanks

jehoshuapratama avatar Apr 26 '21 03:04 jehoshuapratama

I find that there's very little like this that memcpy() and static_assert(sizeof(A) == sizeof(B), "") cannot fix.

mtklein avatar Apr 26 '21 03:04 mtklein

Thanks for the reply @mtklein . In the documentation here, it's stated that: uint16<N>( const native_type& n ); where n is native SIMD type to construct from. What does it mean by that? Can we use SIMD of SSE2 as n? Many thanks.

ardianumam avatar Apr 26 '21 04:04 ardianumam

Yep, the native_type for uint16<8> on x86 is __m128i. That's all the type stores, just native_type d_;.

https://github.com/p12tic/libsimdpp/blob/9dac213d6965bf57c7accf9dda6d16c3bed0e3ac/simdpp/types/int16x8.h#L111

mtklein avatar Apr 26 '21 14:04 mtklein