Hi Everyone,
We got a user report of a compile failure using Apple's Clang. I don't
know the exact Apple Clang version at the moment. Its on OS X 10.11,
and its probably the one bundled with the latest Xcode.
Here's the error report
(Redirecting to Google Groups):
misc.h:675:23: error: use of undeclared identifier '_tzcnt_u64'
misc.h:790:22: error: use of undeclared identifier '_blsr_u64';
did you mean '__blsr_u32'?
Here's the code in question from misc.h (from
cryptopp/misc.h at master · weidai11/cryptopp · GitHub):
#if defined(__GNUC__) && defined(__BMI__)
return (unsigned int)_tzcnt_u64(v);
#elif defined(__GNUC__) && (GCC_VERSION >= 30400)
return (unsigned int)__builtin_ctzll(v);
#elif ...
....
#endif
And from misc.h (from cryptopp/misc.h at master · weidai11/cryptopp · GitHub):
#if defined(__GNUC__) && defined(__BMI__)
template <>
inline bool IsPowerOf2<word64>(const word64 &value)
{
return value > 0 && _blsr_u64(value) == 0;
}
#endif
I believe both symbols are available in <immintrin.h>
Intel® Intrinsics Guide):
#if defined(__GNUC__) && defined(__BMI__)
#include <immintrin.h>
#endif
Given __BMI__ is defined, why are we catching the "undeclared identifier" error?
Thanlk in advance/