From 09ccabbe6c1242f080eb763ac66b490a7b3439a1 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 20 Sep 2024 10:59:54 -0400 Subject: [PATCH] enable BMI, but only when LLVM is the compiler (#2255) --- include/simdjson/haswell/begin.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/simdjson/haswell/begin.h b/include/simdjson/haswell/begin.h index 1be8c192c..2a245cdc2 100644 --- a/include/simdjson/haswell/begin.h +++ b/include/simdjson/haswell/begin.h @@ -4,8 +4,14 @@ #include "simdjson/haswell/intrinsics.h" #if !SIMDJSON_CAN_ALWAYS_RUN_HASWELL +// We enable bmi2 only if LLVM/clang is used, because GCC may not +// make good use of it. See https://github.com/simdjson/simdjson/pull/2243 +#if defined(__clang__) +SIMDJSON_TARGET_REGION("avx2,bmi,bmi2,pclmul,lzcnt,popcnt") +#else SIMDJSON_TARGET_REGION("avx2,bmi,pclmul,lzcnt,popcnt") #endif +#endif #include "simdjson/haswell/bitmanipulation.h" #include "simdjson/haswell/bitmask.h"