From 5c41ccb8fb24854c54ffbe7244b580aa7ec4a21e Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 25 Apr 2016 07:20:37 -0400 Subject: [PATCH] Enable tzcnt intrinsic for GCC when BMI is defined --- misc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc.h b/misc.h index 346698db..23404493 100644 --- a/misc.h +++ b/misc.h @@ -59,7 +59,7 @@ #include #endif -#if defined(__GNUC__) && defined(__AVX2__) +#if defined(__GNUC__) && defined(__BMI__) # include #endif @@ -607,7 +607,7 @@ inline unsigned int TrailingZeros(word32 v) // We don't enable for Microsoft because it requires a runtime check. // http://msdn.microsoft.com/en-us/library/hh977023%28v=vs.110%29.aspx assert(v != 0); -#if defined(__GNUC__) && defined(__AVX2__) +#if defined(__GNUC__) && defined(__BMI__) return (unsigned int)_tzcnt_u32(v); #elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400) return (unsigned int)__builtin_ctz(v); @@ -638,7 +638,7 @@ inline unsigned int TrailingZeros(word64 v) // We don't enable for Microsoft because it requires a runtime check. // http://msdn.microsoft.com/en-us/library/hh977023%28v=vs.110%29.aspx assert(v != 0); -#if defined(__GNUC__) && defined(__AVX2__) +#if defined(__GNUC__) && defined(__BMI__) return (unsigned int)_tzcnt_u64(v); #elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400) return (unsigned int)__builtin_ctzll(v);