mcpp index

compat.xsimd

#include

C++ wrappers for SIMD intrinsics with runtime architecture selection (header-only)

#include <xsimd/xsimd.hpp>
mcpp add compat.xsimd@14.3.0

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

// compat.xsimd — assert architecture discovery, unaligned load/store, batch
// arithmetic, math functions and horizontal reduction through the public API.
#include <xsimd/xsimd.hpp>

#include <array>
#include <cmath>
#include <cstddef>
#include <cstdio>

int main() {
    using batch_type = xsimd::batch<float>;
    constexpr std::size_t width = batch_type::size;

    std::array<float, width> left{};
    std::array<float, width> right{};
    std::array<float, width> sum{};
    for (std::size_t i = 0; i < width; ++i) {
        left[i] = static_cast<float>(i + 1);
        right[i] = static_cast<float>(2 * i + 2);
    }

    bool ok = true;
// …

tests/examples/xsimd/tests/xsimd.cpp · 项目 tests/examples/xsimd

构建

targets
xsimd (lib)
language
c++23
C standard
c11
import std
no
include dirs
*/include

源文件 (1)

  • mcpp_generated/xsimd_anchor.c

生成的文件

  • mcpp_generated/xsimd_anchor.c

版本

版本平台 镜像sha256
14.3.0 最新 LinuxWindowsmacOS 源站 b3d50e7a73fb…