Instruction Set Macros

Each of these macros corresponds to an instruction set supported by XSIMD. They can be used to filter arch-specific code.

XSIMD_TARGET_X86

Set to 1 if the target is the x86 architecture family.

XSIMD_WITH_INLINE_ASM

Set to 1 if GNU-style inline assembly is available, to 0 otherwise.

XSIMD_REASSOCIATIVE_MATH

Set to 1 when the compiler is allowed to reassociate floating-point operations (e.g.

-ffast-math, -fassociative-math). Detected automatically from FAST_MATH (GCC/Clang) and ASSOCIATIVE_MATH (GCC). Clang does not define a macro for standalone -fassociative-math; users should define XSIMD_REASSOCIATIVE_MATH=1 manually in that case.

XSIMD_WITH_SSE2

Set to 1 if SSE2 is available at compile-time, to 0 otherwise.

XSIMD_WITH_SSE3

Set to 1 if SSE3 is available at compile-time, to 0 otherwise.

XSIMD_WITH_SSSE3

Set to 1 if SSSE3 is available at compile-time, to 0 otherwise.

XSIMD_WITH_SSE4_1

Set to 1 if SSE4.1 is available at compile-time, to 0 otherwise.

XSIMD_WITH_SSE4_2

Set to 1 if SSE4.2 is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX

Set to 1 if AVX is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX2

Set to 1 if AVX2 is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVXVNNI

Set to 1 if AVXVNNI is available at compile-time, to 0 otherwise.

XSIMD_WITH_FMA3_SSE

Set to 1 if FMA3 for SSE is available at compile-time, to 0 otherwise.

XSIMD_WITH_FMA3_AVX

Set to 1 if FMA3 for AVX is available at compile-time, to 0 otherwise.

XSIMD_WITH_FMA4

Set to 1 if FMA4 is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512F

Set to 1 if AVX512F is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512CD

Set to 1 if AVX512CD is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512DQ

Set to 1 if AVX512DQ is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512BW

Set to 1 if AVX512BW is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512ER

Set to 1 if AVX512ER is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512PF

Set to 1 if AVX512PF is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512IFMA

Set to 1 if AVX512IFMA is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512VBMI

Set to 1 if AVX512VBMI is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512VBMI2

Set to 1 if AVX512VBMI2 is available at compile-time, to 0 otherwise.

XSIMD_WITH_AVX512VNNI_AVX512VBMI2

Set to 1 if AVX512VNNI is available at compile-time, to 0 otherwise.

XSIMD_TARGET_ARM64

Set to 1 if the target is in the ARM architecture family in 64 bits, to 0 otherwise.

XSIMD_TARGET_ARM

Set to 1 if the target is in the ARM architecture family, to 0 otherwise.

XSIMD_WITH_NEON

Set to 1 if NEON is available at compile-time, to 0 otherwise.

XSIMD_WITH_NEON64

Set to 1 if NEON64 is available at compile-time, to 0 otherwise.

XSIMD_WITH_I8MM_NEON64

Set to 1 if i8mm neon64 extension is available at compile-time, to 0 otherwise.

XSIMD_WITH_SVE

Set to 1 if SVE is available and bit width is pre-set at compile-time, to 0 otherwise.

XSIMD_TARGET_RISCV

Set to 1 if the target is the RISC-V architecture family.

XSIMD_WITH_RVV

Set to 1 if RVV is available and bit width is pre-set at compile-time, to 0 otherwise.

XSIMD_WITH_WASM

Set to 1 if WebAssembly SIMD is available at compile-time, to 0 otherwise.

XSIMD_TARGET_PPC

Set to 1 if the target is in the PowerPC architecture family, to 0 otherwise.

XSIMD_WITH_VSX

Set to 1 if VMX with VSX extension is available at compile-time, to 0 otherwise.

XSIMD_TARGET_S390X

Set to 1 if the target is in the IBM Z architecture family, to 0 otherwise.

XSIMD_WITH_VXE

  • *

  • *

  • * Set to 1 if s390x VXE is available at compile-time, to 0 otherwise.

  • * Float vectors have been introduced with VXE included with IBM z14.

XSIMD_HAVE_LINUX_GETAUXVAL

Set to 1 if the target is a linux.

Changing Default Architecture

You can change the default instruction set used by xsimd (when none is provided explicitely) by setting the XSIMD_DEFAULT_ARCH macro to, say, xsimd::avx2. A common usage is to set it to xsimd::unsupported as a way to detect instantiation of batches with the default architecture.