[PATCH] Fix to PR15810 - _xgetbv not declared

Aaron Ballman aaron at aaronballman.com
Tue Apr 23 10:40:55 PDT 2013


Patch applied in r180125, thanks!

~Aaron

On Tue, Apr 23, 2013 at 1:35 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> I think I prefer this patch to the second one as it's slightly safer
> to also test for MSVC.  Thanks for the patch!
>
> ~Aaron
>
> On Mon, Apr 22, 2013 at 11:40 PM, Serge Pavlov <sepavloff at gmail.com> wrote:
>> 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
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>



More information about the llvm-commits mailing list