#if defined(HWY_SET_MACROS_PER_TARGET) == defined(HWY_TARGET_TOGGLE)
#ifdef HWY_SET_MACROS_PER_TARGET
#undef HWY_SET_MACROS_PER_TARGET
#else
#define HWY_SET_MACROS_PER_TARGET
#endif
#endif
#include "hwy/detect_compiler_arch.h"
#include "hwy/detect_targets.h"
#undef HWY_NAMESPACE
#undef HWY_ALIGN
#undef HWY_MAX_BYTES
#undef HWY_LANES
#undef HWY_HAVE_SCALABLE
#undef HWY_HAVE_TUPLE
#undef HWY_HAVE_INTEGER64
#undef HWY_HAVE_FLOAT16
#undef HWY_HAVE_FLOAT64
#undef HWY_MEM_OPS_MIGHT_FAULT
#undef HWY_NATIVE_FMA
#undef HWY_NATIVE_DOT_BF16
#undef HWY_CAP_GE256
#undef HWY_CAP_GE512
#undef HWY_TARGET_IS_SVE
#if HWY_TARGET & HWY_ALL_SVE
#define HWY_TARGET_IS_SVE …
#else
#define HWY_TARGET_IS_SVE …
#endif
#undef HWY_TARGET_IS_NEON
#if HWY_TARGET & HWY_ALL_NEON
#define HWY_TARGET_IS_NEON …
#else
#define HWY_TARGET_IS_NEON …
#endif
#undef HWY_TARGET_IS_PPC
#if HWY_TARGET & HWY_ALL_PPC
#define HWY_TARGET_IS_PPC …
#else
#define HWY_TARGET_IS_PPC …
#endif
#if HWY_TARGET == HWY_RVV && \
((HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1400) || \
(HWY_COMPILER_CLANG))
#define HWY_HAVE_TUPLE …
#else
#define HWY_HAVE_TUPLE …
#endif
#undef HWY_MAX_N
#if HWY_TARGET == HWY_SCALAR
#define HWY_MAX_N …
#else
#define HWY_MAX_N …
#endif
#undef HWY_MAX_POW2
#define HWY_MAX_POW2 …
#undef HWY_MIN_POW2
#if HWY_TARGET == HWY_RVV
#define HWY_MIN_POW2 …
#else
#define HWY_MIN_POW2 …
#endif
#undef HWY_TARGET_STR
#if defined(HWY_DISABLE_PCLMUL_AES)
#define HWY_TARGET_STR_PCLMUL_AES …
#else
#define HWY_TARGET_STR_PCLMUL_AES …
#endif
#if defined(HWY_DISABLE_BMI2_FMA)
#define HWY_TARGET_STR_BMI2_FMA …
#else
#define HWY_TARGET_STR_BMI2_FMA …
#endif
#if defined(HWY_DISABLE_F16C)
#define HWY_TARGET_STR_F16C …
#else
#define HWY_TARGET_STR_F16C …
#endif
#define HWY_TARGET_STR_SSE2 …
#define HWY_TARGET_STR_SSSE3 …
#define HWY_TARGET_STR_SSE4 …
#define HWY_TARGET_STR_AVX2 …
#define HWY_TARGET_STR_AVX3 …
#define HWY_TARGET_STR_AVX3_DL …
#if !defined(HWY_AVX3_DISABLE_AVX512BF16) && \
(HWY_COMPILER_CLANGCL || \
(HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1000) || \
(HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 900))
#define HWY_AVX3_DISABLE_AVX512BF16
#endif
#if !defined(HWY_AVX3_DISABLE_AVX512BF16)
#define HWY_TARGET_STR_AVX3_ZEN4 …
#else
#define HWY_TARGET_STR_AVX3_ZEN4 …
#endif
#define HWY_TARGET_STR_AVX3_SPR …
#if defined(HWY_DISABLE_PPC8_CRYPTO)
#define HWY_TARGET_STR_PPC8_CRYPTO …
#else
#define HWY_TARGET_STR_PPC8_CRYPTO …
#endif
#define HWY_TARGET_STR_PPC8 …
#define HWY_TARGET_STR_PPC9 …
#if HWY_COMPILER_CLANG
#define HWY_TARGET_STR_PPC10 …
#else
#define HWY_TARGET_STR_PPC10 …
#endif
#define HWY_TARGET_STR_Z14 …
#define HWY_TARGET_STR_Z15 …
#if HWY_TARGET == HWY_SSE2
#define HWY_NAMESPACE …
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_SSSE3
#define HWY_NAMESPACE …
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES(T) …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_SSE4
#define HWY_NAMESPACE …
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_AVX2
#define HWY_NAMESPACE …
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#ifdef HWY_DISABLE_BMI2_FMA
#define HWY_NATIVE_FMA …
#else
#define HWY_NATIVE_FMA …
#endif
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_AVX3 || HWY_TARGET == HWY_AVX3_DL || \
HWY_TARGET == HWY_AVX3_ZEN4 || HWY_TARGET == HWY_AVX3_SPR
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#if HWY_TARGET == HWY_AVX3_SPR && HWY_COMPILER_GCC_ACTUAL && \
HWY_HAVE_SCALAR_F16_TYPE
#define HWY_HAVE_FLOAT16 …
#else
#define HWY_HAVE_FLOAT16 …
#endif
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#if (HWY_TARGET <= HWY_AVX3_ZEN4) && !defined(HWY_AVX3_DISABLE_AVX512BF16)
#define HWY_NATIVE_DOT_BF16 …
#else
#define HWY_NATIVE_DOT_BF16 …
#endif
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#if HWY_TARGET == HWY_AVX3
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_AVX3_DL
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_AVX3_ZEN4
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_AVX3_SPR
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#else
#error "Logic error"
#endif
#elif HWY_TARGET_IS_PPC
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#if HWY_TARGET == HWY_PPC8
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_PPC9
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_PPC10
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#else
#error "Logic error"
#endif
#elif HWY_TARGET == HWY_Z14 || HWY_TARGET == HWY_Z15
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#if HWY_TARGET == HWY_Z14
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_Z15
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#else
#error "Logic error"
#endif
#elif HWY_TARGET_IS_NEON
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) || HWY_TARGET == HWY_NEON_BF16
#define HWY_HAVE_FLOAT16 …
#else
#define HWY_HAVE_FLOAT16 …
#endif
#if HWY_ARCH_ARM_A64
#define HWY_HAVE_FLOAT64 …
#else
#define HWY_HAVE_FLOAT64 …
#endif
#define HWY_MEM_OPS_MIGHT_FAULT …
#if defined(__ARM_FEATURE_FMA) || defined(__ARM_VFPV4__) || HWY_ARCH_ARM_A64
#define HWY_NATIVE_FMA …
#else
#define HWY_NATIVE_FMA …
#endif
#if HWY_NEON_HAVE_F32_TO_BF16C || HWY_TARGET == HWY_NEON_BF16
#define HWY_NATIVE_DOT_BF16 …
#else
#define HWY_NATIVE_DOT_BF16 …
#endif
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#if HWY_TARGET == HWY_NEON_WITHOUT_AES
#define HWY_NAMESPACE …
#elif HWY_TARGET == HWY_NEON
#define HWY_NAMESPACE …
#elif HWY_TARGET == HWY_NEON_BF16
#define HWY_NAMESPACE …
#else
#error "Logic error, missing case"
#endif
#if HWY_HAVE_RUNTIME_DISPATCH
#if HWY_ARCH_ARM_V7
#if HWY_COMPILER_GCC_ACTUAL >= 800
#define HWY_TARGET_STR …
#else
#endif
#else
#if (HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 1300) || \
(HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 1300)
#define HWY_TARGET_STR_NEON …
#else
#define HWY_TARGET_STR_NEON …
#endif
#if HWY_COMPILER_CLANG >= 1600
#define HWY_TARGET_STR_FP16 …
#else
#define HWY_TARGET_STR_FP16 …
#endif
#if HWY_TARGET == HWY_NEON_WITHOUT_AES
#elif HWY_TARGET == HWY_NEON
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_NEON_BF16
#define HWY_TARGET_STR …
#else
#error "Logic error, missing case"
#endif
#endif
#else
#endif
#elif HWY_TARGET_IS_SVE
#define HWY_ALIGN …
#define HWY_LANES …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#if HWY_SVE_HAVE_BF16_FEATURE
#define HWY_NATIVE_DOT_BF16 …
#else
#define HWY_NATIVE_DOT_BF16 …
#endif
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#if HWY_TARGET == HWY_SVE2
#define HWY_NAMESPACE …
#define HWY_MAX_BYTES …
#define HWY_HAVE_SCALABLE …
#elif HWY_TARGET == HWY_SVE_256
#define HWY_NAMESPACE …
#define HWY_MAX_BYTES …
#define HWY_HAVE_SCALABLE …
#elif HWY_TARGET == HWY_SVE2_128
#define HWY_NAMESPACE …
#define HWY_MAX_BYTES …
#define HWY_HAVE_SCALABLE …
#else
#define HWY_NAMESPACE …
#define HWY_MAX_BYTES …
#define HWY_HAVE_SCALABLE …
#endif
#if HWY_HAVE_RUNTIME_DISPATCH
#if HWY_TARGET == HWY_SVE2 || HWY_TARGET == HWY_SVE2_128
#if defined(__ARM_FEATURE_SVE2_AES) || (HWY_BASELINE_SVE2 == 0)
#define HWY_TARGET_STR …
#else
#define HWY_TARGET_STR …
#endif
#else
#define HWY_TARGET_STR …
#endif
#else
#endif
#elif HWY_TARGET == HWY_WASM
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_WASM_EMU256
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_NAMESPACE …
#define HWY_TARGET_STR …
#elif HWY_TARGET == HWY_RVV
#define HWY_ALIGN
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#if HWY_RVV_HAVE_F16_VEC
#define HWY_HAVE_FLOAT16 …
#else
#define HWY_HAVE_FLOAT16 …
#endif
#define HWY_NAMESPACE …
#elif HWY_TARGET == HWY_EMU128
#define HWY_ALIGN …
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_NAMESPACE …
#elif HWY_TARGET == HWY_SCALAR
#define HWY_ALIGN
#define HWY_MAX_BYTES …
#define HWY_LANES …
#define HWY_HAVE_SCALABLE …
#define HWY_HAVE_INTEGER64 …
#define HWY_HAVE_FLOAT16 …
#define HWY_HAVE_FLOAT64 …
#define HWY_MEM_OPS_MIGHT_FAULT …
#define HWY_NATIVE_FMA …
#define HWY_NATIVE_DOT_BF16 …
#define HWY_CAP_GE256 …
#define HWY_CAP_GE512 …
#define HWY_NAMESPACE …
#else
#pragma message("HWY_TARGET does not match any known target")
#endif
#if HWY_HAVE_FLOAT16 && !HWY_HAVE_SCALAR_F16_TYPE
#error "Logic error: f16 vectors but no scalars"
#endif
#if HWY_IS_ASAN || HWY_IS_MSAN
#undef HWY_MEM_OPS_MIGHT_FAULT
#define HWY_MEM_OPS_MIGHT_FAULT …
#endif
#undef HWY_BEFORE_NAMESPACE
#if defined(HWY_TARGET_STR)
#define HWY_BEFORE_NAMESPACE() …
#else
#define HWY_BEFORE_NAMESPACE …
#endif
#undef HWY_AFTER_NAMESPACE
#if defined(HWY_TARGET_STR)
#define HWY_AFTER_NAMESPACE() …
#else
#define HWY_AFTER_NAMESPACE …
#endif
#undef HWY_ATTR
#if defined(HWY_TARGET_STR) && HWY_HAS_ATTRIBUTE(target)
#define HWY_ATTR …
#else
#define HWY_ATTR
#endif