From 45b09e7625ae3d121aa8586b65db906a8da3ec93 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 1 Mar 2018 15:02:18 -0800 Subject: [PATCH] limit DYNAMIC_BMI2 to gcc >= 4.8 attribute bmi2 not supported by gcc 4.4 --- lib/common/compiler.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 24f35328..63d32258 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -71,10 +71,11 @@ #endif /* Enable runtime BMI2 dispatch based on the CPU. - * Enabled for clang/gcc on x86 when BMI2 isn't enabled by default. + * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default. */ #ifndef DYNAMIC_BMI2 - #if defined(__GNUC__) && (defined(__x86_64__) || defined(_M_X86)) && !defined(__BMI2__) + #if defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) \ + && (defined(__x86_64__) || defined(_M_X86)) && !defined(__BMI2__) # define DYNAMIC_BMI2 1 #else # define DYNAMIC_BMI2 0