[llvm] r178666 - Testing for Visual Studio 2010 SP1 or greater before calling the _xgetbv intrinsic. This also fixes a minor code formatting issue.

Aaron Ballman aaron at aaronballman.com
Wed Apr 3 09:28:24 PDT 2013


Author: aaronballman
Date: Wed Apr  3 11:28:24 2013
New Revision: 178666

URL: http://llvm.org/viewvc/llvm-project?rev=178666&view=rev
Log:
Testing for Visual Studio 2010 SP1 or greater before calling the _xgetbv intrinsic.  This also fixes a minor code formatting issue.

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=178666&r1=178665&r2=178666&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Wed Apr  3 11:28:24 2013
@@ -113,13 +113,13 @@ static bool GetX86CpuIDAndInfo(unsigned
 }
 
 static bool OSHasAVXSupport() {
-#if defined( __GNUC__ )
+#if defined(__GNUC__)
   // Check xgetbv; this uses a .byte sequence instead of the instruction 
   // directly because older assemblers do not include support for xgetbv and 
   // there is no easy way to conditionally compile based on the assembler used.
   int rEAX, rEDX;
   __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (rEAX), "=d" (rEDX) : "c" (0));
-#elif defined(_MSC_VER)
+#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219
   unsigned long long rEAX = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
 #else
   int rEAX = 0; // Ensures we return false





More information about the llvm-commits mailing list