[llvm] r178674 - Ensuring that both bits are set, and not just a combination of one or the other.

Aaron Ballman aaron at aaronballman.com
Wed Apr 3 11:00:22 PDT 2013


Author: aaronballman
Date: Wed Apr  3 13:00:22 2013
New Revision: 178674

URL: http://llvm.org/viewvc/llvm-project?rev=178674&view=rev
Log:
Ensuring that both bits are set, and not just a combination of one or the other.

Modified:
    llvm/trunk/lib/Support/Host.cpp

Modified: llvm/trunk/lib/Support/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=178674&r1=178673&r2=178674&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Wed Apr  3 13:00:22 2013
@@ -152,7 +152,8 @@ std::string sys::getHostCPUName() {
   // If CPUID indicates support for XSAVE, XRESTORE and AVX, and XGETBV 
   // indicates that the AVX registers will be saved and restored on context
   // switch, then we have full AVX support.
-  bool HasAVX = (ECX & ((1 << 28) | (1 << 27))) != 0 && OSHasAVXSupport();
+  const unsigned AVXBits = (1 << 27) | (1 << 28);
+  bool HasAVX = ((ECX & AVXBits) == AVXBits) && OSHasAVXSupport();
   GetX86CpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
   bool Em64T = (EDX >> 29) & 0x1;
 





More information about the llvm-commits mailing list