summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2013-04-03 16:28:24 +0000
committerAaron Ballman <aaron@aaronballman.com>2013-04-03 16:28:24 +0000
commitedc03c660cc7d7fd2c45cf3ca5f5c9a8754bef98 (patch)
tree14c8fa901ac9d3292f1435d6b448451d5937f4ae
parentb6d6c0d458a5db556abd96a027eced2c4a379476 (diff)
downloadbcm5719-llvm-edc03c660cc7d7fd2c45cf3ca5f5c9a8754bef98.tar.gz
bcm5719-llvm-edc03c660cc7d7fd2c45cf3ca5f5c9a8754bef98.zip
Testing for Visual Studio 2010 SP1 or greater before calling the _xgetbv intrinsic. This also fixes a minor code formatting issue.
llvm-svn: 178666
-rw-r--r--llvm/lib/Support/Host.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index f91fb37e1da..fef66e634f9 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -113,13 +113,13 @@ static bool GetX86CpuIDAndInfo(unsigned value, unsigned *rEAX,
}
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
OpenPOWER on IntegriCloud