File indexing completed on 2025-01-26 04:07:17

0001 /*
0002  * SPDX-FileCopyrightText: 2022 L. E. Segovia <amy@amyspark.me>
0003  *
0004  * SPDX-License-Identifier: BSD-3-Clause
0005  */
0006 
0007 #ifndef KIS_XSIMD_CONFIG_HPP
0008 #define KIS_XSIMD_CONFIG_HPP
0009 
0010 #include <config-xsimd.h>
0011 
0012 #ifdef HAVE_XSIMD
0013 
0014 // MSVC patching.
0015 #if defined(_MSC_VER)
0016 #if defined(_M_ARM64)
0017 #ifndef NDEBUG
0018 #pragma message("Patching over MSVC for aarch64.")
0019 #endif
0020 #define __ARM_ARCH 8
0021 #define __aarch64__ 1
0022 #define __ARM_NEON 1
0023 #endif
0024 
0025 #if defined(_M_ARM)
0026 #ifndef NDEBUG
0027 #pragma message("Patching over MSVC for arm-v7a.")
0028 #endif
0029 #define __ARM_ARCH _M_ARM
0030 #define __ARM_NEON 1
0031 #endif
0032 #endif
0033 
0034 #include <xsimd/xsimd.hpp>
0035 
0036 #else /* HAVE_XSIMD */
0037 
0038 namespace xsimd
0039 {
0040 struct generic
0041 {
0042     static constexpr bool supported() noexcept { return true; }
0043     static constexpr bool available() noexcept { return true; }
0044     static constexpr char const* name() noexcept { return "xsimd not available, unvectorized"; }
0045 };
0046 }; // namespace xsimd
0047 
0048 #endif /* HAVE_XSIMD */
0049 
0050 #endif // KIS_XSIMD_CONFIG_HPP