C++ library for portable SIMD intrinsics wrappers and vectorization
Modern, portable C++ wrappers for SIMD intrinsics
$ cat > simd_example.cpp << 'EOF'
#include <xsimd/xsimd.hpp>
using namespace xsimd;
auto v1 = batch<float>(1.0f, 2.0f, 3.0f, 4.0f);
auto v2 = batch<float>(5.0f, 6.0f, 7.0f, 8.0f);
auto result = v1 + v2;
EOF$ cat > CMakeLists.txt << 'EOF'
find_package(xsimd REQUIRED)
add_executable(myapp main.cpp)
target_link_libraries(myapp PRIVATE xsimd::xsimd)
EOF$ c++ -std=c++14 -I$(brew --prefix xsimd)/include program.cpp -o program$ cat > check_simd.cpp << 'EOF'
#include <xsimd/xsimd.hpp>
std::cout << xsimd::supported_architectures() << std::endl;
EOF$ cat > batch_ops.cpp << 'EOF'
#include <xsimd/xsimd.hpp>
using batch_type = xsimd::batch<double>;
batch_type a = xsimd::load_aligned(ptr1);
batch_type b = xsimd::load_aligned(ptr2);
xsimd::store_aligned(ptr_out, a * b + xsimd::sqrt(a));
EOF