]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
DYNAMIC_BMI2 enabled for clang 1032/head
authorYann Collet <cyan@fb.com>
Mon, 5 Mar 2018 00:05:59 +0000 (16:05 -0800)
committerYann Collet <cyan@fb.com>
Mon, 5 Mar 2018 00:05:59 +0000 (16:05 -0800)
clang only claims compatibility with gcc 4.2.
Consequently, recent patch which reserved DYNAMIC_BMI2 for gcc >= 4.8
also disabled it for clang.

fix : __clang__ is now enough to enable DYNAMIC_BMI2
(associated with other existing conditions : x64/x64, !bmi2)

lib/common/compiler.h

index 63d32258a36f58b60184109510cbc23e2b9b4cd6..bb87301263fd9129d34f39ea6978ae33e856beb5 100644 (file)
  * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
  */
 #ifndef DYNAMIC_BMI2
-  #if defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) \
-      && (defined(__x86_64__) || defined(_M_X86)) && !defined(__BMI2__)
+  #if defined(__clang__)    \
+      || (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