From c354118fb90f221c55d610d88d958a950457fb8d Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 16 Nov 2022 20:36:16 +0100 Subject: [PATCH] define macro NETGEN_DEFAULT_SIMD_SIZE --- libsrc/core/simd_generic.hpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/libsrc/core/simd_generic.hpp b/libsrc/core/simd_generic.hpp index 5b3870b7..e6fdb68b 100644 --- a/libsrc/core/simd_generic.hpp +++ b/libsrc/core/simd_generic.hpp @@ -15,17 +15,22 @@ namespace ngcore { +#if defined __AVX512F__ + #define NETGEN_DEFAULT_SIMD_SIZE 8 + #define NETGEN_NATIVE_SIMD_SIZE 8 +#elif defined __AVX__ + #define NETGEN_DEFAULT_SIMD_SIZE 4 + #define NETGEN_NATIVE_SIMD_SIZE 4 +#elif defined NETGEN_ARCH_AMD64 + #define NETGEN_DEFAULT_SIMD_SIZE 2 + #define NETGEN_NATIVE_SIMD_SIZE 2 +#else + #define NETGEN_DEFAULT_SIMD_SIZE 2 + #define NETGEN_NATIVE_SIMD_SIZE 1 +#endif constexpr int GetDefaultSIMDSize() { -#if defined __AVX512F__ - return 8; -#elif defined __AVX__ - return 4; -#elif defined NETGEN_ARCH_AMD64 - return 2; -#else - return 2; -#endif + return NETGEN_DEFAULT_SIMD_SIZE; } constexpr bool IsNativeSIMDSize(int n) {