[Mesa-dev] [PATCH] mesa: Permanently enable features supported by target CPU at compile time.
Siavash Eliasi
siavashserver at gmail.com
Fri Nov 7 23:48:25 PST 2014
On 11/08/2014 10:30 AM, Matt Turner wrote:
> On Fri, Nov 7, 2014 at 10:43 PM, Siavash Eliasi <siavashserver at gmail.com> wrote:
>> This will remove the need for unnecessary runtime checks for CPU features if
>> already supported by target CPU, resulting in smaller and less branchy code.
>> ---
>> src/mesa/x86/common_x86_features.h | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h
>> index 66f2cf6..9888c26 100644
>> --- a/src/mesa/x86/common_x86_features.h
>> +++ b/src/mesa/x86/common_x86_features.h
>> @@ -67,5 +67,30 @@
>> #define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
>> #define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
>>
>> +/* Permanently enable features supported by target CPU at compile time */
>> +#ifdef __MMX__
>> +#define cpu_has_mmx 1
>> +#endif
>> +
>> +#ifdef __SSE__
>> +#define cpu_has_xmm 1
>> +#endif
>> +
>> +#ifdef __SSE2__
>> +#define cpu_has_xmm2 1
>> +#endif
>> +
>> +#ifdef __3dNOW__
>> +#define cpu_has_3dnow 1
>> +#endif
>> +
>> +#ifdef __SSSE3__
>> +#define cpu_has_ssse3 1
>> +#endif
> There's not an existing cpu_has_ssse3 macro.
Just wanted to add it in advance in case Timothy Arceri's patch gets merged:
[Mesa-dev] [PATCH V2 1/2] mesa: add runtime support for SSSE3
http://lists.freedesktop.org/archives/mesa-dev/2014-November/070338.html
I'll remove it if this isn't fine by you.
>
>> +
>> +#ifdef __SSE4_1__
>> +#define cpu_has_sse4_1 1
>> +#endif
> As you can see at the beginning of the patch, you're just redefining
> the same macros...
>
> They should be
>
> #ifdef __SSE__
> #define cpu_has_xmm 1
> #else
> #define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM)
> #endif
Sure, will modify it. By the way, GCC should use the last macro
definition so "cpu_has_xmm" should be "1" in case it's going to be
compiled for an SSE capable target and previous definition should be
ignored. Am I missing something?
Best regards,
Siavash Eliasi.
More information about the mesa-dev
mailing list