On 02/10/2017 02:45 AM, Joel FALCOU via Boost wrote:
Thanks for your interest.
The documentation looks good. May I ask one or two things?
1. Is simd::pack a POD? i.e. can aligned memory be cast into a pack?
float* aligned_memory=...; simd::pack<float>* packed_memory = (simd::pack<float>*) aligned_memory;
(this would make my experiment a two-line change)
It is. We however advise using our load/aligned_load functions so you can access more fine-tuned operations and we can guarantee that the proper intrinsic are emitted. We had cases where such reintrepret_cast lead to subtle bugs on some compilers/arch combination or sub-optimal performances.
Does Boost.SIMD support non-aligned loads/stores? Aligned data is ideal, but having the ability to load/store from addresses that aren't aligned (and emitting the appropriate instructions to do so safely, e.g. _mm_loadu_ps() instead of _mm_load_ps() with SSE) can be important for some applications also. That would allow the use of SIMD without having to do an explicit realignment first. On some architectures (e.g. post-Nehalem x86 CPUs with SSE), the aligned/unaligned penalty is very small also. The library looks very good in my cursory glance over the documentation; I'm looking forward to see it get a review. Jason