[PATCH] D50876: Clean up newly created <bit> header

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 10:35:42 PDT 2018


craig.topper added inline comments.


================
Comment at: include/bit:140
   static_assert(sizeof(unsigned) == 4, "");
   return __popcnt(__x);
 }
----------------
MSVC blindly uses the popcnt instruction whenever it sees this intrinsic. So this only works on Nehalem and newer Intel CPUs. And Barcelona and newer AMD CPUs. This is why llvm uses a bit math version of popcnt for MSVC in include/llvm/Support/MathExtras.h


================
Comment at: include/bit:150
   static_assert(sizeof(unsigned long long) == 8, "");
   return __popcnt64(__x);
 }
----------------
This doesn't exist in 32-bit MSVC.


https://reviews.llvm.org/D50876





More information about the cfe-commits mailing list