From 52661f35e889e04624275231729686dc2dd1b205 Mon Sep 17 00:00:00 2001 From: Konstantinos Margaritis Date: Wed, 12 May 2021 13:26:42 +0300 Subject: [PATCH] add global definitions for CHUNKSIZE/VECTORSIZE, define HAVE_AVX512* only when BUILD_AVX512 is also enabled --- src/util/arch/x86/x86.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/util/arch/x86/x86.h b/src/util/arch/x86/x86.h index dae08149..3c909f89 100644 --- a/src/util/arch/x86/x86.h +++ b/src/util/arch/x86/x86.h @@ -58,15 +58,26 @@ #define HAVE_SIMD_256_BITS #endif -#if defined(__AVX512BW__) +#if defined(__AVX512BW__) && defined(BUILD_AVX512) #define HAVE_AVX512 #define HAVE_SIMD_512_BITS #endif -#if defined(__AVX512VBMI__) +#if defined(__AVX512VBMI__) && defined(BUILD_AVX512) #define HAVE_AVX512VBMI #endif +#if defined(HAVE_SIMD_512_BITS) +#define CHUNKSIZE 512 +#define VECTORSIZE 64 +#elif defined(HAVE_SIMD_256_BITS) +#define CHUNKSIZE 256 +#define VECTORSIZE 32 +#elif defined(HAVE_SIMD_128_BITS) +#define CHUNKSIZE 128 +#define VECTORSIZE 16 +#endif + /* * ICC and MSVC don't break out POPCNT or BMI/2 as separate pre-def macros */