[cfe-users] Use of undeclared identifier '_tzcnt_u64'
Jeffrey Walton via cfe-users
cfe-users at lists.llvm.org
Sun Jun 26 03:23:33 PDT 2016
We needed this goodness for Clang. Its another case of Clang
pretending to be another compiler, but failing to consume a program.
The frustrating thing is, we have dedicated code paths for Clang,
including inline assembly that works around its integrated assembler
bugs. If Clang would stop pretending to be other compilers, then
things would "just work".
#if defined(__GNUC__) && defined(__BMI__)
# include <immintrin.h>
+# if defined(__clang__)
+# define _tzcnt_u32(x) __tzcnt_u32(x)
+# define _tzcnt_u64(x) __tzcnt_u64(x)
+# define _blsr_u32(x) __blsr_u32(x)
+# define _blsr_u64(x) __blsr_u64(x)
+# endif
#endif
On Sat, Jun 25, 2016 at 9:41 PM, Jeffrey Walton <noloader at gmail.com> wrote:
> 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
> (https://groups.google.com/forum/#!topic/cryptopp-users/BI8yGpr2XNo):
>
> 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
> http://github.com/weidai11/cryptopp/blob/master/misc.h):
>
> #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 http://github.com/weidai11/cryptopp/blob/master/misc.h):
>
> #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>
> http://software.intel.com/sites/landingpage/IntrinsicsGuide/#=undefined&text=_blsr_u64&expand=421):
>
> #if defined(__GNUC__) && defined(__BMI__)
> #include <immintrin.h>
> #endif
>
>
> Given __BMI__ is defined, why are we catching the "undeclared identifier" error?
>
> Thanlk in advance/
More information about the cfe-users
mailing list