[llvm] r178604 - Attempting to fix the build on older GCC versions.

Aaron Ballman aaron at aaronballman.com
Wed Apr 3 05:28:57 PDT 2013


>From what I can tell, other projects (libffmpeg, etc) use this same
trick and likely for the same reason.  I've resolved it this way in
r178636 and will continue to watch the buildbots.

Thanks!

~Aaron

On Wed, Apr 3, 2013 at 3:38 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:
> On Wed, Apr 3, 2013 at 3:39 AM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> Author: aaronballman
>> Date: Tue Apr  2 20:39:37 2013
>> New Revision: 178604
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=178604&view=rev
>> Log:
>> Attempting to fix the build on older GCC versions.
>>
>> 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=178604&r1=178603&r2=178604&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Support/Host.cpp (original)
>> +++ llvm/trunk/lib/Support/Host.cpp Tue Apr  2 20:39:37 2013
>> @@ -113,7 +113,8 @@ static bool GetX86CpuIDAndInfo(unsigned
>>  }
>>
>>  static bool OSHasAVXSupport() {
>> -#if defined(__GNUC__)
>> +#if defined( __GNUC__ ) && \
>> +    (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)
>>    int rEAX, rEDX;
>>    __asm__ ("xgetbv" : "=a" (rEAX), "=d" (rEDX) : "c" (0));
>
>
> Ugh, this doesn't look right to me. The support is dependent on the
> assembler used, not the compiler, and this check even disables clang (which
> identifies itself as GCC 4.2).
>
> I don't see a way to check the assembler version, but an ugly workaround
> would be to hand-assemble xgetbv and emit a .byte sequence.
>
>    __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (rEAX), "=d" (rEDX) : "c" (0));
>
> nasty, but it should work.
>
> - Ben
>
>
>>
>>  #elif defined(_MSC_VER)
>>
>>
>> _______________________________________________
>> 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