
On Sun, Mar 26, 2017 at 3:05 PM, Joel FALCOU via Boost
On 26/03/2017 08:37, Artyom Beilis via Boost wrote:
2. I can't find in documentation how to performs casts between different types: I see in docs split_low (actually after I grepped for _mm_unpacklo) but I failed to find how to use one - there is no documentation regarding conversion/casting operation or at least I failed to find one.
The function you look for is pack_cast
https://developer.numscale.com/boost.simd/documentation/develop/group__group...
pack
Still do you have examples or documentation for:
How do I cast for example low part or high part something like:
pack
3. Is there more convenient way to perform basic saturated operation for example if I want to calc abs diff of two bs::pack
values a,b I need to write bs::saturated_(be::minus)(a,b) + bs::saturated_(bs::minus)(b,a)
It is quite inconvenient especially when most of operations you want to do are saturated.
All functions in Boost.SIMD are function object. Decorators just wrap them in a proper layer. So
auto sm = bs::saturated_(be::minus); sm(a,b) + sm(b,a);
is the recommended way to do it.
I see
Then in your specific example, you can use dist that do the proper computation without calling the saturated costly version of minus. IF you really want to handle saturation, in case of handling INT_MAX and INT_MIN then call saturated_(dist).
Usually, we strongly advice the use of the highest-level possible function instead of trying to just rewrite an old SSE* code using one-for-one intrinsic mapping. Boost.SIMD wraps a lot of well known tricks and optimization in high level version of said function in order to give access to those to all users.
I agree I searched for something like absdiff but didn't found the "dist" function - but indeed it is better. Thanks, Artyom