[PATCH] Fix to PR15810 - _xgetbv not declared

Serge Pavlov sepavloff at gmail.com
Mon Apr 22 20:40:25 PDT 2013


On some systems with VS2010 SP1 _xgetbv is not defined. This fix implements the detection on availability of the function based on the presence of macro _XCR_XFEATURE_ENABLED_MASK, which is defined in the same file as _xgetbv.

http://llvm-reviews.chandlerc.com/D707

Files:
  lib/Support/Host.cpp

Index: lib/Support/Host.cpp
===================================================================
--- lib/Support/Host.cpp
+++ lib/Support/Host.cpp
@@ -119,7 +119,7 @@
   // 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_FULL_VER) && _MSC_FULL_VER >= 160040219
+#elif defined(_MSC_FULL_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
   unsigned long long rEAX = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
 #else
   int rEAX = 0; // Ensures we return false
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D707.1.patch
Type: text/x-patch
Size: 588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130422/a3bc0a41/attachment.bin>


More information about the llvm-commits mailing list