Testing for Visual Studio 2010 SP1 or greater before calling the _xgetbv intrinsic...
authorAaron Ballman <aaron@aaronballman.com>
Wed, 3 Apr 2013 16:28:24 +0000 (16:28 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Wed, 3 Apr 2013 16:28:24 +0000 (16:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178666 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Host.cpp

index f91fb37e1daeb7b115b63116abef988057e5e72a..fef66e634f989352bc4f3dd3841d509aecd22169 100644 (file)
@@ -113,13 +113,13 @@ static bool GetX86CpuIDAndInfo(unsigned value, unsigned *rEAX,
 }
 
 static bool OSHasAVXSupport() {\r
-#if defined( __GNUC__ )\r
+#if defined(__GNUC__)\r
   // Check xgetbv; this uses a .byte sequence instead of the instruction \r
   // directly because older assemblers do not include support for xgetbv and \r
   // there is no easy way to conditionally compile based on the assembler used.\r
   int rEAX, rEDX;\r
   __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (rEAX), "=d" (rEDX) : "c" (0));\r
-#elif defined(_MSC_VER)\r
+#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219\r
   unsigned long long rEAX = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);\r
 #else\r
   int rEAX = 0; // Ensures we return false\r