[Mesa-dev] [PATCH] gallivm: Translate all util_cpu_caps bits to LLVM attributes.

Roland Scheidegger sroland at vmware.com
Wed Oct 21 20:14:27 PDT 2015


Oh and it probably should go to stable.

Roland

Am 21.10.2015 um 18:55 schrieb Roland Scheidegger:
> Thanks for fixing this up.
> 
> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
> 
> Am 21.10.2015 um 18:25 schrieb Jose Fonseca:
>> This should prevent disparity between features Mesa and LLVM
>> believe are supported by the CPU.
>>
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_archives_mesa-2Ddev_2015-2DOctober_thread.html-2396990&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=bHU3Xahz-uDZ6-5z71qyASt0F2O3ZeKC4cD2GpiDv8c&s=ptbM2wYSyjHNp6-mOXdvcUtSt6aNeKZa0eDOOFLXfOQ&e= 
>>
>> Tested on a i7-3720QM w/ LLVM 3.3 and 3.6.
>> ---
>>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 34 ++++++++++++++++++++++++++-
>>  1 file changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>> index 72fab8c..7073956 100644
>> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>> @@ -498,6 +498,32 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>>     }
>>  
>>     llvm::SmallVector<std::string, 1> MAttrs;
>> +   if (util_cpu_caps.has_sse) {
>> +      MAttrs.push_back("+sse");
>> +   }
>> +   if (util_cpu_caps.has_sse2) {
>> +      MAttrs.push_back("+sse2");
>> +   }
>> +   if (util_cpu_caps.has_sse3) {
>> +      MAttrs.push_back("+sse3");
>> +   }
>> +   if (util_cpu_caps.has_ssse3) {
>> +      MAttrs.push_back("+ssse3");
>> +   }
>> +   if (util_cpu_caps.has_sse4_1) {
>> +#if HAVE_LLVM >= 0x0304
>> +      MAttrs.push_back("+sse4.1");
>> +#else
>> +      MAttrs.push_back("+sse41");
>> +#endif
>> +   }
>> +   if (util_cpu_caps.has_sse4_2) {
>> +#if HAVE_LLVM >= 0x0304
>> +      MAttrs.push_back("+sse4.2");
>> +#else
>> +      MAttrs.push_back("+sse42");
>> +#endif
>> +   }
>>     if (util_cpu_caps.has_avx) {
>>        /*
>>         * AVX feature is not automatically detected from CPUID by the X86 target
>> @@ -509,8 +535,14 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>>        if (util_cpu_caps.has_f16c) {
>>           MAttrs.push_back("+f16c");
>>        }
>> -      builder.setMAttrs(MAttrs);
>> +      if (util_cpu_caps.has_avx2) {
>> +         MAttrs.push_back("+avx2");
>> +      }
>> +   }
>> +   if (util_cpu_caps.has_altivec) {
>> +      MAttrs.push_back("+altivec");
>>     }
>> +   builder.setMAttrs(MAttrs);
>>  
>>  #if HAVE_LLVM >= 0x0305
>>     StringRef MCPU = llvm::sys::getHostCPUName();
>>
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=bHU3Xahz-uDZ6-5z71qyASt0F2O3ZeKC4cD2GpiDv8c&s=hgElrxhkotuJUOBB43VA6IPz3E7UDEO3splLILFioaM&e= 
> 



More information about the mesa-dev mailing list